UIMountPreferenceInfo.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. ---@class UIMountPreferenceInfo @注释
  2. UIMountPreferenceInfo = class()
  3. local this = UIMountPreferenceInfo
  4. function this:ctor()
  5. end
  6. function this:Init()
  7. self:Reset()
  8. self:InitData()
  9. self:RegistMessages()
  10. end
  11. function this:Reset()
  12. self.resData = nil
  13. self.rechargeId = 501
  14. self.endTime = 30000
  15. end
  16. function this:InitData()
  17. end
  18. function this:RegistMessages()
  19. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_RECHARGE_ACTION,self.RES_RECHARGE_ACTION,self)
  20. --SL:RegisterLUAEvent(MESSAGE_ACCEPT, self.DataProcessing, self)
  21. end
  22. function this:RES_RECHARGE_ACTION(_,message)
  23. if message and message.type == tostring(ERechargeType.MountGift) then ---单充礼包
  24. self.resData = message.data
  25. if self.resData then
  26. local rechargeId = tonumber( self.resData.rechargeId)
  27. local endTime = self.resData.endTime
  28. local buycount,totalcount = InfoManager.countInfo:GetLimitAndTotalCountByRechargeId(rechargeId)
  29. if buycount > 0 and endTime > Time.GetServerTime() then
  30. self.rechargeId = rechargeId
  31. self.endTime = endTime
  32. end
  33. local topPanel = GUI:GetUI("dev/ui/MainUI/Panel/KLUISystemTop/KLUISystemTopPanel")
  34. if topPanel then
  35. topPanel:Refresh()
  36. end
  37. end
  38. end
  39. end
  40. function this:IsShowBtn()
  41. if self.resData then
  42. local endTime = self.resData.endTime
  43. local buycount,totalcount = InfoManager.countInfo:GetLimitAndTotalCountByRechargeId(tonumber(self.resData.rechargeId))
  44. if buycount > 0 and endTime > Time.GetServerTime() then
  45. return true
  46. end
  47. end
  48. return false
  49. end