local UITeamFairChampionshipLobbyInfo = UIViewClass() function UITeamFairChampionshipLobbyInfo:OnOpened(context) self:RegistSystemEvent(EventID.UI_TeamFairChampionship_RefreshInfo, self.OnStageRefresh) self:RegistSystemEvent(EventID.UI_TeamFairChampionship_RefreshOneStage, self.RefreshOneStage) self:RegistSystemEvent(EventID.UI_TownHome_BtnState_Changed, self.UpdatePanelFoldState) self:UpdatePanelFoldState(MDL.HomeMain.TownFoldType.RightBottom, not MDL.HomeMain.GetTownHomeUIFoldStateByType(MDL.HomeMain.TownFoldType.RightBottom)) self:OnStageRefresh() end function UITeamFairChampionshipLobbyInfo:OnStageRefresh() local curStageID = MDL.TeamFairChampionship.GetCurStageID() local stageInfo = MDL.TeamFairChampionship.GetMatchStageInfo(curStageID) if not stageInfo then MDL.TeamFairChampionship.TeamFairGetStageInfoReq(curStageID) else self:RefreshBattleInfo() end end function UITeamFairChampionshipLobbyInfo:RefreshOneStage(stageId) if stageId == MDL.TeamFairChampionship.GetCurStageID() then self:RefreshBattleInfo() end end function UITeamFairChampionshipLobbyInfo:RefreshBattleInfo() local leftTime, matchTimeIds = CTL.TeamFairChampionship.GetBattleStageDisplayInfo() UIUtils.SetLabelText(self.lab_MatchCountDown, Const_IDS[matchTimeIds]) self.txt_MatchCountDown:ResetAndBeginTimer(false, leftTime) --第二、三行 local stageConfig = DataSheetManager.TeamFairMatchStage:GetDataByID(MDL.TeamFairChampionship.GetCurStageID()) if CTL.TeamFairChampionship.IsFilterMatchStage() then local left, max = CTL.TeamFairChampionship.GetFilterMatchCount() self.txt_Progress:SetText(UIUtils.GetLocalizedTxt(Const_IDS[stageConfig.InterfaceDes]) .. " " .. left .. "/" .. max) local leftGuess, maxGuess = CTL.TeamFairChampionship.GetMatchGuessingTimes() UIUtils.SetLabelText(self.txt_NextRace, Const_IDS["IDS_FairTournament_RemainPickNum2"]) self.txt_LeftCount:SetText(leftGuess .. "/" .. maxGuess) else local progressTxt, roundTxt = CTL.TeamFairChampionship.GetNonFilterMatchProgressDesc() UIUtils.SetLabelText(self.txt_NextRace, Const_IDS["IDS_HeroMatch1v1_NextRace"]) self.txt_Progress:SetText(progressTxt) self.txt_LeftCount:SetText(roundTxt) end end function UITeamFairChampionshipLobbyInfo:OnButtonClicked(comp) if comp == self.btn_Info then CTL.TeamFairChampionship.OpenMatchNote() elseif comp == self.btn_CurrentState then CTL.TeamFairChampionship.OpenMainPanel() elseif comp == self.btn_TalkPick then UIManager.OpenView(Const_UI_Lua.UIEnum.UITeamFairChampionshipGuessing, nil, "HeroMatch1v1/UIHeroMatch1v1Guessing") elseif comp == self.btn_Close then self.state:SetState(1) elseif comp == self.btn_Open then self.state:SetState(0) end end function UITeamFairChampionshipLobbyInfo:UpdatePanelFoldState(foldType, isFold) if foldType == MDL.HomeMain.TownFoldType.RightBottom then if self.state.CurState == 0 then UIUtils.SetActive(self.info_Panel.gameObject, isFold) else UIUtils.SetActive(self.btn_Open, isFold) end end end return UITeamFairChampionshipLobbyInfo