local UIGoldenHeroBossRank = UIViewClass() local NoGuildText = UIUtils.GetLocalizedTxt(Const_IDS.IDS_TeamUI_ActiveInvitation_NoGuild) function UIGoldenHeroBossRank:OnOpened(context) self.heroType = context.heroType self.activityId = context.activityId self.activityType = MDL.OperationActivity.ActivityType.GoldenHero self:RegistSystemEvent(EventID.UI_GoldenHeroBoss_RefreshRankData, self.RefreshBossRank) self:RegistSystemEvent(EventID.UI_OperationActivity_InfoChanged, self.CheckYesterdayRankBtn) self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) self:CheckYesterdayRankBtn() UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_GoldHeroActivity_SynergyBoss_Button1) local timeId = DataSheetManager.GoldHeroActivityModeData:GetDataByHeroType(self.heroType).DailyRankEndTime self.group_TotalPoint.txt_TimeTips.text = string.FormatByIdsKey("IDS_SuperGoldHeroActivity_NewHint_2", UTL.Time.GetDiffLocalStrById(timeId)) MDL.GoldenHeroBoss.GoldHeroGetRankRecordReq(self.activityId, MDL.GoldenHeroBoss.BossRankType.SynergyBossTotalRank) end function UIGoldenHeroBossRank:CheckYesterdayRankBtn() local startTime = MDL.OperationActivity.GetOperationActivityInfo(self.activityType, self.activityId).startTime UIUtils.SetActive(self.group_TotalPoint.group_YesterdayRank, UTL.Time.GetServerTimestamp() - startTime >= UTL.Time.TotalSecondsOneDay) end function UIGoldenHeroBossRank:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:CloseView() end end end function UIGoldenHeroBossRank:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIGoldenHeroBossRank:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() elseif comp == self.btn_SingleDamage then MDL.GoldenHeroBoss.GoldHeroGetRankRecordReq(self.activityId, MDL.GoldenHeroBoss.BossRankType.SynergyBossMaxDamageRank) elseif comp == self.btn_TotalPoints then MDL.GoldenHeroBoss.GoldHeroGetRankRecordReq(self.activityId, MDL.GoldenHeroBoss.BossRankType.SynergyBossTotalRank) elseif comp == self.group_TotalPoint.btn_YesterdayRank then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGoldenHeroBossYesterdayRank, {activityId = self.activityId, heroType = self.heroType}, "GoldenHero/GoldenHeroBoss/UIGoldenHeroBossRank") else for i, v in ipairs(self.group_TotalPoint.group_TotalPointSelf.group_Reward) do if comp == v.event_Click then local rewardLevel, isScoreEnough = MDL.GoldenHeroBoss.GetCurrentIndexOfRewardRank(self.activityId, MDL.GoldenHeroBoss.BossRankType.SynergyBossTotalRank) local rewardData = DataSheetManager.GoldHeroSynergyBossTotalRank[self.heroType]:GetDataByRankID(rewardLevel) UTL.ItemTips.ShowCommonTipsById(rewardData.Reward_Table[i].Item) end end end end function UIGoldenHeroBossRank:RefreshBossRank(rankType) self.rankType = rankType UIUtils.SetActive(self.img_TotalPointsSelected, rankType == MDL.GoldenHeroBoss.BossRankType.SynergyBossTotalRank) UIUtils.SetActive(self.img_SingleDamageSelected, rankType == MDL.GoldenHeroBoss.BossRankType.SynergyBossMaxDamageRank) UIUtils.SetActive(self.group_TotalPoint.gameObject, rankType == MDL.GoldenHeroBoss.BossRankType.SynergyBossTotalRank) UIUtils.SetActive(self.group_SingleDamage.gameObject, rankType == MDL.GoldenHeroBoss.BossRankType.SynergyBossMaxDamageRank) local loop = rankType == MDL.GoldenHeroBoss.BossRankType.SynergyBossTotalRank and self.group_TotalPoint.loop_TotalPointRank or self.group_SingleDamage.loop_SingleDamageRank if loop.Count > 0 then loop:ClearCells() end for i, v in ipairs(MDL.GoldenHeroBoss.GetBossRankList(self.activityId, rankType)) do loop:AddData(v, 0) end local cell = rankType == MDL.GoldenHeroBoss.BossRankType.SynergyBossTotalRank and self.group_TotalPoint.group_TotalPointSelf or self.group_SingleDamage.group_SingleDamageSelf self:SetRankSingleCell(cell, nil, rankType, true) UIUtils.SetActive(self.group_Empty, loop.Count == 0) end function UIGoldenHeroBossRank:SetRankSingleCell(cell, data, rankType, isMySelf) -- JWS-30161 去掉累计积分排名 local rank = isMySelf and MDL.GoldenHeroBoss.GetMyBossRank(self.activityId, rankType) or data.index if rankType == MDL.GoldenHeroBoss.BossRankType.SynergyBossMaxDamageRank then UIUtils.SetActive(cell.bg_Rank, rank <= 3 and rank > 0) UIUtils.SetActive(cell.txt_Rank, rank > 3 or rank == 0) if rank == 0 then UIUtils.SetLabelText(cell.txt_Rank, Const_IDS.IDS_Rank_Unranked) else if rank <= 3 then cell.bg_Rank:SetState(rank - 1) else cell.txt_Rank.text = rank end end elseif rankType == MDL.GoldenHeroBoss.BossRankType.SynergyBossTotalRank then cell.txt_Rank.text = rank end if isMySelf then if rankType == MDL.GoldenHeroBoss.BossRankType.SynergyBossTotalRank then cell.txt_TotalPoints.text = MDL.GoldenHeroBoss.GetTodayScore(self.activityId) or 0 cell.txt_Num.text = MDL.GoldenHeroBoss.GetParticipateTimes(self.activityId) or 0 local rewardLevel, isScoreEnough = MDL.GoldenHeroBoss.GetCurrentIndexOfRewardRank(self.activityId, MDL.GoldenHeroBoss.BossRankType.SynergyBossTotalRank) local rewardData if rewardLevel > 0 then rewardData = DataSheetManager.GoldHeroSynergyBossTotalRank[self.heroType]:GetDataByRankID(rewardLevel) end cell.state_RankSelf:SetState(rewardData and 1 or 0) if rewardData then 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 UIUtils.SetActive(cell.group_Reward.gameObject, false) UIUtils.SetLabelText(cell.txt_RankName, Const_IDS.IDS_SuperGoldHeroActivity_NewHint_10) end elseif rankType == MDL.GoldenHeroBoss.BossRankType.SynergyBossMaxDamageRank then cell.txt_Name.text = BattleDataGetter.GetPlayerName() cell.txt_Guild.text = MDL.Guild.IsHasGuild() and MDL.Guild.GetMyGuildInfo().guildName or NoGuildText local maxDamage, bossConfigId = MDL.GoldenHeroBoss.GetMaxDamageWithBoss(self.activityId) cell.txt_MaxDamage.text = maxDamage or 0 local bossData if bossConfigId then bossData = DataSheetManager.GoldHeroSynergyBossData[self.heroType]:GetDataByID(bossConfigId) end if bossData then UIUtils.SetLabelText(cell.txt_BossTarget, Const_IDS[bossData.BossName]) CTL.GoldenHeroBoss.ShowBossStar(cell.group_Star, bossData.BossStar) else cell.txt_BossTarget.text = "---" CTL.GoldenHeroBoss.ShowBossStar(cell.group_Star, 0) end end else cell.txt_Name.text = data.name if rankType == MDL.GoldenHeroBoss.BossRankType.SynergyBossTotalRank then cell.txt_TotalPoints.text = data.showParam cell.txt_Num.text = data.times elseif rankType == MDL.GoldenHeroBoss.BossRankType.SynergyBossMaxDamageRank then cell.txt_Guild.text = string.isNilOrEmpty(data.guildName) and NoGuildText or data.guildName local bossData = DataSheetManager.GoldHeroSynergyBossData[self.heroType]:GetDataByID(data.bossCfgId) UIUtils.SetLabelText(cell.txt_BossTarget, Const_IDS[bossData.BossName]) cell.txt_MaxDamage.text = data.showParam CTL.GoldenHeroBoss.ShowBossStar(cell.group_Star, bossData.BossStar) end end end function UIGoldenHeroBossRank:OnCellInit(scrollRect, index, cellTable, data) cellTable.state_Bg:SetState(index % 2) if scrollRect == self.group_TotalPoint.loop_TotalPointRank then self:SetRankSingleCell(cellTable, data, MDL.GoldenHeroBoss.BossRankType.SynergyBossTotalRank) elseif scrollRect == self.group_SingleDamage.loop_SingleDamageRank then self:SetRankSingleCell(cellTable, data, MDL.GoldenHeroBoss.BossRankType.SynergyBossMaxDamageRank) end end function UIGoldenHeroBossRank:OnCellClicked(scrollRect, index, cellTable, target, data) --需要弹出交互界面 end return UIGoldenHeroBossRank