KLRechargeActivityToggleItem.lua 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. ---@class KLRechargeActivityToggleItem:UIKmlLuaPanelBase
  2. ---@field view KLRechargeActivityToggleItemView
  3. local KLRechargeActivityToggleItem = class(UIKmlLuaPanelBase)
  4. local this =KLRechargeActivityToggleItem
  5. --限时礼包右侧toggle
  6. ---创建时调用一次
  7. function this:Init()
  8. end
  9. ---注册UI事件和服务器消息
  10. function this:RegistEvents()
  11. GUI:SetToggleOnValueChange(self.view.activeToggle, self, self.ActivityOnToggle)
  12. end
  13. function this:ActivityOnToggle(control, eventData)
  14. if GUI:Toggle_getIsOn(control) then
  15. self.baseUI:SelectGiftGroup(self)
  16. end
  17. end
  18. ---创建或者刷新界面数据时调用
  19. function this:Refresh()
  20. if self.args then
  21. GUI:Text_setString(self.view.Label, self.args.allCfg.name)
  22. local actualTimer = (self.args.msgInfo.endTime - Time.GetServerTime()) / 1000
  23. if actualTimer > 0 then
  24. GUI:SetControl_time(self.view.time, actualTimer)
  25. end
  26. end
  27. end
  28. function this:RefreshItem(args)
  29. self.args = args
  30. self:Refresh()
  31. end
  32. function this:ToggleOn()
  33. GUI:setVisible(self.view.time,false)
  34. GUI:SetIsOnWithoutNotify(self.view.activeToggle, true)
  35. end
  36. function this:ToggleOff()
  37. GUI:setVisible(self.view.time,true)
  38. GUI:SetIsOnWithoutNotify(self.view.activeToggle, false)
  39. end
  40. function this:Close()
  41. end
  42. return this