local UISyncFourCountryWarSummaryPanel = UIViewClass() local SyncFourCountryAutoDeparture = DataSheetManager.ConstData:GetDataByID("SyncFourCountryAutoDeparture").IntValue local SyncFourCountryDailyCurrencyNumMax = DataSheetManager.ConstData:GetDataByID("SyncFourCountryDailyCurrencyNumMax").IntValue local SyncFourCountryStandardPersonalPoint = DataSheetManager.ConstData:GetDataByID("SyncFourCountryStandardPersonalPoint").IntValue local CountryBG = { ConstAssetPathConfig.AssetPath221, ConstAssetPathConfig.AssetPath222, ConstAssetPathConfig.AssetPath223, ConstAssetPathConfig.AssetPath224, } local CountryTitleBG = { ConstAssetPathConfig.AssetPath225, ConstAssetPathConfig.AssetPath226, ConstAssetPathConfig.AssetPath227, ConstAssetPathConfig.Path48, } function UISyncFourCountryWarSummaryPanel:OnOpened(context) local list = {} for i, countryInfo in ipairs(context.teamInfo) do for _, playerInfo in ipairs(countryInfo.playerInfo) do if playerInfo.acid == BattleDataGetter.GetAcID() then self.myCampIndex = countryInfo.rankIdx end end list[countryInfo.rankIdx] = {countryId = countryInfo.campId, data = countryInfo} end for i, v in ipairs(list) do self:SetCountryInfo(self.group_Players[v.data.rankIdx], v.data, v.countryId) end self:StartRepeatFunc(self.OnUpdateTimeFun, 1, 0) end function UISyncFourCountryWarSummaryPanel:OnUpdateTimeFun(deltaTime, timeSinceUpdate) self.Txt_Close.text = string.FormatByIdsId(Const_IDS.IDS_SyncFourCountry_AutoDeparture, math.ceil(SyncFourCountryAutoDeparture - timeSinceUpdate)) if timeSinceUpdate >= SyncFourCountryAutoDeparture then self:OnButtonClicked(self.btn_Close) return end end function UISyncFourCountryWarSummaryPanel:OnButtonClicked(comp) if comp == self.btn_Close then MDL.Level.SendRoleLeaveFuben() self:CloseView() end end function UISyncFourCountryWarSummaryPanel:SetPlayerInfo(collection, playerInfo, isMyCamp) UTL.Item.SetHeroIconByHeroId(collection.img_MainHero, playerInfo.mainHeroId, playerInfo.mainHeroAwaken) UTL.Item.SetHeroIconByHeroId(collection.img_SubHero, playerInfo.viceHeroId, playerInfo.viceHeroAwaken) if playerInfo.acid == BattleDataGetter.GetAcID() then collection.lab_PlayerName.text = UTL.Color.FormatGreenColor(playerInfo.playerName) collection.lab_Server.text = UTL.Color.FormatGreenColor(".S"..playerInfo.serverId) self.myScore = playerInfo.score else collection.lab_PlayerName.text = playerInfo.playerName collection.lab_Server.text = ".S"..playerInfo.serverId end collection.lab_Score.text = playerInfo.score collection.lab_KillNum.text = playerInfo.killNum collection.lab_RemainHP.text = playerInfo.deathNum UIUtils.SetActive(collection.img_hangUp, playerInfo.isNegativeFight) if isMyCamp then if playerInfo.acid == BattleDataGetter.GetAcID() then UIUtils.SetImageByAssetBundle(collection.img_01, MDL.SyncFourCountryWar.SelfSquare) UIUtils.SetImageByAssetBundle(collection.img_02, MDL.SyncFourCountryWar.SelfRound) else UIUtils.SetImageByAssetBundle(collection.img_01, MDL.SyncFourCountryWar.TeamSquare) UIUtils.SetImageByAssetBundle(collection.img_02, MDL.SyncFourCountryWar.TeamRound) end else UIUtils.SetImageByAssetBundle(collection.img_01, MDL.SyncFourCountryWar.EnemySquare) UIUtils.SetImageByAssetBundle(collection.img_02, MDL.SyncFourCountryWar.EnemyRound) end end function UISyncFourCountryWarSummaryPanel:SetCountryInfo(collection, countryInfo, countryId) for i, v in ipairs(collection.group_Player) do self:SetPlayerInfo(v, countryInfo.playerInfo[i], countryInfo.rankIdx == self.myCampIndex) end local countryData = DataSheetManager.CountryBase:GetDataByID(countryId) collection.state_Country:SetState(countryId - 1) UIUtils.SetImageByAssetBundle(collection.img_CountryBG, CountryTitleBG[countryId]) UIUtils.SetImageByAssetBundle(collection.img_Bg, CountryBG[countryId]) UTL.Item.SetAtlasSprite(collection.img_Rank, "UI_Battle", "bd_zs_0" .. countryInfo.rankIdx) collection.lab_CountryIntegral.text = countryInfo.score if countryInfo.rankIdx == self.myCampIndex then local score = countryInfo.beforeGainCoin + countryInfo.gainCoin if score >= SyncFourCountryDailyCurrencyNumMax then score = UTL.Color.FormatRedColor(SyncFourCountryDailyCurrencyNumMax) else score = UTL.Color.FormatGreenColor(score) end collection.txt_Extra.text = string.format("(%s/%s)", score, SyncFourCountryDailyCurrencyNumMax) UIUtils.SetActive(collection.group_My, true) if self.myScore < SyncFourCountryStandardPersonalPoint then UIUtils.SetActive(collection.group_Info, true) UIUtils.SetLabelText(collection.txt_Info, Const_IDS.IDS_SyncFourCountry_NotMeetingStandard ) else UIUtils.SetActive(collection.group_Info, false) end else UIUtils.SetActive(collection.group_My, false) collection.txt_Extra.text = nil end collection.txt_Num.text = countryInfo.gainCoin if countryInfo.honorScore > 0 then collection.txt_Experience.text = "+"..countryInfo.honorScore UIUtils.SetActive(collection.group_Experience, true) else UIUtils.SetActive(collection.group_Experience, false) end UIUtils.SetActive(collection.group_SummaryInfo, true) end return UISyncFourCountryWarSummaryPanel