local UIGVGFightSummaryPanel = UIViewClass() function UIGVGFightSummaryPanel:OnOpened(context) self.img_Blue.txt_ForceLoss.text = context.gvgAccountReduce[1] --损失 self.img_Blue.txt_ForceSurplus.text = context.gvgAccountLeft[1] self.img_Red.txt_ForceLoss.text = context.gvgAccountReduce[2] self.img_Red.txt_ForceSurplus.text = context.gvgAccountLeft[2] if context.gvgAccountLeft[1] <= 0 then UIUtils.SetLabelText(self.img_Blue.txt_SeriousInjury, Const_IDS.IDS_GVGFight_Account_Info_3) end if context.gvgAccountLeft[2] <= 0 then UIUtils.SetLabelText(self.img_Red.txt_SeriousInjury, Const_IDS.IDS_GVGFight_Account_Info_4) end local timeStr = UIUtils.GetLocalizedTxt(Const_IDS.IDS_RankOptimization_AutoExit) self.txt_CountDown:ResetAndBeginCustomTimer(false, 10, 0, timeStr) self:StartRepeatFunc(self.OnUpdateCountdownTimer, 10, 1) CTL.LevelSelect.ShowCommonSummaryTemplate(self, context.isWin, false, false) self:SetPlayerInfo(self.group_PlayerInfo2, BattleDataGetter.GetPlayerInfo(LuaConst.STANDALONE_ENEMYPLAYER1_PLAYID), false) self:SetPlayerInfo(self.group_PlayerInfo1, BattleDataGetter.GetPlayerInfo(LuaConst.STANDALONE_PLAYER_PlayID), true) --头像顺序,从外往内,前-中-后军 local selfLineUpHeroIds = MDL.FreeLineUp.GetLineUpArrayIdListByFunctionType(MDL.FreeLineUp.FuncType.GvGFight, true) local lineUpHeroIds = MDL.GVGFight.GetOtherLineUpHeroIdList() for i = 1, 3 do self:SetPlayerHead(self.img_Blue.group_Hero[i], selfLineUpHeroIds[2*i-1],selfLineUpHeroIds[2*i]) self:SetPlayerHead(self.img_Red.group_Hero[i], lineUpHeroIds[2*i-1],lineUpHeroIds[2*i]) end end function UIGVGFightSummaryPanel:OnClosed() -- 关闭界面时 打开主界面 UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIGVGFightMain) -- 在打开对应城池界面的 对应页数 local cityId, page, playerShowType = CTL.GVGFight.GetFightCityInfo() local curGVGFightState = MDL.GVGFight.GetCurGVGFightState() if cityId > 0 and (curGVGFightState == MDL.GVGFight.GVGFightStage.Struggle or curGVGFightState == MDL.GVGFight.GVGFightStage.Fierce) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGVGFightGarrisonTroops, {cityId = cityId, playerShowType = playerShowType, page = page}) CTL.GVGFight.RecordFightCityInfo(0, 0, 0) -- 置空 end end function UIGVGFightSummaryPanel:OnUpdateCountdownTimer() self:CloseView(false) end function UIGVGFightSummaryPanel:SetPlayerHead(cell, mainHeroInfo, subHeroInfo) local mainHeroId = mainHeroInfo.heroId local subHeroId = subHeroInfo.heroId UIUtils.SetActive(cell.img_MainHero, mainHeroId > 0) UIUtils.SetActive(cell.img_MainEmpty, not (mainHeroId > 0)) if mainHeroId > 0 then UTL.Item.SetHeroIconByHeroId(cell.img_MainHero, mainHeroId, mainHeroInfo.isAwaken) end UIUtils.SetActive(cell.img_SubHero, subHeroId > 0) UIUtils.SetActive(cell.img_SubEmpty, not (subHeroId > 0)) if subHeroId > 0 then UTL.Item.SetHeroIconByHeroId(cell.img_SubHero, subHeroId, subHeroInfo.isAwaken) end end function UIGVGFightSummaryPanel:SetPlayerInfo(collection, info, isSelf) collection.txt_PlayerName.text = info.name if string.isNilOrEmpty(info.guildName) then UIUtils.SetActive(collection.group_GuildNameIcon, false) UIUtils.SetLabelText(collection.txt_GuildName, Const_IDS.IDS_GVGFight_InCity_NoGuild) else collection.txt_GuildName.text = info.guildName UIUtils.SetActive(collection.group_GuildNameIcon, true) CTL.Guild.SetGuildEmblem(collection.img_GuildIcon, collection.txt_GuildNameInitiate, info.emblemFrame, info.guildEmblemContent) end if isSelf then collection.txt_server.text = string.FormatByIdsId(Const_IDS.IDS_CrossSever_SeverSuffixText1, MDL.Login.GetServerShowId()) CTL.Character.SetSelfPortraitAndFrame(collection.PlayerHead) else collection.txt_server.text = string.FormatByIdsId(Const_IDS.IDS_CrossSever_SeverSuffixText1, info.serId) CTL.Character.SetPortraitAndFrame(collection.PlayerHead, info.portraitId, info.frameId) end end function UIGVGFightSummaryPanel:OnButtonClicked(comp) if comp == self.btn_ShareClose then self:CloseView(false) end end return UIGVGFightSummaryPanel