local UIGoldenHeroBossYesterdayRank = UIViewClass() local NoGuildText = UIUtils.GetLocalizedTxt(Const_IDS.IDS_TeamUI_ActiveInvitation_NoGuild) function UIGoldenHeroBossYesterdayRank:OnOpened(context) self.heroType = context.heroType self.activityId = context.activityId self:RegistSystemEvent(EventID.UI_GoldenHeroBoss_RefreshRankData, self.RefreshBossRank) self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_GoldHeroActivity_SynergyBoss_NewHint4) UIUtils.SetLabelText(self.group_TotalPoint.txt_TimeTips, Const_IDS.IDS_GoldHeroActivity_SynergyBoss_NewHint5) UIUtils.SetActive(self.img_TotalPointsSelected, true) UIUtils.SetActive(self.img_SingleDamageSelected, false) UIUtils.SetActive(self.group_TotalPoint.gameObject, true) UIUtils.SetActive(self.group_SingleDamage.gameObject, false) UIUtils.SetActive(self.btn_SingleDamage, false) UIUtils.SetActive(self.group_TotalPoint.group_YesterdayRank, false) MDL.GoldenHeroBoss.GoldHeroGetRankRecordReq(self.activityId, MDL.GoldenHeroBoss.BossRankType.SynergyBossTotalRank, true) end function UIGoldenHeroBossYesterdayRank:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:CloseView() end end end function UIGoldenHeroBossYesterdayRank:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIGoldenHeroBossYesterdayRank:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() end end function UIGoldenHeroBossYesterdayRank:RefreshBossRank() local loop = self.group_TotalPoint.loop_TotalPointRank if loop.Count > 0 then loop:ClearCells() end for i, v in ipairs(MDL.GoldenHeroBoss.GetYesterdayRankList(self.activityId)) do loop:AddData(v, 0) end self:SetRankSingleCell(self.group_TotalPoint.group_TotalPointSelf, nil, true) UIUtils.SetActive(self.group_Empty, loop.Count == 0) end function UIGoldenHeroBossYesterdayRank:SetRankSingleCell(cell, data, isMySelf) if isMySelf then local rank = MDL.GoldenHeroBoss.GetYesterdayMyRank(self.activityId) or 0 local score = MDL.GoldenHeroBoss.GetYesterdayMyScore(self.activityId) or 0 local times = MDL.GoldenHeroBoss.GetYesterdayMyTimes(self.activityId) or 0 cell.txt_TotalPoints.text = score cell.txt_Num.text = times cell.txt_Rank.text = rank local rewardLevel, isScoreEnough = MDL.GoldenHeroBoss.CalculateRewardRank(rank, DataSheetManager.GoldHeroSynergyBossTotalRank[self.heroType], score, times) local hasReward = rewardLevel ~= 0 if hasReward then local rewardData = DataSheetManager.GoldHeroSynergyBossTotalRank[self.heroType]:GetDataByRankID(rewardLevel) cell.state_RankSelf:SetState(1) UIUtils.SetLabelText(cell.txt_RankName, Const_IDS[rewardData.RankName]) UIUtils.SetActive(cell.group_Reward.gameObject, true) local rewardTable = rewardData.Reward_Table for i, v in ipairs(cell.group_Reward) do local reward = rewardTable[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 else cell.state_RankSelf:SetState(0) UIUtils.SetActive(cell.group_Reward.gameObject, false) UIUtils.SetLabelText(cell.txt_RankName, Const_IDS.IDS_SuperGoldHeroActivity_NewHint_10) end else cell.txt_Name.text = data.name cell.txt_TotalPoints.text = data.showParam cell.txt_Num.text = data.times cell.txt_Rank.text = data.index end end function UIGoldenHeroBossYesterdayRank:OnCellInit(scrollRect, index, cellTable, data) cellTable.state_Bg:SetState(index % 2) if scrollRect == self.group_TotalPoint.loop_TotalPointRank then self:SetRankSingleCell(cellTable, data) end end return UIGoldenHeroBossYesterdayRank