| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- local UIRuneShopBTCtr = class("UIRuneShopBTCtr", require("UICtrBase"))
- function UIRuneShopBTCtr:Init(view)
- self.view = view
- end
- function UIRuneShopBTCtr:SetData(data)
- self.asyncIdx = 0
- self.data = data
- end
- function UIRuneShopBTCtr:GetAsyncIdx()
- self.asyncIdx = self.asyncIdx + 1
- return self.asyncIdx
- end
- function UIRuneShopBTCtr:GetData()
- return self.data
- end
- function UIRuneShopBTCtr:OnDispose()
- self.data = nil
- self.view = nil
- self.shopType = nil
- self.shopSubType = nil
- end
- function UIRuneShopBTCtr:InitData()
- local shopType = nil
- local shopSubType = nil
- if self.data then
- shopType = self.data[1]
- shopSubType = self.data[2]
- if shopType == Enum.RuneShopType.Gifts then
- if shopSubType ~= Enum.RuneShopSubType.Daily
- and shopSubType ~= Enum.RuneShopSubType.Week
- and shopSubType ~= Enum.RuneShopSubType.Gold then
- shopSubType = Enum.RuneShopSubType.ROCoin
- end
- elseif shopType == Enum.RuneShopType.SpecialPrivilege
- or shopType == Enum.RuneShopType.MonthCard
- or shopType == Enum.RuneShopType.PassCheck
- or shopType == Enum.RuneShopType.LimitTime then
- shopSubType = nil
- else
- shopType = Enum.RuneShopType.SpecialPrivilege
- shopSubType = nil
- end
- else
- shopType = Enum.RuneShopType.SpecialPrivilege
- shopSubType = nil
- end
- self.shopType = shopType
- self.shopSubType = shopSubType
- self:RefreshCurShopData(true)
- end
- function UIRuneShopBTCtr:RefreshCurShopData(forceRefresh)
- if self.shopType == Enum.RuneShopType.SpecialPrivilege
- or self.shopType == Enum.RuneShopType.PassCheck then
- self.curShopData = nil
- return
- end
- ManagerContainer.DataMgr.RuneShopDataMgr:RefreshShopData(self.shopType, self.shopSubType, forceRefresh)
- self.curShopData = ManagerContainer.DataMgr.RuneShopDataMgr:GetShopData(self.shopType, self.shopSubType)
- if self.curShopData then
- if not self.curShopData:IsValidShow() then
- self.curShopData:RefreshShowGoodsDatas()
- end
- end
- end
- function UIRuneShopBTCtr:GetShopType()
- return self.shopType
- end
- function UIRuneShopBTCtr:ChangeShopType(shopType)
- if self.shopType == shopType then
- return false
- end
- self.shopType = shopType
- if shopType == Enum.RuneShopType.Gifts then
- self.shopSubType = Enum.RuneShopSubType.ROCoin
- else
- self.shopSubType = nil
- end
- self:RefreshCurShopData(true)
- return true
- end
- function UIRuneShopBTCtr:GetShopSubType()
- return self.shopSubType
- end
- function UIRuneShopBTCtr:ChangeShopSubType(shopSubType)
- if self.shopSubType == shopSubType then
- return false
- end
- self.shopSubType = shopSubType
- self:RefreshCurShopData(true)
- return true
- end
- function UIRuneShopBTCtr:GetCurVipLv()
- return ManagerContainer.DataMgr.UserData:GetVipLv()
- end
- function UIRuneShopBTCtr:GetShowGoodsDatas()
- return self.curShopData and self.curShopData:GetShowGoodsDatas() or nil
- end
- function UIRuneShopBTCtr:GetRemainTime()
- return self.curShopData and self.curShopData:RefreshRemainTime() or nil
- end
- function UIRuneShopBTCtr:GetShowGoodsDataByIdx(idx)
- if self.curShopData then
- local showGoodsDatas = self.curShopData:GetShowGoodsDatas()
- if showGoodsDatas then
- return showGoodsDatas[idx]
- end
- end
- return nil
- end
- function UIRuneShopBTCtr:GetOwnResCountByItemId(cfgId)
- return CommonUtil.GetOwnResCountByItemId(cfgId)
- end
- function UIRuneShopBTCtr:GetSpecialPrivilegeId()
- return ManagerContainer.DataMgr.RuneShopDataMgr:GetSpecialPrivilegeId()
- end
- function UIRuneShopBTCtr:CanGetSpecialPrivilegeReward()
- return ManagerContainer.DataMgr.RuneShopDataMgr:CanGetSpecialPrivilegeReward()
- end
- function UIRuneShopBTCtr:GetRoPassStatus()
- return ManagerContainer.DataMgr.RuneShopDataMgr:GetRoPassStatus()
- end
- function UIRuneShopBTCtr:SendPay(goodsId)
- local errorCode = ManagerContainer.PayMgr:RuneShopPay(self.shopType, self.shopSubType, goodsId)
- local errorCodeKey = ManagerContainer.PayMgr:GetInitPayErrorCodeLangKey(errorCode)
- return errorCodeKey
- end
- function UIRuneShopBTCtr:SendRuneSpecialPrvilegeRewardReq()
- if not ManagerContainer.DataMgr.RuneShopDataMgr:SendRuneSpecialPrvilegeRewardReq() then
- return 100007
- end
- return 0
- end
- return UIRuneShopBTCtr
|