local UIHeroMatch3v3Summary = UIViewClass() local AUTO_CLOSED_COUNTDOWN = DataSheetManager.ConstData:GetDataByID("HeroMatch3v3Interface4").IntValue function UIHeroMatch3v3Summary:OnOpened(context) UIUtils.SetLabel(self.txt_CountDown, string.FormatByIdsId(Const_IDS["IDS_HeroMatch3v3_LeaveTimeOut"], AUTO_CLOSED_COUNTDOWN)) self:StartRepeatFunc(self.RefreshCountDown, 1, -1) self:InitInfo() end function UIHeroMatch3v3Summary:RefreshCountDown(deltaTime, timeSinceUpdate) if timeSinceUpdate >= AUTO_CLOSED_COUNTDOWN then self:OnBackButtonPressed() return end UIUtils.SetLabel(self.txt_CountDown, string.FormatByIdsId(Const_IDS["IDS_HeroMatch3v3_LeaveTimeOut"], math.ceil(AUTO_CLOSED_COUNTDOWN - timeSinceUpdate))) end function UIHeroMatch3v3Summary:InitInfo() local result = self.context local isWin = BattleDataGetter.GetMyCampID() == result.winnerCampId and true or false -- 是否胜利 if isWin then self.state_Over:SetState(0) UIUtils.SetLabelText(self.txt_Result, Const_IDS.IDS_GuildWar_Win) else self.state_Over:SetState(1) UIUtils.SetLabelText(self.txt_Result, Const_IDS.IDS_GuildWar_Lose) end local playerData1 = BattleDataGetter.GetPlayerInfo(result.camp1[1].playerId) local playerData2 = BattleDataGetter.GetPlayerInfo(result.camp2[1].playerId) local serverId1 = playerData1.serId local serverId2 = playerData2.serId if BattleDataGetter.GetMyCampID() == 1 then self.txt_LeftName.text = BattleDataGetter.GetCampName1() .. CTL.CrossServer.GetServerShowStr(serverId1) self.txt_RightName.text = BattleDataGetter.GetCampName2() .. CTL.CrossServer.GetServerShowStr(serverId2) self:SetTeamInfo(self.myTeam, result.camp1) self:SetTeamInfo(self.otherTeam, result.camp2) self.txt_TotalScore.text = result.camp1Score .. " : " .. result.camp2Score else self.txt_LeftName.text = BattleDataGetter.GetCampName2() .. CTL.CrossServer.GetServerShowStr(serverId2) self.txt_RightName.text = BattleDataGetter.GetCampName1() .. CTL.CrossServer.GetServerShowStr(serverId1) self:SetTeamInfo(self.myTeam, result.camp2) self:SetTeamInfo(self.otherTeam, result.camp1) self.txt_TotalScore.text = result.camp2Score .. " : " .. result.camp1Score end end function UIHeroMatch3v3Summary:SetTeamInfo(teamComps, infos) for i, v in ipairs(teamComps) do if i > #infos then UIUtils.SetActive(v.gameObject, false) else UIUtils.SetActive(v.gameObject, true) self:SetPlayerInfo(infos[i], v) end end end function UIHeroMatch3v3Summary:SetPlayerInfo(info, playerComp) local headInfo = BattleDataGetter.GetPlayerInfo(info.playerId) if playerComp.bg_Self then UIUtils.SetActive(playerComp.bg_Self, info.acid == BattleDataGetter.GetAcID()) end -- 设置头像 CTL.Character.SetPortraitAndFrame(playerComp.head, headInfo.portraitId, headInfo.frameId) UIUtils.SetCanvasSortingOrderByMainCanvas(playerComp.head.effectUpCanvas, playerComp.canvas, CTL.Character.UpOrder.Common) -- 名字 local officialDesc = headInfo.officialPosition > 0 and CTL.OfficialPosition.GetModelNameShow(headInfo.officialPosition) or "" UIUtils.SetLabel(playerComp.name, officialDesc .. headInfo.name) -- 势力徽记 CTL.Guild.SetGuildEmblem(playerComp.img_Guild, playerComp.txt_Guild, headInfo.guildEmblemFrame, headInfo.guildEmblemContent) playerComp.killNum.text = info.killNum playerComp.hurt.text = info.damage end function UIHeroMatch3v3Summary:OnBackButtonPressed() self:OnButtonClicked(self.event_Exit) end function UIHeroMatch3v3Summary:OnButtonClicked(comp) if comp == self.event_Exit then self:CloseView() MDL.Level.SendRoleLeaveFuben() end end return UIHeroMatch3v3Summary