local UILuckyEggShowCtr = class("UILuckyEggShowCtr", require("UICtrBase")) function UILuckyEggShowCtr:Init(view) self.view = view end function UILuckyEggShowCtr:SetData(data) self.asyncIdx = 0 self.data = data self:InitData() end function UILuckyEggShowCtr:GetAsyncIdx() self.asyncIdx = self.asyncIdx + 1 return self.asyncIdx end function UILuckyEggShowCtr:GetData() return self.data end function UILuckyEggShowCtr:OnDispose() self.data = nil self.view = nil self.curShowIdx = nil self.showDatas = nil end function UILuckyEggShowCtr:InitData() self.curShowIdx = 1 local LuckyEggData = ManagerContainer.DataMgr.LuckyEggDataMgr:GetLuckyEggData() local showDatas = {} if LuckyEggData then local LuckyEggCfgData = ManagerContainer.CfgMgr:GetLuckyEggCfgByType(LuckyEggData.luckyType) if LuckyEggCfgData and LuckyEggCfgData.ShowItemType and #LuckyEggCfgData.ShowItemType > 0 then if LuckyEggData.rewards then for i = 1, #LuckyEggData.rewards do local reward = LuckyEggData.rewards[i] if reward then local itemCfgData = ManagerContainer.CfgMgr:GetItemById(reward.cfgId) if CommonUtil.EleInTable(itemCfgData.ResType, LuckyEggCfgData.ShowItemType) then showDatas[#showDatas + 1] = reward end end end end end end if #showDatas <= 0 then self.showDatas = { { cfgId = 1, num = 0 } } else self.showDatas = showDatas end end function UILuckyEggShowCtr:GetShowData() return self.showDatas[self.curShowIdx] end function UILuckyEggShowCtr:ChangeNextData() self.curShowIdx = self.curShowIdx + 1 end function UILuckyEggShowCtr:CheckMustShow() for i = self.curShowIdx + 1, #self.showDatas do local showData = self.showDatas[i] if showData then local itemCfgData = ManagerContainer.CfgMgr:GetItemById(showData.cfgId) if itemCfgData and itemCfgData.Quality >= 4 then self.curShowIdx = i return true end end end return false end function UILuckyEggShowCtr:GetCurMustShowComplete() local showData = self:GetShowData() if showData then local itemCfgData = ManagerContainer.CfgMgr:GetItemById(showData.cfgId) if itemCfgData and itemCfgData.Quality >= 4 then return true end end return false end return UILuckyEggShowCtr