GlobalTimer_1.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. GlobalTimer = {}
  2. local this = {}
  3. TimerIds = {
  4. UNION_RUN_FOR_LEADER = 100001,
  5. UNION_IMPEACH = 100002,
  6. AUTO_RECOVERY_MAGIC = 100004,
  7. KUN_DUN_AUCTION = 100005,
  8. OPEN_BREAK_POINT_DEBUG = 100006,
  9. WORLD_BOSS_AUCTION = 100007,
  10. }
  11. -- 全局定时器
  12. ---@param timer_id number 定时器id
  13. ---@param interva_sed number 间隔执行时间
  14. function GlobalTimer.setontimerex(timer_id, interva_sed)
  15. this.jprint("timer_id " .. tostring(timer_id))
  16. setontimerex(timer_id, interva_sed)
  17. end
  18. function GlobalTimer.setofftimer(timer_id)
  19. setofftimerex(timer_id)
  20. end
  21. ----------------------------------------------------------
  22. function ontimerex100001()
  23. this.jprint("开始执行战盟竞选")
  24. GlobalTimer.setofftimer(TimerIds.UNION_RUN_FOR_LEADER)
  25. UnionChangeLeader.RunForLeader.finishRunforLeaderActor()
  26. end
  27. function ontimerex100002()
  28. this.jprint("开始执行战盟弹劾")
  29. GlobalTimer.setofftimer(TimerIds.UNION_IMPEACH)
  30. UnionChangeLeader.Impeach.finishImpeachData()
  31. end
  32. function ontimerex100004()
  33. this.jprint("开始执行自动恢复蓝量")
  34. RoleAttr.autoRecoveryMagic()
  35. end
  36. function ontimerex100005()
  37. KunDunAuction.ontimer()
  38. end
  39. function ontimerex100007()
  40. WbAuction.ontimer()
  41. end
  42. ---------------------------- 日志打印 -----------------------------
  43. this.log_open = false
  44. function this.jprint(param)
  45. if not this.log_open then
  46. return
  47. end
  48. if param == nil then
  49. param = "error! 输出内容为空. nil"
  50. end
  51. jprint(param)
  52. end
  53. function this.loginfo(actor, param)
  54. if not this.log_open then
  55. return
  56. end
  57. if param == nil then
  58. param = "error! 日志输出内容为空. nil"
  59. end
  60. jprint(param)
  61. info(actor, param)
  62. end