KLPushGiftBtnItem.lua 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ---@class KLPushGiftBtnItem:UIKmlLuaPanelBase
  2. ---@field view KLPushGiftBtnItemView
  3. local KLPushGiftBtnItem = class(UIKmlLuaPanelBase)
  4. local this = KLPushGiftBtnItem
  5. ---创建时调用一次
  6. function this:Init()
  7. self.Timer = nil
  8. end
  9. ---注册UI事件和服务器消息
  10. function this:RegistEvents()
  11. end
  12. ---界面显示时调用一次
  13. function this:Show()
  14. end
  15. ---创建或者刷新界面数据时调用
  16. function this:Refresh()
  17. end
  18. function this:ShowTime(endTime)
  19. self.Timer = SL:Schedule(self.Timer, 0, 1, endTime + 1, function()
  20. local timeText = endTime - Time.GetServerTime()
  21. GUI:Text_setString(self.view.Time, GUIUtil.FormatTimeHMS(timeText // 1000))
  22. if timeText <= 0 then
  23. local panel=GUI:GetUI("dev/outui/Recharge/Panel/KLRechargePush/KLRechargePushPanel")
  24. if panel then
  25. panel:Refresh()
  26. end
  27. return
  28. end
  29. end)
  30. end
  31. function this:Close()
  32. if self.Timer then
  33. SL:UnSchedule(self.Timer)
  34. end
  35. self.Timer = nil
  36. end
  37. return this