local UIChangAnSiegeSummaryPanel = UIViewClass() local siegeCityTipsShutdownTime = DataSheetManager.ConstData:GetDataByID("SiegeCityTipsShutdownTime").IntValue function UIChangAnSiegeSummaryPanel:OnOpened(context) self.isDefendCountry = CTL.ChangAnSiege.IsDefendCamp() if self.isDefendCountry then self.teammateInfo = context.defend self.enemyInfo = context.attack self.teammateExtraInfo = context.defendExtra self.enemyExtraInfo = context.attackExtra self.isWin = context.isDefenderWin else self.teammateInfo = context.attack self.enemyInfo = context.defend self.teammateExtraInfo = context.attackExtra self.enemyExtraInfo = context.defendExtra self.isWin = not context.isDefenderWin end self.isSecondBattlefield = BattleDataGetter.IsCityWarSideLevel() CTL.LevelSelect.ShowCommonSummaryTemplate(self, self.isWin) if self.isWin then CTL.Sound.PlayGameSound("MUSIC_Victory") else CTL.Sound.PlayGameSound("MUSIC_Fail") end self:StartRepeatFunc(self.OnUpdateTimeFun, 1, 0) UIUtils.SetActive(self.group_Main, not self.isSecondBattlefield) UIUtils.SetActive(self.group_Sub, self.isSecondBattlefield) if not self.isSecondBattlefield then self:RefreshMainSummary() else self:RefreshSubSummary() end self:RefreshSummaryReward() end function UIChangAnSiegeSummaryPanel:OnUpdateTimeFun(deltaTime, timeSinceUpdate) local time = math.ceil(siegeCityTipsShutdownTime - timeSinceUpdate) UIUtils.SetLabel(self.group_Remind, string.FormatByIdsId(Const_IDS.IDS_AutoExit, time <= 0 and 0 or time)) if time <= 0 then self:OnButtonClicked(self.event_Exit) return end end function UIChangAnSiegeSummaryPanel:RefreshMainSummary() if self.teammateInfo then for _,v in ipairs(self.teammateInfo) do self.group_Main_Teammate.loop_CASSummaryPlayerInfo:AddData(v, 0) end end if self.enemyInfo then for _,v in ipairs(self.enemyInfo) do self.group_Main_Enemy.loop_CASSummaryEnemyInfo:AddData(v, 0) end end UIUtils.SetLabel(self.group_Main_Teammate.txt_MonarchName, self.teammateExtraInfo.leader) UIUtils.SetLabel(self.group_Main_Teammate.txt_ReignTitle, MDL.Country.GetCountryTitle(self.teammateExtraInfo.name, self.teammateExtraInfo.country)) if self.isDefendCountry then UIUtils.SetLabelText(self.group_Main_Teammate.lab_Contribution, Const_IDS.IDS_SiegeCity_InMBF_DataDetail_8) UIUtils.SetLabelText(self.group_Main_Enemy.lab_Contribution, Const_IDS.IDS_SiegeCity_InMBF_DataDetail_7) else UIUtils.SetLabelText(self.group_Main_Teammate.lab_Contribution, Const_IDS.IDS_SiegeCity_InMBF_DataDetail_7) UIUtils.SetLabelText(self.group_Main_Enemy.lab_Contribution, Const_IDS.IDS_SiegeCity_InMBF_DataDetail_8) end UIUtils.SetLabel(self.group_Main_Enemy.txt_MonarchName, self.enemyExtraInfo.leader) UIUtils.SetLabel(self.group_Main_Enemy.txt_ReignTitle, MDL.Country.GetCountryTitle(self.enemyExtraInfo.name, self.enemyExtraInfo.country)) local teammateCountryData = DataSheetManager.CountryBase:GetDataByID(self.teammateExtraInfo.country) UIUtils.SetImageByAssetBundle(self.group_Main_Teammate.img_Country, teammateCountryData.LogoPath) UIUtils.SetImageByAssetBundle(self.group_Main_Teammate.img_CountryBg, teammateCountryData.CountryBGPath) UIUtils.SetLocalizationImage(self.group_Main_Teammate.img_CountryName, teammateCountryData.NamePath) local enemyCountryData = DataSheetManager.CountryBase:GetDataByID(self.enemyExtraInfo.country) UIUtils.SetImageByAssetBundle(self.group_Main_Enemy.img_Country, enemyCountryData.LogoPath) UIUtils.SetImageByAssetBundle(self.group_Main_Enemy.img_CountryBg, enemyCountryData.CountryBGPath) UIUtils.SetLocalizationImage(self.group_Main_Enemy.img_CountryName, enemyCountryData.NamePath) UIUtils.SetActive(self.lab_Tips, false) end function UIChangAnSiegeSummaryPanel:RefreshSubSummary() if self.isDefendCountry then self.state_OffensiveAndDefensive:SetState(0) for _,v in ipairs(self.teammateInfo) do self.group_Sub_Defender.loop_CASSummaryDefender:AddData(v, 0) end for _,v in ipairs(self.enemyInfo) do self.group_Sub_Offender.loop_CASSummaryOffender:AddData(v, 0) end else self.state_OffensiveAndDefensive:SetState(1) for _,v in ipairs(self.teammateInfo) do self.group_Sub_Offender.loop_CASSummaryOffender:AddData(v, 0) end for _,v in ipairs(self.enemyInfo) do self.group_Sub_Defender.loop_CASSummaryDefender:AddData(v, 0) end end end function UIChangAnSiegeSummaryPanel:RefreshSummaryReward() if self.isWin then local victoryRewardCfgId = DataSheetManager.ConstData:GetDataByID("SiegeCityVictoryReward").IntValue local victoryRewardList = DataSheetManager.SiegeCityRewardRepeat:GetDataByID(victoryRewardCfgId).Item_Table for _,v in ipairs(victoryRewardList) do self.loop_Reward:AddData(v, 0) end else local failCfgId = DataSheetManager.ConstData:GetDataByID("SiegeCityfailReward").IntValue local failRewardList = DataSheetManager.SiegeCityRewardRepeat:GetDataByID(failCfgId).Item_Table for _,v in ipairs(failRewardList) do self.loop_Reward:AddData(v, 0) end end end function UIChangAnSiegeSummaryPanel:OnButtonClicked(comp) if comp == self.event_Exit then MDL.Level.SendRoleLeaveFuben() --退出副本 end end function UIChangAnSiegeSummaryPanel:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_Reward then UTL.Item.SetItemCell(cellTable.item, data.ItemID, data.ItemNum) else if data.rank <= 3 then UIUtils.SetActive(cellTable.img_MedalIcon, true) cellTable.img_MedalIcon:SetState(data.rank-1) UIUtils.SetLabel(cellTable.txt_Rank, "") else UIUtils.SetActive(cellTable.img_MedalIcon, false) UIUtils.SetLabel(cellTable.txt_Rank, data.rank) end if data.playerAcid == BattleDataGetter.GetAcID() then UIUtils.SetLabel(cellTable.txt_PlayerName, UTL.Color.FormatGreenColor(data.name)) else if scrollRect == self.group_Main_Teammate.loop_CASSummaryPlayerInfo then UIUtils.SetLabel(cellTable.txt_PlayerName, UTL.Color.FormatTextByColor("80A9F5",data.name)) elseif scrollRect == self.group_Main_Enemy.loop_CASSummaryEnemyInfo then UIUtils.SetLabel(cellTable.txt_PlayerName, UTL.Color.FormatTextByColor("E46B71",data.name)) elseif scrollRect == self.group_Sub_Defender.loop_CASSummaryDefender then if self.isDefendCountry then UIUtils.SetLabel(cellTable.txt_PlayerName, UTL.Color.FormatTextByColor("80A9F5",data.name)) else UIUtils.SetLabel(cellTable.txt_PlayerName, UTL.Color.FormatTextByColor("E46B71",data.name)) end elseif scrollRect == self.group_Sub_Offender.loop_CASSummaryOffender then if self.isDefendCountry then UIUtils.SetLabel(cellTable.txt_PlayerName, UTL.Color.FormatTextByColor("E46B71",data.name)) else UIUtils.SetLabel(cellTable.txt_PlayerName, UTL.Color.FormatTextByColor("80A9F5",data.name)) end end end UIUtils.SetLabel(cellTable.txt_Kill, data.kill) UIUtils.SetLabel(cellTable.txt_Assisting, data.assist) if cellTable.txt_Contribution then UIUtils.SetLabel(cellTable.txt_Contribution , data.contribution) end UIUtils.SetLabel(cellTable.txt_TotalContribution, data.totalContribution) end end return UIChangAnSiegeSummaryPanel