KLWolfSoulFortressPanel.lua 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. ---@class KLWolfSoulFortressPanel:UIKmlLuaPanelBase
  2. ---@field view KLWolfSoulFortressPanelView
  3. local KLWolfSoulFortressPanel = class(UIKmlLuaPanelBase)
  4. local this =KLWolfSoulFortressPanel
  5. ---创建时调用一次
  6. function this:Init()
  7. end
  8. ---注册UI事件和服务器消息
  9. function this:RegistEvents()
  10. end
  11. ---创建或者刷新界面数据时调用
  12. function this:Refresh()
  13. self:RefreshTimeText()
  14. if not self.timer then
  15. self.timer = SL:StartLoopForever(1, self.RefreshTimeText, self) ---Timer.StartLoopForever(1, self.RefreshTimeText, self)
  16. end
  17. end
  18. function this:RefreshTimeText()
  19. if self.args then
  20. local endTime = self.args - SL.Time:GetServerTime() --Time.GetServerTime()
  21. if endTime > 0 and endTime < InfoManager.wolfSoulFortressInfo.nowWolfSoulFortressCfg.save * 1000 then
  22. GUI:Text_setString(self.view.textTime, "副本结束倒计时:".. SL.Time:FormatTimeHMS(math.floor(endTime))) ---Time.FormatTimeHMS(math.floor(endTime)))
  23. else
  24. GUI:Text_setString(self.view.textTime, "")
  25. end
  26. end
  27. end
  28. function this:Close()
  29. if self.timer then
  30. ---Timer.Stop(self.timer)
  31. SL:UnSchedule(self.timer)
  32. self.timer = nil
  33. end
  34. end
  35. return this