GlobalTimer.lua 1.6 KB

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