--[[ 冠军展示 ]] local EventSystem = require('Event/EventSystem') local UIHeroLightEffectTool = require "View/Common/UIHeroLightEffectTool" local ConstShowParams = { [1] = { posX = 1.11, posY = 0.19, posZ = 0, scale = 0.7}, [2] = { posX = 2.39, posY = 0.1, posZ = -0.43, scale = 0.7}, [3] = { posX = -0.22, posY = 0.1, posZ = -0.43, scale = 0.7}, } local ConstLightPath = ConstAssetPathConfig.LightLeft local FILTER_EFFECT_ID = 204001 --不显示该光效(法相) local UITeamFairChampionshipBaseStage06 = UIViewClass() function UITeamFairChampionshipBaseStage06:OnCreated() self.heroLightEffectDatas = UIHeroLightEffectTool.CreateHeroLightEffectDatas(true) self.modelComponentDataHandle = UTL.UIRender.CreateModelComponentDatas(self.obj_Model) end function UITeamFairChampionshipBaseStage06:OnOpened(context) self:RegistSystemEvent(EventID.UI_TeamFairChampionship_RefreshOneStage, self.RefreshStage) self:RegistSystemEvent(EventID.UI_TeamFairChampionship_AllPlayerInfo, self.OnGetPlayerInfoComplete) self.displayMatchStageId = context.displayMatchStageId self.matchStageInfo = MDL.TeamFairChampionship.GetMatchStageInfo(self.displayMatchStageId) if not self.matchStageInfo then MDL.TeamFairChampionship.TeamFairGetStageInfoReq(self.displayMatchStageId) else self:RefreshStage(self.displayMatchStageId, 0) end end function UITeamFairChampionshipBaseStage06:OnGetPlayerInfoComplete() if MDL.TeamFairChampionship.GetMatchStageInfo(self.displayMatchStageId) then self:RefreshStage(self.displayMatchStageId, 0) end end function UITeamFairChampionshipBaseStage06:RefreshStage(stageId, myMatchGroupId) if stageId == self.displayMatchStageId then self.matchStageInfo = MDL.TeamFairChampionship.GetMatchStageInfo(self.displayMatchStageId) self.winnerTeamInfo = self.matchStageInfo.groupInfo[1].teamInfos[1] UIUtils.SetLabel(self.txt_TeamName, self.winnerTeamInfo.teamName) if not MDL.TeamFairChampionship.GetPlayerInfoByACID(self.winnerTeamInfo.memberAcids[1]) then return end self:InitScene() self.loadModelIndex = 0 self:StartRepeatFunc(self.LoadHeroModel, 0.1, -1) for index, playerInfoComp in ipairs(self.groupPlayerInfo) do local playerInfo = MDL.TeamFairChampionship.GetPlayerInfoByACID(self.winnerTeamInfo.memberAcids[index]) self:SetPlayerInfo(playerInfo, playerInfoComp) end end end function UITeamFairChampionshipBaseStage06:InitScene() EventSystem.Dispatch(EventID.UI_TeamFairChampionship_ActiveBaseBG, false) UTL.UIRender.Create2DSceneTrans(self.modelComponentDataHandle, ConstAssetPathConfig.Common2DScenePrefab, 1600, 0, 1600, ConstAssetPathConfig.AssetPath171, false) UTL.UIRender.SetHeroParentPos(self.modelComponentDataHandle, -1, -1.2, 0) -- 设置模型位移信息 UTL.UIRender.SetHeroParentRot(self.modelComponentDataHandle, 0, 0, 0) -- 设置模型位移信息 end function UITeamFairChampionshipBaseStage06:SetPlayerInfo(info, comp) if info then UIUtils.SetActive(comp.gameObject, true) UIUtils.SetLabel(comp.txt_Server, CTL.CrossServer.GetServerShowStr(info.ShowServerId)) UIUtils.SetLabel(comp.txt_PlayerName, CTL.OfficialPosition.GetModelNameShow(info.OfficialId) .. info.name) if not string.isNilOrEmpty(info.guildId) then UIUtils.SetActive(comp.img_GuildBG, true) local framePath, emblemContent, guildDesc = CTL.Guild.GetModelNameShowParam(info.EmblemFrame, info.EmblemContent, info.guildName, info.JobTitle) UIUtils.SetImageByAssetBundle(comp.img_GuildBG, framePath) comp.txt_Guild.text = emblemContent comp.txt_GuildName.text = guildDesc else UIUtils.SetActive(comp.img_GuildBG, false) comp.txt_GuildName.text = "" end else UIUtils.SetActive(comp.gameObject, false) end end function UITeamFairChampionshipBaseStage06:LoadHeroModel() self.loadModelIndex = self.loadModelIndex + 1 if self.loadModelIndex > 3 then self:StopRepeatFunc(self.LoadHeroModel) return end local showInfo = MDL.TeamFairChampionship.GetPlayerInfoByACID(self.winnerTeamInfo.memberAcids[self.loadModelIndex]) if showInfo then UTL.UIRender.DelayLoadMultiBattleModel(self.modelComponentDataHandle, showInfo, ConstShowParams[self.loadModelIndex], ConstLightPath) if showInfo.lightEffectIds then for _, lightEffectID in ipairs(showInfo.lightEffectIds) do if lightEffectID ~= FILTER_EFFECT_ID then UIHeroLightEffectTool.PlayHeroLightEffect(self.heroLightEffectDatas, self, 0, UIHeroLightEffectTool.PlayLightEffectFuncEnum.CountryOfficial, lightEffectID, {renderEntityIndex = self.loadModelIndex}) end end end end end function UITeamFairChampionshipBaseStage06:CountryOfficialPlayModelEffect(path, param) return UTL.UIRender.PlayPsEffectByRenderEntityIndex(self.modelComponentDataHandle, path, param.renderEntityIndex) end function UITeamFairChampionshipBaseStage06:OnClosed() EventSystem.Dispatch(EventID.UI_TeamFairChampionship_ActiveBaseBG, true) UIHeroLightEffectTool.StopHeroLightEffect(self.heroLightEffectDatas) self.heroLightEffectDatas = nil UTL.UIRender.DisposeModelComponentData(self.modelComponentDataHandle) end function UITeamFairChampionshipBaseStage06:OnButtonClicked(comp) for index, playerGroupComp in ipairs(self.groupPlayerInfo) do if comp == playerGroupComp.btn_Info then CTL.PlayerInteract.OpenFriendInteractView(self.winnerTeamInfo.memberAcids[index]) end end end return UITeamFairChampionshipBaseStage06