local UISuperGoldBossTimesReward = UIViewClass() function UISuperGoldBossTimesReward:OnOpened(context) self.activityId = context.activityId self.groupId = context.groupId self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) self:RegistSystemEvent(EventID.UI_SuperGoldBoss_InfoRefresh, self.RefreshList) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_SuperGoldHeroActivity_HeroTrial_ChildTitle3) self.times = MDL.SuperGoldBoss.GetParticipateTimes(self.activityId) for i, v in DataSheetManager.SuperGoldBossDailyReward:GetDataByDailyRewardGroup_ID(self.groupId) do if not CTL.SuperGoldBoss.IsTimeRewardClaimed(self.activityId, v.ID) then self.loop_TimesReward:AddData(v, 0) end end for i, v in DataSheetManager.SuperGoldBossDailyReward:GetDataByDailyRewardGroup_ID(self.groupId) do if CTL.SuperGoldBoss.IsTimeRewardClaimed(self.activityId, v.ID) then self.loop_TimesReward:AddData(v, 0) end end end function UISuperGoldBossTimesReward:RefreshList() self.loop_TimesReward:RefreshCells() end function UISuperGoldBossTimesReward:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:CloseView() end end end function UISuperGoldBossTimesReward:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() end end function UISuperGoldBossTimesReward:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UISuperGoldBossTimesReward:OnCellInit(scrollRect, index, cellTable, data) cellTable.state_Bg:SetState(index % 2) local num = data.Number if self.times >= num then cellTable.txt_Times.text = num .. "/" .. num else cellTable.txt_Times.text = UTL.Color.FormatRedColor(self.times) .. "/" .. num end local itemData = data.Reward_Table for i, v in ipairs(itemData) do local contentItem = cellTable.Content[i] if not contentItem then contentItem = self:InstantiateCellCollection(cellTable.cell.gameObject, cellTable.Content, self.RewardItem.gameObject) end UTL.Item.SetItemCell(contentItem.Item, v.Item, v.ItemNum) UIUtils.SetActive(contentItem.gameObject, true) end for i = #cellTable.Content, #itemData + 1, -1 do self:DestroyCollection(cellTable.Content, i) end --根据奖励状态 if CTL.SuperGoldBoss.IsTimeRewardClaimed(self.activityId, data.ID) then cellTable.state_Reward:SetState(2) else cellTable.state_Reward:SetState(self.times >= num and 1 or 0) end cellTable.btn_Get:SetRedPoint(true) end function UISuperGoldBossTimesReward:OnCellClicked(scrollRect, index, cellTable, target, data) if target == cellTable.btn_Get then MDL.SuperGoldBoss.SuperGoldTrialTimeRewardReq(self.activityId, data.ID) else for i, v in ipairs(cellTable.Content) do if target == v.Item.event_Click then UTL.ItemTips.ShowCommonTipsById(data.Reward_Table[i].Item) break end end end end return UISuperGoldBossTimesReward