UIActivityDailyRechargeCtr.lua 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. local UIActivityDailyRechargeCtr = class("UIActivityDailyRechargeCtr", require("UICtrBase"))
  2. function UIActivityDailyRechargeCtr:Init(view)
  3. self.view = view
  4. self.curShowID = 0
  5. self.maxID = 0
  6. self.minID = 0
  7. end
  8. function UIActivityDailyRechargeCtr:SetData(data)
  9. self.asyncIdx = 0
  10. if data == nil then return end
  11. self.data = data
  12. end
  13. function UIActivityDailyRechargeCtr:GetAsyncIdx()
  14. self.asyncIdx = self.asyncIdx + 1
  15. return self.asyncIdx
  16. end
  17. function UIActivityDailyRechargeCtr:GetData()
  18. return self.data
  19. end
  20. function UIActivityDailyRechargeCtr:GetActId()
  21. return self.data.actId
  22. end
  23. function UIActivityDailyRechargeCtr:GetNextTiredChargeCfgData()
  24. local curNum = self:GetDailyTiredChargeCount()
  25. self.cfgData = ManagerContainer.CfgMgr:GetNextActivitiesTiredChargeCfgByNum(curNum)
  26. if self.cfgData then
  27. self.needChargeCount = self.cfgData.RechargeAmount - curNum
  28. end
  29. return self.cfgData
  30. end
  31. function UIActivityDailyRechargeCtr:GetDailyTiredChargeCount()
  32. return ManagerContainer.PayMgr:GetDayRecharge()
  33. end
  34. function UIActivityDailyRechargeCtr:GetDailyRewardState()
  35. local actId = self:GetActId()
  36. local activeItem = ManagerContainer.DataMgr.ActsDataMgr:GetActivityItemById(actId)
  37. if not activeItem then
  38. return 0
  39. end
  40. --self.curShowID = activeItem:GetRewardState()
  41. self.minID,self.maxID = ManagerContainer.CfgMgr:GetNextActivitiesTiredChargeCfg_New_MaxAndMInIndexByDay(activeItem:GetCurDay())
  42. return activeItem:GetRewardState(), activeItem:GetCurDay()
  43. end
  44. function UIActivityDailyRechargeCtr:GetDailyRPState()
  45. local actId = self:GetActId()
  46. local activeItem = ManagerContainer.DataMgr.ActsDataMgr:GetActivityItemById(actId)
  47. if not activeItem then
  48. return false
  49. end
  50. return activeItem:HasRedPoint()
  51. end
  52. function UIActivityDailyRechargeCtr:GetNeedChargeCount()
  53. return self.needChargeCount
  54. end
  55. function UIActivityDailyRechargeCtr:SendRewardReq(pageId)
  56. local actId = self:GetActId()
  57. ManagerContainer.DataMgr.ActsDataMgr:SendGetActivityRewardReq(actId)
  58. end
  59. function UIActivityDailyRechargeCtr:IsInActivityDrops(cfgId)
  60. return ManagerContainer.DataMgr.ActsDataMgr:IsInActivityDrop(cfgId)
  61. end
  62. function UIActivityDailyRechargeCtr:OnDispose()
  63. self.data = nil
  64. self.view = nil
  65. end
  66. function UIActivityDailyRechargeCtr:NextShowID()
  67. self.curShowID = self.curShowID + 1
  68. if self.curShowID > self.maxID then
  69. self.curShowID = self.minID
  70. end
  71. --LogError(" NextShowID Max = "..self.maxID.." minID = "..self.minID.." curShowID = "..self.curShowID)
  72. return self.curShowID
  73. end
  74. function UIActivityDailyRechargeCtr:LastShowID()
  75. self.curShowID = self.curShowID - 1
  76. if self.curShowID < self.minID then
  77. self.curShowID = self.maxID
  78. end
  79. --LogError("LastShowID Max = "..self.maxID.." minID = "..self.minID.." curShowID = "..self.curShowID)
  80. return self.curShowID
  81. end
  82. return UIActivityDailyRechargeCtr