--[[ 队伍公平竞技,2进1 ]] local PlayerHeadCell3V3Helper = require "Modules.TeamFairChampionship.PlayerHeadCell3V3Helper" local UITeamFairChampionshipBaseStage05 = UIViewClass() local TimerString = string.FormatByIdsId(Const_IDS.IDS_HeroMatch3v3_StartInMinutes, "{0}:{1}:{2}") local BattleTimerString = UIUtils.GetLocalizedTxt(Const_IDS.IDS_HeroMatch3v3_SkipBattleTime) .. "{0}:{1}:{2}" function UITeamFairChampionshipBaseStage05:OnOpened(context) self:RegistSystemEvent(EventID.UI_TeamFairChampionship_RefreshInfo, self.OnRefreshStageInfo) self:RegistSystemEvent(EventID.UI_TeamFairChampionship_RefreshOneStage, self.RefreshStage) self:RegistSystemEvent(EventID.UI_TeamFairChampionship_AllPlayerInfo, self.OnGetPlayerInfoComplete) self:RegistSystemEvent(EventID.UI_TeamFairChampionship_BattleBet, self.OnRefreshStageInfo) 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 UITeamFairChampionshipBaseStage05:OnRefreshStageInfo() if MDL.TeamFairChampionship.GetMatchStageInfo(self.displayMatchStageId) then self:RefreshStage(self.displayMatchStageId, 0) end end function UITeamFairChampionshipBaseStage05:OnGetPlayerInfoComplete() if MDL.TeamFairChampionship.GetMatchStageInfo(self.displayMatchStageId) then self:RefreshStage(self.displayMatchStageId) end end function UITeamFairChampionshipBaseStage05:RefreshStage(stageId, myMatchGroupId) if stageId == self.displayMatchStageId then self.matchStageInfo = MDL.TeamFairChampionship.GetMatchStageInfo(self.displayMatchStageId) --左边队伍 self:SetTeamPlayerInfo(self.group_Left, self.matchStageInfo.groupInfo[1].teamInfos[1]) --右边队伍 self:SetTeamPlayerInfo(self.group_Right, self.matchStageInfo.groupInfo[1].teamInfos[2]) PlayerHeadCell3V3Helper.Set3V3MatchPlayerNormalCellInit(1, self.group_Team, self.matchStageInfo.groupInfo[1], self.matchStageInfo, false) end end function UITeamFairChampionshipBaseStage05:SetTeamPlayerInfo(teamPlayerComp, teamInfo) local isHasTeamInfo = not string.isNilOrEmpty(teamInfo.teamId) if isHasTeamInfo then for i=1, 3 do local playerShowInfo = nil if not string.isNilOrEmpty(teamInfo.memberAcids[i]) then playerShowInfo = MDL.TeamFairChampionship.GetPlayerInfoByACID(teamInfo.memberAcids[i]) end self:SetPlayerInfo(teamPlayerComp[i], playerShowInfo) end else for __, playerComp in ipairs(teamPlayerComp) do UIUtils.SetActive(playerComp.gameObject, false) end end end function UITeamFairChampionshipBaseStage05:SetPlayerInfo(playerComp, playerShowInfo) if playerShowInfo then UIUtils.SetActive(playerComp.gameObject, true) CTL.Character.SetPortraitAndFrame(playerComp.UIHeroHead, playerShowInfo.PortraitId, playerShowInfo.FrameId) if playerShowInfo.acid == BattleDataGetter.GetAcID() then UIUtils.SetLabel(playerComp.txt_Name, UTL.Color.FormatTextByColor("fff08b", playerShowInfo.name)) else UIUtils.SetLabel(playerComp.txt_Name, playerShowInfo.name) end UIUtils.SetLabel(playerComp.txt_GuildName, playerShowInfo.guildName) CTL.Guild.SetGuildEmblem(playerComp.img_Guild, playerComp.txt_Guild, playerShowInfo.EmblemFrame, playerShowInfo.EmblemContent) UIUtils.SetCanvasSortingOrderByMainCanvas(playerComp.UIHeroHead.effectUpCanvas, playerComp.img_Captain, CTL.Character.UpOrder.Common) else UIUtils.SetActive(playerComp.gameObject, false) end end function UITeamFairChampionshipBaseStage05:OnButtonClicked(comp) for index, playerHead in ipairs(self.group_Left) do if comp == playerHead.UIHeroHead.img_PlayerAvatarBg then MDL.PlayerInteract.GetPlayerInteractiveInfoReq(self.matchStageInfo.groupInfo[1].teamInfos[1].memberAcids[index]) return end end for index, playerHead in ipairs(self.group_Right) do if comp == playerHead.UIHeroHead.img_PlayerAvatarBg then MDL.PlayerInteract.GetPlayerInteractiveInfoReq(self.matchStageInfo.groupInfo[1].teamInfos[2].memberAcids[index]) return end end PlayerHeadCell3V3Helper.On3V3MatchPlayerCellClick(self.group_Team, self.matchStageInfo.groupInfo[1], comp, self.matchStageInfo) end return UITeamFairChampionshipBaseStage05