GlobalTimer.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. }
  10. -- 全局定时器
  11. ---@param timer_id number 定时器id
  12. ---@param interva_sed number 间隔执行时间
  13. function GlobalTimer.setontimerex(timer_id, interva_sed)
  14. this.jprint("timer_id " .. tostring(timer_id))
  15. setontimerex(timer_id, interva_sed)
  16. end
  17. function GlobalTimer.setofftimer(timer_id)
  18. setofftimerex(timer_id)
  19. end
  20. ----------------------------------------------------------
  21. function ontimerex100001()
  22. this.jprint("开始执行战盟竞选")
  23. GlobalTimer.setofftimer(TimerIds.UNION_RUN_FOR_LEADER)
  24. UnionChangeLeader.RunForLeader.finishRunforLeaderActor()
  25. end
  26. function ontimerex100002()
  27. this.jprint("开始执行战盟弹劾")
  28. GlobalTimer.setofftimer(TimerIds.UNION_IMPEACH)
  29. UnionChangeLeader.Impeach.finishImpeachData()
  30. end
  31. function ontimerex100004()
  32. this.jprint("开始执行自动恢复蓝量")
  33. RoleAttr.autoRecoveryMagic()
  34. end
  35. function ontimerex100005()
  36. KunDunAuction.ontimer()
  37. end
  38. ---------------------------- 日志打印 -----------------------------
  39. this.log_open = false
  40. function this.jprint(param)
  41. if not this.log_open then
  42. return
  43. end
  44. if param == nil then
  45. param = "error! 输出内容为空. nil"
  46. end
  47. jprint(param)
  48. end
  49. function this.loginfo(actor, param)
  50. if not this.log_open then
  51. return
  52. end
  53. if param == nil then
  54. param = "error! 日志输出内容为空. nil"
  55. end
  56. jprint(param)
  57. info(actor, param)
  58. end