local UIHeroMatch3v3MatchPanel = UIViewClass() local AUTO_CLOSED_COUNTDOWN = DataSheetManager.ConstData:GetDataByID("HeroMatch3v3Interface1").IntValue function UIHeroMatch3v3MatchPanel:OnOpened(context) self:StartRepeatFunc(self.RefreshCountDown, 1, -1) UIUtils.SetLabel(self.lab_Time, string.FormatByIdsId(Const_IDS["IDS_HeroMatch3v3_MatchSuccess"], AUTO_CLOSED_COUNTDOWN)) local myCamp = 2 for i, v in ipairs(context.showInfo1) do if v.acid == BattleDataGetter.GetAcID() then myCamp = 1 break end end if myCamp == 1 then self.txt_LeftTeamName.text = context.teamName1 .. CTL.CrossServer.GetServerShowStr(context.showInfo1[1].ShowServerId) self.txt_RightTeamName.text = context.teamName2 .. CTL.CrossServer.GetServerShowStr(context.showInfo2[1].ShowServerId) self:SetTeamInfo(context.showInfo1, self.group_MyInfo) self:SetTeamInfo(context.showInfo2, self.group_EnemyInfo) else self.txt_LeftTeamName.text = context.teamName2 .. " " .. CTL.CrossServer.GetServerShowStr(context.showInfo2[1].ShowServerId) self.txt_RightTeamName.text = context.teamName1 .. " " .. CTL.CrossServer.GetServerShowStr(context.showInfo1[1].ShowServerId) self:SetTeamInfo(context.showInfo2, self.group_MyInfo) self:SetTeamInfo(context.showInfo1, self.group_EnemyInfo) end end function UIHeroMatch3v3MatchPanel:RefreshCountDown(deltaTime, timeSinceUpdate) local remainCountDown = math.ceil(AUTO_CLOSED_COUNTDOWN - timeSinceUpdate) if timeSinceUpdate >= AUTO_CLOSED_COUNTDOWN then return end CTL.Sound.PlayCountDown(remainCountDown) UIUtils.SetLabel(self.lab_Time, string.FormatByIdsId(Const_IDS["IDS_HeroMatch3v3_MatchSuccess"], remainCountDown)) end function UIHeroMatch3v3MatchPanel:SetTeamInfo(headInfoArray, col) for i, v in ipairs(col) do if headInfoArray[i] then UIUtils.SetActive(v.gameObject, true) self:SetPlayerInfo(headInfoArray[i], v) else UIUtils.SetActive(v.gameObject, false) end end end function UIHeroMatch3v3MatchPanel:SetPlayerInfo(headInfo, playerComp) -- 设置头像 CTL.Character.SetPortraitAndFrame(playerComp.head, headInfo.PortraitId, headInfo.FrameId) UIUtils.SetCanvasSortingOrderByMainCanvas(playerComp.head.effectUpCanvas, playerComp.canvas, CTL.Character.UpOrder.Common) -- 名字 local officialDesc = headInfo.OfficialId > 0 and CTL.OfficialPosition.GetModelNameShow(headInfo.OfficialId) or "" UIUtils.SetLabel(playerComp.name, officialDesc .. headInfo.name) -- 势力徽记 CTL.Guild.SetGuildEmblem(playerComp.img_Guild, playerComp.txt_Guild, headInfo.EmblemFrame, headInfo.EmblemContent) -- 战力 playerComp.txt_BR.text = headInfo.gsSum end return UIHeroMatch3v3MatchPanel