--[[ 天下会武3V3 ]] local TeamFairChampionship_Controller = {} local private = {} local UITeamFairChampionshipBaseVM = require "View.TeamFairChampionship.UITeamFairChampionshipBaseVM" local EventSystem = require('Event/EventSystem') function TeamFairChampionship_Controller.OnStartup() EventSystem.Regist(EventID.TimerWheelStartTimeOver, private.OnActivityStart) EventSystem.Regist(EventID.AcquireSystemRedAfterUnlock, private.OnInitServerDataOver) EventSystem.Regist(EventID.UI_DelayToTownPlay, private.OnDelayEnterLevel) EventSystem.Regist(EventID.VoiceRoom_OnServerRoomInitStateResp, private.OnServerRoomInitStateResp) private.lastGroupSelectIndex = 0 private.uiTeamFairChampionshipBaseVM = nil private.hotMatchTeamIds = nil end --活动时间开始 function private.OnActivityStart(timeId, activityId, timeIndex) if activityId == LuaConst.ActivityType.TeamFairChampionship then if BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.TeamFairChampionshipTown) then return end if not TeamFairChampionship_Controller.IsInBattleStage() then return end if not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UITeamFairChampionshipBase) then CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.TeamFairChampionship_Start) if CTL.Activities.IsInActivitySpecificLevel() then UIManager.OpenView(Const_UI_Lua.UIEnum.UIActivitiesRemind, {LuaConst.ActivityType.TeamFairChampionship}) else CTL.HomeMain.AddTownHomeDelayView(Const_UI_Lua.UIEnum.UIActivitiesRemind, {LuaConst.ActivityType.TeamFairChampionship}) end end end end function TeamFairChampionship_Controller.IsInBattleStage() if not TeamFairChampionship_Controller.IsShowEntry() then return false end local curBigStageId = MDL.TeamFairChampionship.GetCurBigStageID() if curBigStageId==MDL.TeamFairChampionship.Enum_BigStage.Advance then return false end if curBigStageId==MDL.TeamFairChampionship.Enum_BigStage.Display then return false end return true end function private.OnServerRoomInitStateResp(roomType) if roomType == MDL.VoiceRoom.VoiceRoomType.TeamFairChampionship then local listenerState, microState = MDL.VoiceRoom.GetVoiceRoomInitState(roomType) local roomId = "" if BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.TeamFairChampionshipTown) then roomId = "TeamFairChampionship_"..MDL.TeamFairChampionship.GetMyTeamId() else roomId = BattleDataGetter.GetBattleChatChannel() end CTL.VoiceRoom.EnterVoiceRoom(roomType, roomId, listenerState, microState) end end function private.OnInitServerDataOver() --此处服务器数据不完整。需要再次请求 if MDL.TeamFairChampionship.GetCurBigStageID()>=MDL.TeamFairChampionship.Enum_BigStage.Screening then MDL.TeamFairChampionship.TeamFairOpenReq() end end --上线后在匹配场景,并且是roll或者banpick阶段,向服务器请求一下阶段信息 function private.OnDelayEnterLevel() if not BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.TeamFairChampionshipTown) then return end if MDL.TeamFairChampionship.GetCurBigStageID()>=MDL.TeamFairChampionship.Enum_BigStage.Screening then local curStageState = MDL.TeamFairChampionship.GetCurMatchStageState() if curStageState == MDL.TeamFairChampionship.Enum_State.BanPick or curStageState == MDL.TeamFairChampionship.Enum_State.Roll then MDL.TeamFairChampionship.C2GTeamFairRequireBPState() end end local curBigStageId = MDL.TeamFairChampionship.GetCurBigStageID() local watchParam = MDL.TeamFairChampionship.GetWatchParam() if watchParam and curBigStageId>=MDL.TeamFairChampionship.Enum_BigStage.Screening and curBigStageId<=MDL.TeamFairChampionship.Enum_BigStage.Finals then TeamFairChampionship_Controller.OpenMainPanel() MDL.TeamFairChampionship.ClearWatchParam() end end function TeamFairChampionship_Controller.OnTotalMatchOver() if UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UITeamFairChampionshipBase) then CTL.HomeMain.CloseViewBackHomeMain() end CTL.SpecialTeam.OnFuncIdClose() end function private.SortHotTeamInfo(teamInfo1, teamInfo2) return teamInfo1.enterRank32 and 32 or #sortedList for i=1, hotCount do private.hotMatchTeamIds[sortedList[i].teamId] = true end end end end function TeamFairChampionship_Controller.IsCurActivityInOpenTime() --todo,参考MDL.HeroMatch3v3.IsCurActivityInOpenTime(),用于初始化弹幕 return TeamFairChampionship_Controller.IsShowEntry() -- 可能不是这个逻辑,先占坑 end function TeamFairChampionship_Controller.IsShowEntry() if not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.TeamFairChampionship) then return false end local matchStartTime = MDL.TeamFairChampionship.GetMatchStartTime() return matchStartTime>0 and UTL.Time.GetServerTimestamp()>matchStartTime end function TeamFairChampionship_Controller.OpenMainPanel() if not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.TeamFairChampionship) or CTL.Activities.GetState(LuaConst.ActivityType.TeamFairChampionship) == CTL.Activities.ActivityState.End then CTL.Tips.AddTipsMsg(Const_IDS.IDS_Formation_RelationShip_Closed) return end CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.TeamFairChampionship_Start) if MDL.TeamFairChampionship.GetCurStageID() > MDL.TeamFairChampionship.Stage.Join then if not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UITeamFairChampionshipBase) then if not private.uiTeamFairChampionshipBaseVM then private.uiTeamFairChampionshipBaseVM = UITeamFairChampionshipBaseVM:new() end UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UITeamFairChampionshipBase, private.uiTeamFairChampionshipBaseVM) end else UIManager.OpenView(Const_UI_Lua.UIEnum.UIPushInterfaceTeamFairChampionship) end end --在比赛时间内 function TeamFairChampionship_Controller.IsInMatchingTime() if not TeamFairChampionship_Controller.IsInBattleStage() then return false end local curBigStageId = MDL.TeamFairChampionship.GetCurBigStageID() local MatchTime = DataSheetManager.TeamFairMatchTime:GetDataByID(curBigStageId) if UTL.Time.IsServerInOpeningTime(MatchTime.StartTime, MatchTime.EndTime) then return true else return false end end function TeamFairChampionship_Controller.OpenMatchNote() --报名阶段结束时间 local startDate, endDate = TeamFairChampionship_Controller.GetMatchStateTimeInfo(MDL.TeamFairChampionship.Enum_BigStage.Advance) local enterMatchTeamCount = MDL.TeamFairChampionship.GetEnterMatchTeamCount() local filterMatchGroupCount = MDL.TeamFairChampionship.GetMatchFilterGroupNum() local enterEachGroup = MDL.TeamFairChampionship.GetEnterEachGroup() UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id=LuaConst.NoteID.TeamFairChampionship, params={endDate,enterMatchTeamCount,filterMatchGroupCount,enterEachGroup}}) end --整个赛季比赛的时间 包括预告期 function TeamFairChampionship_Controller.GetTotalMatchTime() local matchStageStartTime = MDL.TeamFairChampionship.GetBigMatchStartTime(MDL.TeamFairChampionship.Enum_BigStage.Advance) local matchStageEndTime = MDL.TeamFairChampionship.GetBigMatchStartTime(MDL.TeamFairChampionship.Enum_BigStage.Finals) local bigMatchStageCfg = DataSheetManager.TeamFairMatchTime:GetDataByID(MDL.TeamFairChampionship.Enum_BigStage.Screening) local startDate = os.date(UTL.Time.FormatDateEnum.MD, matchStageStartTime) local endDate = os.date(UTL.Time.FormatDateEnum.MD, matchStageEndTime) local timetable = {StartTime= bigMatchStageCfg.StartTime, EndTime = bigMatchStageCfg.EndTime} return startDate, endDate, timetable end --整个赛季比赛的时间 不包括预告期 function TeamFairChampionship_Controller.GetTotalBattleTime() local matchStageStartTime = MDL.TeamFairChampionship.GetBigMatchStartTime(MDL.TeamFairChampionship.Enum_BigStage.Screening) local matchStageEndTime = MDL.TeamFairChampionship.GetBigMatchStartTime(MDL.TeamFairChampionship.Enum_BigStage.Finals) local bigMatchStageCfg = DataSheetManager.TeamFairMatchTime:GetDataByID(MDL.TeamFairChampionship.Enum_BigStage.Screening) local startDate = os.date(UTL.Time.FormatDateEnum.MD, matchStageStartTime) local endDate = os.date(UTL.Time.FormatDateEnum.MD, matchStageEndTime) local timetable = {StartTime= bigMatchStageCfg.StartTime, EndTime = bigMatchStageCfg.EndTime} return startDate, endDate, timetable end --比赛赛制的日期、结束日期以及比赛时间 function TeamFairChampionship_Controller.GetMatchStateTimeInfo(bigMatchStage) local bigMatchStageStartTime = MDL.TeamFairChampionship.GetBigMatchZeroStartTime(bigMatchStage) local bigMatchStageCfg = DataSheetManager.TeamFairMatchTime:GetDataByID(bigMatchStage) local timeCfg = DataSheetManager.TimeRefresh:GetDataByID(bigMatchStageCfg.EndTime) local startDate = nil--os.date("%m/%d %H:%M", bigMatchStageStartTime) local endDate = os.date(UTL.Time.FormatDateEnum.MDHM, bigMatchStageStartTime+bigMatchStageCfg.Day* UTL.Time.TotalSecondsOneDay+timeCfg.HMS) local timetable = nil--{StartTime= bigMatchStageCfg.StartTime, EndTime = bigMatchStageCfg.EndTime} return startDate, endDate, timetable end --比赛主界面,赛程持续时间 function TeamFairChampionship_Controller.GetBigMatchStageTime() local curMatchStageId = MDL.TeamFairChampionship.GetCurStageID() local stageCfg = DataSheetManager.TeamFairMatchStage:GetDataByID(curMatchStageId) local bigStageCfg = DataSheetManager.TeamFairMatchTime:GetDataByID(stageCfg.NowStage) if bigStageCfg.StartTime<=0 then return nil end local starTime = UTL.Time.GetDiffLocalStrById(bigStageCfg.StartTime) local endTime = UTL.Time.GetDiffLocalStrById(bigStageCfg.EndTime) local bigMatchStageStartTime = MDL.TeamFairChampionship.GetBigMatchStartTime(stageCfg.NowStage) local dayOffset = 0 if curMatchStageId == MDL.TeamFairChampionship.Stage.Filtration_2 then dayOffset = 1 end local month, day, hourMinute = UTL.Time.FormatTimeSimple(bigMatchStageStartTime + dayOffset * UTL.Time.TotalSecondsOneDay) return string.FormatByIdsId(Const_IDS.IDS_HeroMatch3v3_ActivityTime1, month, day, starTime, endTime) end function TeamFairChampionship_Controller.GetMatchStages() local returnStages = {} if MDL.TeamFairChampionship.GetMatchStageInfo(MDL.TeamFairChampionship.Stage.Filtration_2) then returnStages[1] = MDL.TeamFairChampionship.Stage.Filtration_2 else returnStages[1] = MDL.TeamFairChampionship.Stage.Filtration_1 end returnStages[2] = MDL.TeamFairChampionship.Stage.match_64T32 returnStages[3] = MDL.TeamFairChampionship.Stage.match_32T16 returnStages[4] = MDL.TeamFairChampionship.Stage.match_16T8 returnStages[5] = MDL.TeamFairChampionship.Stage.match_8T4 returnStages[6] = MDL.TeamFairChampionship.Stage.match_4T2 returnStages[7] = MDL.TeamFairChampionship.Stage.match_2T1 returnStages[8] = MDL.TeamFairChampionship.Stage.ShowHero return returnStages end function TeamFairChampionship_Controller.GetMyRankDesc() local ConfigStage = MDL.TeamFairChampionship.Stage local bestStage = MDL.TeamFairChampionship.GetMyHighestStage() if bestStage == ConfigStage.match_64T32 then return string.FormatByIdsId(Const_IDS["IDS_HeroMatch1v1_NowResult2"], 64) elseif bestStage == ConfigStage.match_32T16 then return string.FormatByIdsId(Const_IDS["IDS_HeroMatch1v1_NowResult2"], 32) elseif bestStage == ConfigStage.match_16T8 then return string.FormatByIdsId(Const_IDS["IDS_HeroMatch1v1_NowResult2"], 16) elseif bestStage == ConfigStage.match_8T4 then return string.FormatByIdsId(Const_IDS["IDS_HeroMatch1v1_NowResult2"], 8) elseif bestStage == ConfigStage.match_4T2 then return string.FormatByIdsId(Const_IDS["IDS_HeroMatch1v1_NowResult2"], 4) elseif bestStage == ConfigStage.match_2T1 then return UIUtils.GetLocalizedTxt(Const_IDS["IDS_HeroMatch1v1_NowResult3"]) elseif bestStage == ConfigStage.ShowHero then return UIUtils.GetLocalizedTxt(Const_IDS["IDS_HeroMatch1v1_NowResult4"]) elseif bestStage == ConfigStage.Filtration_2 then return string.FormatByIdsId(Const_IDS.IDS_FairTournament_RaceOneRank1, MDL.TeamFairChampionship.GetMyFilterGroupRank()) else return UIUtils.GetLocalizedTxt(Const_IDS["IDS_HeroMatch1v1_NoRaceRank"]) end end --获取竞猜次数 function TeamFairChampionship_Controller.GetMatchGuessingTimes() local curStageId = MDL.TeamFairChampionship.GetCurStageID() local curBigStageId = DataSheetManager.TeamFairMatchStage:GetDataByID(curStageId).NowStage local myMatchInfo = MDL.TeamFairChampionship.GetMyMatchInfo() local matchTimeCfg = DataSheetManager.TeamFairMatchTime:GetDataByID(curBigStageId) return matchTimeCfg.GuessTimes-myMatchInfo.serverInfo.battleBetNum, matchTimeCfg.GuessTimes end --活动开启后,获取距离活动结束的时间 function TeamFairChampionship_Controller.GetToadyTimeToClose() local curBigStageId = MDL.TeamFairChampionship.GetCurBigStageID() local teamFairMatchTimeCfg = DataSheetManager.TeamFairMatchTime:GetDataByID(curBigStageId) local closeTime = 0 local offsetTime = UTL.Time.GetServerIntervalTimeByTimeId(teamFairMatchTimeCfg.EndTime) if offsetTime > 0 then if closeTime == 0 then closeTime = offsetTime elseif closeTime > offsetTime then closeTime = offsetTime end end return closeTime end ------------------------------------小组赛---------------------------------------------------- --当前阶段是否筛选赛 function TeamFairChampionship_Controller.IsFilterMatchStage() local curStageId = MDL.TeamFairChampionship.GetCurStageID() return TeamFairChampionship_Controller.IsFilterMatchStageByStageId(curStageId) end function TeamFairChampionship_Controller.IsFilterMatchStageByStageId(stageId) if stageId==MDL.TeamFairChampionship.Stage.Filtration_1 then return true elseif stageId==MDL.TeamFairChampionship.Stage.Filtration_2 then return true end return false end function TeamFairChampionship_Controller.GetLastGroupSelectIndex() return private.lastGroupSelectIndex end function TeamFairChampionship_Controller.SetLastGroupSelectIndex(index) private.lastGroupSelectIndex = index end function TeamFairChampionship_Controller.GetTeamRecommandData(teamInfo) local returnTeamTempData = {isHasSameGuild=false,isHasSameServer=false,IsHasSameWarZone=false,isHasHotMatch=false} for __, acid in ipairs(teamInfo.memberAcids) do local playerInfo = MDL.TeamFairChampionship.GetPlayerInfoByACID(acid) if playerInfo then if MDL.Guild.IsSameGuild(playerInfo.guildId) then returnTeamTempData.isHasSameGuild=true end if playerInfo.MergeServerId==tonumber(MDL.Login.GetServerId()) then returnTeamTempData.isHasSameServer=true end if playerInfo.WarZoneId==MDL.ChannelChat.GetWarZoneId() then returnTeamTempData.IsHasSameWarZone=true end end end returnTeamTempData.isHasHotMatch=private.hotMatchTeamIds and private.hotMatchTeamIds[teamInfo.teamId] return returnTeamTempData end function private.GetRecommendSortNum(matchGroupInfo) local leftTeamInfo, rightTeamInfo = matchGroupInfo.teamInfos[1], matchGroupInfo.teamInfos[2] if string.isNilOrEmpty(leftTeamInfo.teamId) or string.isNilOrEmpty(rightTeamInfo.teamId) then return -1 end local myTeamId = MDL.TeamFairChampionship.GetMyTeamId() --自己 if leftTeamInfo.teamId == myTeamId or rightTeamInfo.teamId == myTeamId then return 1 end --小组赛竞猜过 if MDL.TeamFairChampionship.GetMatchGroupTeamBetInfo(MDL.TeamFairChampionship.Stage.Filtration_1, matchGroupInfo.matchGroupId, leftTeamInfo.teamId) then return 2 end if MDL.TeamFairChampionship.GetMatchGroupTeamBetInfo(MDL.TeamFairChampionship.Stage.Filtration_1, matchGroupInfo.matchGroupId, rightTeamInfo.teamId) then return 2 end local leftTeamTempData = TeamFairChampionship_Controller.GetTeamRecommandData(leftTeamInfo) local rightTeamTempData = TeamFairChampionship_Controller.GetTeamRecommandData(rightTeamInfo) if leftTeamTempData.isHasSameGuild or rightTeamTempData.isHasSameGuild then return 3 end if leftTeamTempData.isHasSameServer or rightTeamTempData.isHasSameServer then return 4 end if leftTeamTempData.IsHasSameWarZone or rightTeamTempData.IsHasSameWarZone then return 5 end if leftTeamTempData.isHasHotMatch or rightTeamTempData.isHasHotMatch then return 6 end return -1 end function private.SortByRecommendRule(groupInfo1, groupInfo2) local sortNum1 = private.GetRecommendSortNum(groupInfo1) local sortNum2 = private.GetRecommendSortNum(groupInfo2) if sortNum1 == sortNum2 then return groupInfo1.matchGroupId0 then table.insert(filterList, groupInfo) end elseif groupInfo.matchGroupId == targetGroupId then table.insert(filterList, groupInfo) end end if targetGroupId == 0 then table.sort(filterList, private.SortByRecommendRule) end end end function TeamFairChampionship_Controller.GetFilterBetLeftTime() local stageCfg = DataSheetManager.TeamFairMatchStage:GetDataByID(MDL.TeamFairChampionship.Stage.Filtration_2) local bigStageCfg = DataSheetManager.TeamFairMatchTime:GetDataByID(stageCfg.NowStage) local filterMatchZeroStartTime = MDL.TeamFairChampionship.GetBigMatchZeroStartTime(stageCfg.NowStage) return filterMatchZeroStartTime+UTL.Time.TotalSecondsOneDay+DataSheetManager.TimeRefresh:GetDataByID(bigStageCfg.StartTime).HMS-UTL.Time.GetServerTimestamp() end ---------------------------------------战斗匹配场-------------------------------------------- --获取小组赛可参加次数,最大次数 function TeamFairChampionship_Controller.GetFilterMatchCount() local stageInfo = MDL.TeamFairChampionship.GetMatchStageInfo(MDL.TeamFairChampionship.GetCurStageID()) local curRound = stageInfo.turn if MDL.TeamFairChampionship.GetCurStageID() == MDL.TeamFairChampionship.Stage.Filtration_1 then local maxTimes = DataSheetManager.ConstData:GetDataByID("TeamFairTournamentRace1BattleNum").IntValue if stageInfo.state == MDL.TeamFairChampionship.Enum_State.Finish then return maxTimes-curRound, maxTimes else return maxTimes-curRound+1, maxTimes end elseif MDL.TeamFairChampionship.GetCurStageID() == MDL.TeamFairChampionship.Stage.Filtration_2 then local maxTimes_1 = DataSheetManager.ConstData:GetDataByID("TeamFairTournamentRace1BattleNum").IntValue local maxTimes_2 = DataSheetManager.ConstData:GetDataByID("TeamFairTournamentRace2BattleNum").IntValue local curRound = curRound - maxTimes_1 if stageInfo.state == MDL.TeamFairChampionship.Enum_State.Finish then return maxTimes_2-curRound, maxTimes_2 else return maxTimes_2-curRound+1, maxTimes_2 end end end --匹配场景 function TeamFairChampionship_Controller.GetNonFilterMatchProgressDesc() local progressDesc, roundDesc = "", "" local curStageId = MDL.TeamFairChampionship.GetCurStageID() local curStageInfo = MDL.TeamFairChampionship.GetMatchStageInfo(curStageId) if curStageInfo and #curStageInfo.groupInfo > 0 then --这里加个判空,最后一轮结束时这里数据为空 local config = DataSheetManager.TeamFairMatchStage:GetDataByID(curStageId) local curTurn = curStageInfo.turn progressDesc = string.FormatByIdsId(Const_IDS[config.SceneDes], curTurn) if curTurn < 3 then roundDesc = string.FormatByIdsId(Const_IDS[config.SceneDes], curTurn + 1) else if curStageId == MDL.TeamFairChampionship.Stage.match_2T1 then roundDesc = UIUtils.GetLocalizedTxt(Const_IDS[config.SceneNextDes]) else roundDesc = string.FormatByIdsId(Const_IDS[config.SceneNextDes], 1) end end end return progressDesc, roundDesc end function TeamFairChampionship_Controller.GetBattleStageDisplayInfo() local curStageId = MDL.TeamFairChampionship.GetCurStageID() local curStageInfo = MDL.TeamFairChampionship.GetMatchStageInfo(curStageId) if not curStageInfo then return 0, "IDS_HeroMatch1v1_SkipBattleTime" end local leftTime = math.max(curStageInfo.stateEndTime - UTL.Time.GetServerTimestamp(), 0) if curStageInfo.state == MDL.TeamFairChampionship.Enum_State.Roll or curStageInfo.state == MDL.TeamFairChampionship.Enum_State.BanPick or curStageInfo.state == MDL.TeamFairChampionship.Enum_State.Battle then local matchTimeCfg = DataSheetManager.TeamFairMatchTime:GetDataByID(MDL.TeamFairChampionship.GetCurBigStageID()) if curStageInfo.state == MDL.TeamFairChampionship.Enum_State.Roll then leftTime = leftTime + matchTimeCfg.BanHeroTime + matchTimeCfg.ChooseHeroTime + matchTimeCfg.ChangeHeroPlace + matchTimeCfg.WaitBattle + matchTimeCfg.BattleTime elseif curStageInfo.state == MDL.TeamFairChampionship.Enum_State.BanPick then leftTime = leftTime + matchTimeCfg.BattleTime end return leftTime, "IDS_HeroMatch1v1_SkipBattleTime" else return leftTime, "IDS_HeroMatch1v1_MatchingTime" end end --------------------------------------竞猜和观战----------------------------------------------------- --请求观战 function TeamFairChampionship_Controller.TryWatchBattle(watchStageId, groupInfo, teamId) local curStageId = MDL.TeamFairChampionship.GetCurStageID() if watchStageId ~= curStageId then CTL.Tips.AddTipsMsg(Const_IDS["IDS_FairTournament_WatchOver"]) return end if not BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.TeamFairChampionshipTown) then CTL.Tips.AddTipsMsg(Const_IDS["IDS_FairTournament_WatchScene"]) return end local curStageInfo = MDL.TeamFairChampionship.GetMatchStageInfo(curStageId) if curStageInfo.state == MDL.TeamFairChampionship.Enum_State.Finish or groupInfo.isBattleEnd then CTL.Tips.AddTipsMsg(Const_IDS["IDS_FairTournament_WatchDone"]) return end if curStageInfo.state ~= MDL.TeamFairChampionship.Enum_State.BanPick and curStageInfo.state ~= MDL.TeamFairChampionship.Enum_State.Battle then CTL.Tips.AddTipsMsg(Const_IDS["IDS_FairTournament_OutWatchTime"]) return end MDL.TeamFairChampionship.SetWatchParam(watchStageId, groupInfo.matchGroupId, groupInfo.groupId, teamId) if curStageInfo.state == MDL.TeamFairChampionship.Enum_State.BanPick then MDL.TeamFairChampionship.TeamFairBPWatchReq(true, teamId) else MDL.TeamFairChampionship.TeamFairGetWatchBattleInfoReq(teamId, false) end end function TeamFairChampionship_Controller.ParseBetRate(multiplier) return tonumber(string.format("%.2f", multiplier)) end function TeamFairChampionship_Controller.OpenBetKeyBoard(matchGroupId, groupId, teamInfo, betStageId, round) local curStageId = MDL.TeamFairChampionship.GetCurStageID() if betStageId ~= curStageId then CTL.Tips.AddTipsMsg(Const_IDS["IDS_FairTournament_PickDone"]) return end local curStageInfo = MDL.TeamFairChampionship.GetMatchStageInfo(curStageId) if TeamFairChampionship_Controller.IsFilterMatchStage() then if curStageId == MDL.TeamFairChampionship.Stage.Filtration_2 then if curStageInfo.state ~= MDL.TeamFairChampionship.Enum_State.Ready then CTL.Tips.AddTipsMsg(Const_IDS["IDS_FairTournament_RaceOneOverPick"]) return elseif UTL.Time.GetServerTimestamp()>=curStageInfo.stateStartTime then CTL.Tips.AddTipsMsg(Const_IDS["IDS_FairTournament_RaceOneOverPick"]) return end end else if curStageInfo.state >= MDL.TeamFairChampionship.Enum_State.Roll or round>1 then CTL.Tips.AddTipsMsg(Const_IDS["IDS_FairTournament_OutPickTime"]) return end end --竞猜次数判断 local guessInfo = MDL.TeamFairChampionship.GetMatchGroupTeamBetInfo(betStageId, matchGroupId, teamInfo.teamId) --有竞猜信息,表示是追投 if not guessInfo then if MDL.TeamFairChampionship.GetMatchGroupTeamBetInfo(betStageId, matchGroupId, groupId) then CTL.Tips.AddTipsMsg(Const_IDS["IDS_FairTournament_NotPickOther"]) return end local leftBetCount, maxBetCount = TeamFairChampionship_Controller.GetMatchGuessingTimes() if leftBetCount<=0 then CTL.Tips.AddTipsMsg(Const_IDS["IDS_FairTournament_NoPickNum"]) return end end local hasBetNum = guessInfo and guessInfo.betNum or 0 local showInfo = MDL.FairSoloTournament.GetPlayerShowInfo(teamId) local betContext = { betRate=TeamFairChampionship_Controller.ParseBetRate(teamInfo.Multiplier), hasBetNum=hasBetNum, playerName=teamInfo.teamName, stageId=curStageId, matchGroupId=matchGroupId, groupId=groupId, acid=teamInfo.teamId } UIManager.OpenView(Const_UI_Lua.UIEnum.UITeamFairChampionshipKeyBoard, betContext) end --队伍详细信息,这个系统,都已经知道队伍内容了,直接客户端模拟数据即可 function TeamFairChampionship_Controller.OpenMatchTeamDetailPanel(teamInfo) local context = { teamName = teamInfo.teamName, members = {}, } for index, acid in ipairs(teamInfo.memberAcids) do context.members[index] = { memberId = acid, playerShowInfo = MDL.TeamFairChampionship.GetPlayerInfoByACID(acid) } end UIManager.OpenView(Const_UI_Lua.UIEnum.UITeamFairChampionshipTeamInfo, context, Const_UI_Lua.UIEnum.UIHeroMatch3v3TeamInfo) end function TeamFairChampionship_Controller.RefreshTaskRed() local taskInfoArray = MDL.TeamFairChampionship.GetTaskInfo() local hasRed = false if taskInfoArray then for i, v in ipairs(taskInfoArray) do if v.state == 1 then hasRed = true break end end end TeamFairChampionship_Controller.SetTaskRed(hasRed) end function TeamFairChampionship_Controller.SetTaskRed(hasRed) if not TeamFairChampionship_Controller.IsInBattleStage() then return end if hasRed then CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.TeamFairChampionship_Task_CanGet) else CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.TeamFairChampionship_Task_CanGet) end TeamFairChampionship_Controller.AddTaskClickRedPoint() end function TeamFairChampionship_Controller.OpenActivityTaskView(filterGroupSelectIndex) EventSystem.Dispatch(EventID.UI_TeamFairChampionship_ChangeGroupSelect, filterGroupSelectIndex) end local TeamFairChampionshipTaskClick = "TeamFairChampionshipTaskClick" function TeamFairChampionship_Controller.AddTaskClickRedPoint() local curMatchStageId = MDL.TeamFairChampionship.GetCurBigStageID() if curMatchStageId == MDL.TeamFairChampionship.Enum_BigStage.Advance or curMatchStageId == MDL.TeamFairChampionship.Enum_BigStage.Display then return end local timeValue = PersistentData.PlayerData:Get(TeamFairChampionshipTaskClick, 0) if timeValue > 0 and UTL.Time.IsTimestampCrossDay(timeValue) then PersistentData.PlayerData:Remove(TeamFairChampionshipTaskClick) timeValue = 0 end if timeValue <= 0 then CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.TeamFairChampionship_Task_Click) end end function TeamFairChampionship_Controller.RemoveTaskClickRedPoint() PersistentData.PlayerData:Set(TeamFairChampionshipTaskClick, UTL.Time.GetServerTimestamp(), true) CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.TeamFairChampionship_Task_Click) end return TeamFairChampionship_Controller