local UIFairSoloTournamentLobbyInfo = UIViewClass() function UIFairSoloTournamentLobbyInfo:OnOpened(context) self:RegistSystemEvent(EventID.UI_FairSoloTournament_RefreshStageInfo, self.RefreshBattleInfo) self:RegistSystemEvent(EventID.UI_FairSoloTournament_RefreshMyInfo, self.RefreshBattleInfo) self:RegistSystemEvent(EventID.UI_TownHome_BtnState_Changed, self.UpdatePanelFoldState) self:UpdatePanelFoldState(MDL.HomeMain.TownFoldType.RightBottom, not MDL.HomeMain.GetTownHomeUIFoldStateByType(MDL.HomeMain.TownFoldType.RightBottom)) MDL.FairSoloTournament.FairTournamentOpenReq() end function UIFairSoloTournamentLobbyInfo:RefreshBattleInfo() local curStageID = MDL.FairSoloTournament.GetCurStageID() local stageInfo = MDL.FairSoloTournament.GetStageInfo(curStageID) local startTimestamp = stageInfo.stateEndTime local leftTime = math.max(startTimestamp - UTL.Time.GetServerTimestamp(), 0) --第一行显示时长 if stageInfo.state == MDL.FairSoloTournament.Enum_State.Roll or stageInfo.state == MDL.FairSoloTournament.Enum_State.BanPick or stageInfo.state == MDL.FairSoloTournament.Enum_State.Battle then --战斗时长 = 掷骰子 + bp + 战斗 UIUtils.SetLabelText(self.lab_MatchCountDown, Const_IDS["IDS_HeroMatch1v1_SkipBattleTime"]) local matchTimeCfg = DataSheetManager.FairMatchTime:GetDataByID(MDL.FairSoloTournament.GetCurMatchTimeID()) if stageInfo.state == MDL.FairSoloTournament.Enum_State.Roll then leftTime = leftTime + matchTimeCfg.BanHeroTime + matchTimeCfg.ChooseHeroTime + matchTimeCfg.ChangeHeroPlace + matchTimeCfg.WaitBattle + matchTimeCfg.BattleTime elseif stageInfo.state == MDL.FairSoloTournament.Enum_State.BanPick then leftTime = leftTime + matchTimeCfg.BattleTime end else UIUtils.SetLabelText(self.lab_MatchCountDown, Const_IDS["IDS_HeroMatch1v1_MatchingTime"]) end self.txt_MatchCountDown:ResetAndBeginTimer(false, leftTime) --第二、三行 local stageConfig = DataSheetManager.FairMatchStage:GetDataByID(curStageID) if curStageID == MDL.FairSoloTournament.ConfigStage.Group_1 or curStageID == MDL.FairSoloTournament.ConfigStage.Group_2 then local left, max = MDL.FairSoloTournament.GetCurGroupTimes() self.txt_Progress:SetText(UIUtils.GetLocalizedTxt(Const_IDS[stageConfig.InterfaceDes]) .. " " .. left .. "/" .. max) local leftGuess, maxGuess = MDL.FairSoloTournament.GetCurGuessingTimes() UIUtils.SetLabelText(self.txt_NextRace, Const_IDS["IDS_FairTournament_RemainPickNum2"]) self.txt_LeftCount:SetText(leftGuess .. "/" .. maxGuess) else local progressTxt, roundTxt = CTL.FairSoloTournament.GetOverGroupProgressDesc() UIUtils.SetLabelText(self.txt_NextRace, Const_IDS["IDS_HeroMatch1v1_NextRace"]) self.txt_Progress:SetText(progressTxt) self.txt_LeftCount:SetText(roundTxt) end end function UIFairSoloTournamentLobbyInfo: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 function UIFairSoloTournamentLobbyInfo:OnButtonClicked(comp) if comp == self.btn_Info then CTL.FairSoloTournament.OpenNote() elseif comp == self.btn_CurrentState then CTL.FairSoloTournament.OpenMain() elseif comp == self.btn_TalkPick then UIManager.OpenView(Const_UI_Lua.UIEnum.UIFairSoloTournamentGuessing) elseif comp == self.btn_Close then self.state:SetState(1) elseif comp == self.btn_Open then self.state:SetState(0) end end return UIFairSoloTournamentLobbyInfo