UIIdolActivityShopCtr.lua 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. local UIIdolActivityShopCtr = class("UIIdolActivityShopCtr", require("UICtrBase"))
  2. function UIIdolActivityShopCtr:Init(view)
  3. self.view = view
  4. end
  5. function UIIdolActivityShopCtr:SetData(data)
  6. self.asyncIdx = 0
  7. if data == nil then return end
  8. self.data = data
  9. end
  10. function UIIdolActivityShopCtr:GetAsyncIdx()
  11. self.asyncIdx = self.asyncIdx + 1
  12. return self.asyncIdx
  13. end
  14. function UIIdolActivityShopCtr:GetData()
  15. return self.data
  16. end
  17. function UIIdolActivityShopCtr:OnDispose()
  18. self.data = nil
  19. self.view = nil
  20. self.shopType = nil
  21. self.shopSubType = nil
  22. self.idx = nil
  23. end
  24. function UIIdolActivityShopCtr:InitData()
  25. self.shopType = Enum.RuneShopType.IdolShop
  26. end
  27. function UIIdolActivityShopCtr:GetIdx()
  28. return self.idx
  29. end
  30. function UIIdolActivityShopCtr:GetCurShopType()
  31. return self.shopType, self.shopSubType
  32. end
  33. function UIIdolActivityShopCtr:RefreshCurShopData(forceRefresh)
  34. ManagerContainer.DataMgr.RuneShopDataMgr:RefreshShopData(self.shopType, self.shopSubType, forceRefresh)
  35. self.curShopData = ManagerContainer.DataMgr.RuneShopDataMgr:GetShopData(self.shopType, self.shopSubType)
  36. if self.curShopData then
  37. if not self.curShopData:IsValidShow() then
  38. self.curShopData:RefreshShowGoodsDatas()
  39. end
  40. return true
  41. end
  42. return false
  43. end
  44. function UIIdolActivityShopCtr:GetGuildsmenRewords()
  45. return self.guildsmenRewords
  46. end
  47. function UIIdolActivityShopCtr:GetMvpRewords()
  48. return self.mvpRewords
  49. end
  50. function UIIdolActivityShopCtr:SendShopInfoReq()
  51. ManagerContainer.DataMgr.RuneShopDataMgr:SendShopInfoReq(self.shopType,nil)
  52. end
  53. function UIIdolActivityShopCtr:GetShowGoodsDatas()
  54. if not self.curShopData then
  55. self.curShopData = ManagerContainer.DataMgr.RuneShopDataMgr:GetShopData(self.shopType, self.shopSubType)
  56. if self.curShopData then
  57. if not self.curShopData:IsValidShow() then
  58. self.curShopData:RefreshShowGoodsDatas()
  59. end
  60. end
  61. end
  62. return self.curShopData and self.curShopData:GetShowGoodsDatas() or nil
  63. end
  64. function UIIdolActivityShopCtr:SendPay(goodsId)
  65. local errorCode = ManagerContainer.PayMgr:RuneShopPay(self.shopType, self.shopSubType, goodsId)
  66. local errorCodeKey = ManagerContainer.PayMgr:GetInitPayErrorCodeLangKey(errorCode)
  67. return errorCodeKey
  68. end
  69. function UIIdolActivityShopCtr:SendRewardReq(rewardType)
  70. ManagerContainer.DataMgr.RankActivitiesMgr:SendRewardReq(self.type, rewardType)
  71. end
  72. return UIIdolActivityShopCtr