local UISuperGoldBossRankReward = UIViewClass() function UISuperGoldBossRankReward:OnOpened(context) self.activityId = context.activityId self.groupId = context.groupId self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) self.UICommonPopUpTab.loop_Tab:AddData({Title = Const_IDS.IDS_SuperGoldHeroActivity_HeroTrial_RankHint15}, 0) self.UICommonPopUpTab.loop_Tab:AddData({Title = Const_IDS.IDS_SuperGoldHeroActivity_HeroTrial_RankHint16}, 0) self.UICommonPopUpTab.loop_Tab:SelectIndex(0) end function UISuperGoldBossRankReward:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:CloseView() end end end function UISuperGoldBossRankReward:OnButtonClicked(comp) if comp == self.UICommonPopUpTab.btn_Close then self:CloseView() else for i, v in ipairs(self.group_RankRewardSelf.Content) do if comp == v.Item.event_Click then UTL.ItemTips.ShowCommonTipsById(self.selfRewardData[i].Item) break end end end end function UISuperGoldBossRankReward:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUpTab.btn_Close) end function UISuperGoldBossRankReward:RefreshMaxDamageCell(index, cellTable, data) cellTable.state_Bg:SetState(index % 2) 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 cellTable.txt_Rank.text = self:FormatRankStr(data.Rank1, data.Rank2) --能获得的奖励是否处于当前排名中 local currentIndex = MDL.SuperGoldBoss.GetCurrentIndexOfRewardRank(self.activityId, self.rankName) if currentIndex < 0 then UIUtils.SetActive(cellTable.img_Current, false) else UIUtils.SetActive(cellTable.img_Current, index + 1 == currentIndex) end end function UISuperGoldBossRankReward:RefreshTotalPointCell(index, cellTable, data) local itemData = data.Reward_Table for i, v in ipairs(cellTable.group_Reward) do local reward = itemData[i] if reward then UIUtils.SetActive(v.gameObject.transform.parent, true) UTL.Item.SetItemCell(v, reward.Item, reward.ItemNum) else UIUtils.SetActive(v.gameObject.transform.parent, false) end end UIUtils.SetLabelText(cellTable.txt_RankName, Const_IDS[data.RankName]) --能获得的奖励是否处于当前排名中 local currentIndex = MDL.SuperGoldBoss.GetCurrentIndexOfRewardRank(self.activityId, self.rankName) if currentIndex < 0 then UIUtils.SetActive(cellTable.img_Current, false) else UIUtils.SetActive(cellTable.img_Current, index + 1 == currentIndex) end local limitTimes = data.LimitNum or 0 UIUtils.SetActive(cellTable.group_Times, limitTimes and limitTimes > 0) if limitTimes and limitTimes > 0 then cellTable.txt_Times.text = limitTimes end cellTable.txt_Conditions.text = data.Rank2 end function UISuperGoldBossRankReward:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.UICommonPopUpTab.loop_Tab then UIUtils.SetLabelText(cellTable.txt_Name_Nomal, data.Title) UIUtils.SetLabelText(cellTable.txt_Name_Selected, data.Title) UIUtils.SetActive(cellTable.img_ArrowS, false) UIUtils.SetActive(cellTable.img_Arrow, false) elseif scrollRect == self.loop_RankReward then if data.isTotal then self:RefreshTotalPointCell(index, cellTable, data.data) else self:RefreshMaxDamageCell(index, cellTable, data.data) end end end function UISuperGoldBossRankReward:OnCellSelect(scrollRect, index, cellTable, data) if scrollRect == self.UICommonPopUpTab.loop_Tab then if self.loop_RankReward.Count > 0 then self.loop_RankReward:ClearCells() end if index == 0 then self.rankName = MDL.SuperGoldBoss.BossRankName.TotalScoreRank for i, v in DataSheetManager.SuperGoldBossTotalRank[self.groupId]:GetEnumerator() do self.loop_RankReward:AddData({isTotal = true, data = v}, 0) end elseif index == 1 then self.rankName = MDL.SuperGoldBoss.BossRankName.MaxDamageRank for i, v in DataSheetManager.SuperGoldBossDamageRank[self.groupId]:GetEnumerator() do self.loop_RankReward:AddData({isTotal = false, data = v}, 1) end end self.state_RankTitle:SetState(index) UIUtils.SetLabelText(self.UICommonPopUpTab.txt_Title, Const_IDS.IDS_GoldHeroActivity_SynergyBoss_RankReward_Hint1) end end function UISuperGoldBossRankReward:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.loop_RankReward then if data.isTotal then for i, v in ipairs(cellTable.group_Reward) do if v.event_Click == target then UTL.ItemTips.ShowCommonTipsById(data.data.Reward_Table[i].Item) break end end else for i, v in ipairs(cellTable.Content) do if v.Item.event_Click == target then UTL.ItemTips.ShowCommonTipsById(data.data.Reward_Table[i].Item) break end end end end end local StringFormat = string.FormatByIdsId function UISuperGoldBossRankReward:FormatRankStr(rank1, rank2) if (not rank2) or (rank1 == rank2) then return StringFormat(Const_IDS.IDS_BossChallenge_Reward_RankRange_OneNum, rank1) else return StringFormat(Const_IDS.IDS_BossChallenge_Reward_RankRange_TwoNum, rank1, rank2) end end return UISuperGoldBossRankReward