local UIDragonArterySummaryInfoPanel = UIViewClass() local INTERVAL_UPDATE_POINT = 2 --查询积分的时间间隔 local function SortRule(playerId_1, playerId_2) local totalScore_1 = BattleDataGetter.GetDragonArteryPlayerScore(playerId_1) local totalScore_2 = BattleDataGetter.GetDragonArteryPlayerScore(playerId_2) return totalScore_1 > totalScore_2 end function UIDragonArterySummaryInfoPanel:OnOpened(context) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_DragonArtey_ScoreDetails) self:RegistSystemEvent(EventID.UI_DragonArtery_RefreshKingdomRankIndex, self.UpdateRankIndex) local kingdom if context.info then UIUtils.SetActive(self.obj_Content, true) UIUtils.SetActive(self.obj_Empty, false) self.dataSourceFromServer = true kingdom = context.info.countryId self:SetCountryScore(context.info.KillPlayer, context.info.holdTotem, context.info.killBoss, context.info.skill, context.info.totalScore) UIUtils.SetActive(self.group_MyRank, false) local myAcid = BattleDataGetter.GetAcID() for i, v in ipairs(context.info.players) do if v.playerAcid == myAcid then UIUtils.SetActive(self.group_MyRank, true) self:SetPlayerInfo(self.group_MyDACountryRank, i, v.playerName, v.emblemFrame, v.emblemContent, v.killPlayer, v.assist, v.holdTotem, v.killBoss, v.skill, v.totalScore) end self.loop_DACountryRank:AddData(v, 0) end else self.dataSourceFromServer = false kingdom = BattleDataGetter.GetDragonArteryMyKingdom() self.myKingdom = kingdom self.myKingdomPlayerIdList = {} UIUtils.SetActive(self.group_MyRank, true) self:StartRepeatFunc(self.UpdateCountryPoints, INTERVAL_UPDATE_POINT, 0) self:UpdateCountryPoints() end self:UpdateRankIndex(context.rankIndex) local countryData = DataSheetManager.CountryBase:GetDataByID(kingdom) UIUtils.SetImageByAssetBundle(self.img_CountryBg, countryData.LogoPath) UIUtils.SetLocalizationImage(self.img_Country, countryData.NamePath) end function UIDragonArterySummaryInfoPanel:UpdateCountryPoints() local kingdom = self.myKingdom BattleDataGetter.UpdateDragonArteryKingdomPlayerList(kingdom, self.myKingdomPlayerIdList) if #self.myKingdomPlayerIdList > 0 then UIUtils.SetActive(self.obj_Content, true) UIUtils.SetActive(self.obj_Empty, false) table.sort(self.myKingdomPlayerIdList, SortRule) self.loop_DACountryRank:ReloadAll(self.myKingdomPlayerIdList) local killScore = BattleDataGetter.GetDragonArteryKingdomKillScore(kingdom) local carryScore = BattleDataGetter.GetDragonArteryKingdomCarryScore(kingdom) local bossKillScore = BattleDataGetter.GetDragonArteryKingdomBossKillScore(kingdom) local godPropScore = BattleDataGetter.GetDragonArteryKingdomGodPropScore(kingdom) local totalScore = BattleDataGetter.GetDragonArteryKingdomScore(kingdom) self:SetCountryScore(killScore, carryScore, bossKillScore, godPropScore, totalScore) else UIUtils.SetActive(self.obj_Content, false) UIUtils.SetActive(self.obj_Empty, true) end end function UIDragonArterySummaryInfoPanel:UpdateRankIndex(rankIndex) self.lab_Rank.text = string.FormatByIdsId(Const_IDS.IDS_DragonArtey_RankTitle2, rankIndex) self.state_Rank:SetState(rankIndex - 1) end function UIDragonArterySummaryInfoPanel:OnCellInit(scrollRect, index, cellTable, data) if self.dataSourceFromServer then self:SetPlayerInfo(cellTable, index + 1, data.playerName, data.emblemFrame, data.emblemContent, data.killPlayer, data.assist, data.holdTotem, data.killBoss, data.skill, data.score) else --data是playerId local playerName = BattleDataGetter.GetPlayerNameByPlayerID(data) local _, emblemFrame, emblemContent = BattleDataGetter.GetGuildParam(data) local killScore = BattleDataGetter.GetKillHeroScore(data) local assistScore = BattleDataGetter.GetAssistHeroKillScore(data) local carryScore = BattleDataGetter.GetDragonArteryPlayerCarryScore(data) local bossKillScore = BattleDataGetter.GetDragonArteryBossKillScore(data) local godPropScore = BattleDataGetter.GetGodPropScore(data) local totalScore = BattleDataGetter.GetDragonArteryPlayerScore(data) self:SetPlayerInfo(cellTable, index + 1, playerName, emblemFrame, emblemContent, killScore, assistScore, carryScore, bossKillScore, godPropScore, totalScore) if data == BattleDataGetter.GetCurPlayerID() then self:SetPlayerInfo(self.group_MyDACountryRank, index + 1, playerName, emblemFrame, emblemContent, killScore, assistScore, carryScore, bossKillScore, godPropScore, totalScore) end end end function UIDragonArterySummaryInfoPanel:SetPlayerInfo(comp, index, playerName, emblemFrame, emblemContent, killScore, assistScore, carryScore, bossKillScore, godPropScore, totalScore) if comp.img_Bg then UIUtils.SetActive(comp.img_Bg, (index + 1) % 2 == 0) end if index <= 3 then comp.UIState:SetState(index - 1) else comp.UIState:SetState(3) end comp.txt_Rank.text = index comp.txt_Name.text = playerName CTL.Guild.SetGuildEmblem(comp.img_GuildIcon, comp.txt_Guild, emblemFrame, emblemContent) comp.txt_killScore.text = killScore .. "/" .. assistScore comp.txt_carryScore.text = carryScore comp.txt_bossKillScore.text = bossKillScore comp.txt_godPropScore.text = godPropScore comp.txt_totalScore.text = totalScore end function UIDragonArterySummaryInfoPanel:SetCountryScore(killScore, carryScore, bossKillScore, godPropScore, totalScore) self.txt_killScore.text = killScore self.txt_carryScore.text = carryScore self.txt_bossKillScore.text = bossKillScore self.txt_godPropScore.text = godPropScore self.txt_totalScore.text = totalScore end function UIDragonArterySummaryInfoPanel:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIDragonArterySummaryInfoPanel:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() end end return UIDragonArterySummaryInfoPanel