KLEarningsItem.lua 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ---@class KLEarningsItem:UIKmlLuaPanelBase
  2. ---@field view KLEarningsItemView
  3. local KLEarningsItem = class(UIKmlLuaPanelBase)
  4. local this =KLEarningsItem
  5. ---创建时调用一次
  6. function this:Init()
  7. end
  8. ---创建或者刷新界面数据时调用
  9. function this:Refresh()
  10. end
  11. ---剩余三倍收益时间时长小于列表项领取的时长或月卡时间为0,“领取”按钮发暗,不可点击
  12. function this:UpdateUI(data,minute)
  13. local monthallTime = InfoManager.monthCardInfo.MonthCardTimeTotal-SL:GetMetaValue(EMetaVarGetKey.SERVER_TIME) --月卡总时间
  14. self.data = data
  15. self.iscanget = false --是否可领取
  16. if minute > 0 and data.hourtime * 60 <= minute then
  17. self.iscanget = true
  18. end
  19. if monthallTime <= 0 then
  20. self.iscanget = false
  21. end
  22. GUI:Button_setGrey(self.view.getBtn, not self.iscanget)
  23. GUI:Text_setString(self.view.predes, data.des)
  24. end
  25. ---注册UI事件和服务器消息
  26. function this:RegistEvents()
  27. GUI:AddOnClickEvent(self.view.getBtn, self, self.OnClickGetButton)
  28. end
  29. ---领取奖励
  30. function this:OnClickGetButton()
  31. if self.iscanget then
  32. SL:SendLuaNetMsg(LuaMessageIdToSever.TRIPLE_INCOME_RECEIVE,self.data.hourtime) --请求三倍收益信息
  33. end
  34. end
  35. function this:Close()
  36. end
  37. return this