local UISyncTeamPVPMatchSuccessPanel = UIViewClass() local NameColor = "e8d588" local ConstMatchSuccessCountDown = DataSheetManager.ConstData:GetDataByID("TVTEnterTime").IntValue function UISyncTeamPVPMatchSuccessPanel:OnOpened(context) AuxUtil.StopAllTimeline() self._remainCountDown = ConstMatchSuccessCountDown self:StartRepeatFunc(self.OnUpdateFun, 1) local matchResult = MDL.SyncTeamPVP.GetMatchResult() self:SetHeroInfo(matchResult) self.lab_Time.text = self._remainCountDown self._remainCountDown = self._remainCountDown - 1 CTL.Sound.PlayGameSound("MUSIC_pvp_zhunbei", true) CTL.Sound.PlayGameSound("UI_buildarmy") end function UISyncTeamPVPMatchSuccessPanel:SetHeroImgById(obj, portraitId, frameId) CTL.Character.SetPortraitAndFrame(obj, portraitId, frameId) end function UISyncTeamPVPMatchSuccessPanel:SetHeroInfo(matchResult) for i, v in ipairs(self.group_MyInfo) do if i <= #matchResult.friendlyFighters then UIUtils.SetActive(v.gameObject, true) self:SetHeroInfoCell(v, matchResult.friendlyFighters[i]) else UIUtils.SetActive(v.gameObject, false) end end for i, v in ipairs(self.group_EnemyInfo) do if i <= #matchResult.enemyFighters then UIUtils.SetActive(v.gameObject, true) self:SetHeroInfoCell(v, matchResult.enemyFighters[i]) else UIUtils.SetActive(v.gameObject, false) end end for i, v in ipairs(self.MyInfo_bg) do if i <= #matchResult.friendlyFighters then UIUtils.SetActive(v, true) self:SetHeroInfoBg(v, matchResult.friendlyFighters[i], false) else UIUtils.SetActive(v, false) end end for i, v in ipairs(self.EnemyInfo_bg) do if i <= #matchResult.enemyFighters then UIUtils.SetActive(v, true) self:SetHeroInfoBg(v, matchResult.enemyFighters[i], true) else UIUtils.SetActive(v, false) end end local cfg = DataSheetManager.ThreeBattleLevel:GetDataByLevelID(matchResult.mapId) UIUtils.SetImageByAssetBundle(self.img_map, cfg.NamePath) self.txt_MapName.text = UIUtils.GetLocalizedTxt(Const_IDS[cfg.LevelNameIDS]) end function UISyncTeamPVPMatchSuccessPanel:SetHeroInfoCell(cell, info) if info then if self.context.IsCustomRoom and CTL.Character.IsRobot(info.acid) then CTL.Character.SetRobotHead(cell.head) cell.name.text = CTL.Character.GetRobotName(info.acid) UIUtils.SetActive(cell.serverName, false) else self:SetHeroImgById(cell.head, info.portraitId, info.frameId) if BattleDataGetter.GetAcID() == info.acid then cell.name.text = UTL.Color.FormatTextByColor(NameColor, info.name) else cell.name.text = info.name end UIUtils.SetActive(cell.serverName, CTL.CrossServer.IsShowServerTextInFairPlay()) cell.serverName.text = string.FormatByIdsId(Const_IDS.IDS_Rank_ServerIDS, info.serId) end else UIUtils.SetActive(cell.gameObject, false) end end function UISyncTeamPVPMatchSuccessPanel:SetHeroInfoBg(decorateBg, info, isEnemy) local decorateResource = DataSheetManager.DecorateAdditionalRes:GetDataByID(info.decorate) if isEnemy then decorateResource = DataSheetManager.DecorateAdditionalRes:GetDataByID(info.decorate).Resource4 else decorateResource = DataSheetManager.DecorateAdditionalRes:GetDataByID(info.decorate).Resource3 end UIUtils.SetImageByAssetBundle(decorateBg, decorateResource) end --匹配成功倒计时 function UISyncTeamPVPMatchSuccessPanel:OnUpdateFun(deltaTime, timeSinceUpdate) -- body if self._remainCountDown <= 0 then UIManager.CloseView(Const_UI_Lua.UIEnum.UISyncTeamPVPMatchSuccessPanel) UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UISyncTeamPVPSelectHeroPanel) return end self.lab_Time.text = self._remainCountDown CTL.Sound.PlayCountDown(self._remainCountDown) self._remainCountDown = self._remainCountDown - 1 end return UISyncTeamPVPMatchSuccessPanel