--- 结算界面放大镜我的伤害榜界面 local UICountryNightBossDamageRank = UIViewClass() function UICountryNightBossDamageRank:OnOpened(context) self.bossData = DataSheetManager.CountryNightBoss:GetDataByID(context.bossID) self.myRankData = context.myRankData self.sortConfig = { [CTL.CountryNightBoss.SortFieldEnum.Damage] = 0, [CTL.CountryNightBoss.SortFieldEnum.Kill] = 0, [CTL.CountryNightBoss.SortFieldEnum.Help] = 0, [CTL.CountryNightBoss.SortFieldEnum.Death] = 0, } -- 拷贝一份排名 self.playerRankList = {} for _, v in ipairs(context.playerRankToBoss) do table.insert(self.playerRankList, v) end self:RefreshInfo() end function UICountryNightBossDamageRank:ResetSortOptionUI() -- 功能保留,需求删除排序,所以删除入口 self.state_ArrowDamage:SetState(2) self.state_ArrowKill:SetState(2) self.state_ArrowSupport:SetState(2) self.state_ArrowDead:SetState(2) end function UICountryNightBossDamageRank:RefreshInfo() UIUtils.SetLabel(self.UICommonPopUp.txt_Title, string.FormatByIdsId(Const_IDS["IDS_CountryNightBoss_DamageRank"], UIUtils.GetLocalizedTxt(Const_IDS[self.bossData.WordBossName]))) UIUtils.SetActive(self.group_Empty, #self.playerRankList <= 0) self.loop_DamageRank:ReloadAll(self.playerRankList) -- 设置我的信息 UIUtils.SetActive(self.mine_DamageRank.gameObject, self.myRankData ~= nil) self:SetCellInfo(self.mine_DamageRank, self.myRankData) end function UICountryNightBossDamageRank:SortByField(targetField) local configVal = self.sortConfig[targetField] if configVal == 0 then self.sortConfig[targetField] = 1 else self.sortConfig[targetField] = 0 end local sortedList = CTL.CountryNightBoss.SortDataBySortConfigAndField(self.playerRankList, self.sortConfig[targetField], targetField) self.loop_DamageRank:ReloadAll(sortedList) end function UICountryNightBossDamageRank:OnCellInit(scrollRect, index, cellTable, data) UIUtils.SetActive(cellTable.sprite_Bg1, index % 2 ~= 1) self:SetCellInfo(cellTable, data, index) end function UICountryNightBossDamageRank:SetCellInfo(collection, cellInfo) if cellInfo and cellInfo.index > 0 then UIUtils.SetActive(collection.img_Country.gameObject, true) else UIUtils.SetActive(collection.img_Country.gameObject, false) return end if cellInfo.index > 3 then collection.UIState:SetState(3) UIUtils.SetLabel(collection.txt_Rank, cellInfo.index) else collection.UIState:SetState(cellInfo.index - 1) end CTL.Country.SetCountryInRank(collection.img_Country, collection.txt_Country, cellInfo.countryId) UIUtils.SetLabel(collection.lab_HeroName, cellInfo.playerName) UIUtils.SetLabel(collection.txt_Guild, cellInfo.GuildName) UIUtils.SetLabel(collection.txt_Server, CTL.CrossServer.GetServerShowStr(cellInfo.serverId) or "-") UIUtils.SetLabel(collection.txt_Damage, UTL.String.GetCountStr(cellInfo.damage)) UIUtils.SetLabel(collection.txt_Kill, cellInfo.kill) UIUtils.SetLabel(collection.txt_Support, cellInfo.help) UIUtils.SetLabel(collection.txt_Dead, cellInfo.death) end function UICountryNightBossDamageRank:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UICountryNightBossDamageRank:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() elseif comp == self.btn_Damage then self:SortByField(CTL.CountryNightBoss.SortFieldEnum.Damage) self.state_ArrowDamage:SetState(self.sortConfig[CTL.CountryNightBoss.SortFieldEnum.Damage]) elseif comp == self.btn_Kill then self:SortByField(CTL.CountryNightBoss.SortFieldEnum.Kill) self.state_ArrowKill:SetState(self.sortConfig[CTL.CountryNightBoss.SortFieldEnum.Kill]) elseif comp == self.btn_Support then self.state_ArrowSupport:SetState(self.sortConfig[CTL.CountryNightBoss.SortFieldEnum.Help]) self:SortByField(CTL.CountryNightBoss.SortFieldEnum.Help) elseif comp == self.btn_Dead then self:SortByField(CTL.CountryNightBoss.SortFieldEnum.Death) self.state_ArrowDead:SetState(self.sortConfig[CTL.CountryNightBoss.SortFieldEnum.Death]) end end return UICountryNightBossDamageRank