DailyAddRechargeInfo.lua 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ---@class DailyAddRechargeInfo
  2. DailyAddRechargeInfo = class()
  3. local this = DailyAddRechargeInfo
  4. function this:ctor()
  5. end
  6. function this:Reset()
  7. end
  8. function this:Init()
  9. self:InitData()
  10. self:RegistMessages()
  11. end
  12. function this:InitData()
  13. self.roleTodayAllMoney = 0 --玩家今日总充值钱数
  14. self.dailyAddRechargeDataTbl = {}
  15. self.investFundInfo = {} --投资基金信息
  16. end
  17. function this:RegistMessages()
  18. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_RECHARGE_ACTION,self.RefreshRoleTodayMoney,self)
  19. end
  20. --玩家今日总充值钱数
  21. function this:RefreshRoleTodayMoney(_,msg)
  22. if not table.isNullOrEmpty(msg) then
  23. if msg.type == "0" and msg.action == "record" then --通用协议内后端给的标识
  24. self.roleTodayAllMoney = msg.data.dailyTotalMoney
  25. SL:onLUAEvent(LUA_DAILYADD_RECHARGE_CHANGE)
  26. end
  27. if msg.type == "11" and msg.action == "panel" then --通用协议内后端给的标识
  28. self.dailyAddRechargeDataTbl = {}
  29. local tmpData = msg.data
  30. for _, v in pairs(tmpData) do
  31. v.dailyCfgData = SL:GetConfig("cfg_dailyRecharge",tonumber(v.dailyRechargeId))
  32. if not table.isNullOrEmpty(v.dailyCfgData) then
  33. if v.dailyCfgData.showCondition == "" or ConditionManager.Check4D(v.dailyCfgData.showCondition) then
  34. table.insert(self.dailyAddRechargeDataTbl,v)
  35. end
  36. end
  37. end
  38. this:RefreshDailyAddRechargeRedPoint(self.dailyAddRechargeDataTbl)
  39. SL:onLUAEvent(LUA_DAILYADD_RECHARGE_CHANGE)
  40. end
  41. if msg.type == "10" and msg.action == "panel" then --投资基金信息
  42. self.investFundInfo = msg.data
  43. self:RefreshInvestFundRedPoint()
  44. end
  45. end
  46. end
  47. function this:RefreshInvestFundRedPoint()
  48. local gotNum = table.count(self.investFundInfo.rewards)
  49. local totalNum = self.investFundInfo.buyDay
  50. local redPoint = totalNum > gotNum --是否有可领取的奖励
  51. InfoManager.mainRechargeInfo:RefreshMainRechargeRedPoint("tog_Nvestment",redPoint)
  52. end
  53. --每日累充红点逻辑:有可领取的奖励
  54. function this:RefreshDailyAddRechargeRedPoint(msg)
  55. local isShowRedPoint = false
  56. local data = msg
  57. for _, v in pairs(data) do
  58. if v.giftState == E_RechargeState.CanGet then
  59. isShowRedPoint = true
  60. break
  61. end
  62. end
  63. InfoManager.mainRechargeInfo:RefreshMainRechargeRedPoint("tog_DailyAddRecharge",isShowRedPoint)
  64. end