UIRewardsBuyTipsCtr.lua 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. local UIRewardsBuyTipsCtr = class("UIRewardsBuyTipsCtr", require("UICtrBase"))
  2. function UIRewardsBuyTipsCtr:Init(view)
  3. self.view = view
  4. end
  5. function UIRewardsBuyTipsCtr:InitData()
  6. self.rewards = {}
  7. local runeShopBaseData = ManagerContainer.DataMgr.RuneShopDataMgr:GetRewardsData()
  8. local cfg = runeShopBaseData:GetRewardsCurRoundCfg()
  9. self.expUp = cfg.MissonExpUp
  10. self.price = cfg.RMB
  11. local hasMissionExp
  12. local missionExp = runeShopBaseData:GetRewardsMissionExp()
  13. if missionExp then
  14. if missionExp > 0 then
  15. hasMissionExp = true
  16. end
  17. end
  18. if hasMissionExp then
  19. --战令icon
  20. self.rewards[1] = {cfgId = 35 , num =missionExp *(self.expUp -100)/100}
  21. end
  22. for i=1,runeShopBaseData:GetShowRewardsCurLv() do
  23. local tempdata = runeShopBaseData:GetGoodsDataByIdx(i)
  24. local hasId = false
  25. for j = 1, #self.rewards do
  26. if self.rewards[j].cfgId == tempdata.cfgData.CashReward[1][1] then
  27. self.rewards[j].num = self.rewards[j].num + tempdata.cfgData.CashReward[1][2]
  28. hasId = true
  29. break
  30. end
  31. end
  32. if not hasId then
  33. self.rewards[#self.rewards +1] = {cfgId = tempdata.cfgData.CashReward[1][1], num = tempdata.cfgData.CashReward[1][2]}
  34. end
  35. end
  36. --LogError("aaa"..tostring(#self.rewards).."bbb"..Inspect(self.rewards))
  37. end
  38. function UIRewardsBuyTipsCtr:SetData(data)
  39. self.asyncIdx = 0
  40. if data == nil then return end
  41. self.data = data
  42. end
  43. function UIRewardsBuyTipsCtr:GetAsyncIdx()
  44. self.asyncIdx = self.asyncIdx + 1
  45. return self.asyncIdx
  46. end
  47. function UIRewardsBuyTipsCtr:GetData()
  48. return self.data
  49. end
  50. function UIRewardsBuyTipsCtr:OnDispose()
  51. self.data = nil
  52. self.view = nil
  53. end
  54. function UIRewardsBuyTipsCtr:GetCurGoodsData()
  55. return self.rewards
  56. end
  57. function UIRewardsBuyTipsCtr:GetGiftName()
  58. return string.formatbykey('HighReward')
  59. end
  60. function UIRewardsBuyTipsCtr:GetPrice()
  61. return self.price
  62. end
  63. function UIRewardsBuyTipsCtr:GetExpUp()
  64. local baseData = ManagerContainer.DataMgr.RuneShopDataMgr:GetRewardsData()
  65. return tostring(ManagerContainer.CfgMgr:GetRuneShopExploreCfgByRound(ManagerContainer.DataMgr.RuneShopDataMgr:GetRewardsData():GetShowRewardsRoundData()).MissonExpUp)..'%'
  66. end
  67. function UIRewardsBuyTipsCtr:SendPay()
  68. ManagerContainer.SDKEventReportMgr:SendClickGoods()
  69. local round = ManagerContainer.DataMgr.RuneShopDataMgr:GetRewardsData():GetShowRewardsRoundData()
  70. local errorCode = ManagerContainer.PayMgr:AirShipPay(round)
  71. local errorCodeKey = ManagerContainer.PayMgr:GetInitPayErrorCodeLangKey(errorCode)
  72. return errorCodeKey
  73. end
  74. return UIRewardsBuyTipsCtr