--[[ 队伍公平竞技,8进4 ]] local PlayerHeadCell3V3Helper = require "Modules.TeamFairChampionship.PlayerHeadCell3V3Helper" local UITeamFairChampionshipBaseStage03 = UIViewClass() function UITeamFairChampionshipBaseStage03:OnCreated() self.displayMatchStageId = -1 self.matchStageInfo = nil end function UITeamFairChampionshipBaseStage03: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) end end function UITeamFairChampionshipBaseStage03:OnRefreshStageInfo() if MDL.TeamFairChampionship.GetMatchStageInfo(self.displayMatchStageId) then self:RefreshStage(self.displayMatchStageId, 0) end end function UITeamFairChampionshipBaseStage03:OnGetPlayerInfoComplete() if MDL.TeamFairChampionship.GetMatchStageInfo(self.displayMatchStageId) then self:RefreshStage(self.displayMatchStageId, 0) end end function UITeamFairChampionshipBaseStage03:RefreshStage(stageId, myMatchGroupId) if stageId == self.displayMatchStageId then self.matchStageInfo = MDL.TeamFairChampionship.GetMatchStageInfo(self.displayMatchStageId) local matchTurn = self.matchStageInfo.turn if self.matchStageInfo.state == MDL.TeamFairChampionship.Enum_State.Finish then self.state_Round:SetState(3) else self.state_Round:SetState(matchTurn - 1) end for __, groupInfo in ipairs(self.matchStageInfo.groupInfo) do PlayerHeadCell3V3Helper.Set3V3MatchPlayerRankCellInit(2, groupInfo.matchGroupId, self.group_Battle[groupInfo.matchGroupId], self.group_Line[groupInfo.matchGroupId], groupInfo, self.matchStageInfo) end end end function UITeamFairChampionshipBaseStage03:OnButtonClicked(comp) for __, groupInfo in ipairs(self.matchStageInfo.groupInfo) do local teamGroupView = self.group_Battle[groupInfo.matchGroupId] for teamCellIndex, teamCell in ipairs(teamGroupView) do local teamInfo = groupInfo.teamInfos[teamCellIndex] if comp == teamCell.groupLeft.btn_Watch or comp == teamCell.groupRight.btn_Watch then CTL.TeamFairChampionship.TryWatchBattle(self.matchStageInfo.stageId, groupInfo, teamInfo.teamId) return elseif comp == teamCell.groupLeft.btn_Guess or comp == teamCell.groupLeft.btn_GuessMore then CTL.TeamFairChampionship.OpenBetKeyBoard(groupInfo.matchGroupId, groupInfo.groupId, teamInfo, self.matchStageInfo.stageId, self.matchStageInfo.turn) return elseif comp == teamCell.groupRight.btn_Guess or comp == teamCell.groupRight.btn_GuessMore then CTL.TeamFairChampionship.OpenBetKeyBoard(groupInfo.matchGroupId, groupInfo.groupId, teamInfo, self.matchStageInfo.stageId, self.matchStageInfo.turn) return elseif comp == teamCell.groupLeft.btn_TeamInfo or comp == teamCell.groupRight.btn_TeamInfo then if teamCellIndex == 3 then if groupInfo.teamInfos[1].winNum>groupInfo.teamInfos[2].winNum then CTL.TeamFairChampionship.OpenMatchTeamDetailPanel(groupInfo.teamInfos[1]) else CTL.TeamFairChampionship.OpenMatchTeamDetailPanel(groupInfo.teamInfos[2]) end else CTL.TeamFairChampionship.OpenMatchTeamDetailPanel(teamInfo) end return end end end end return UITeamFairChampionshipBaseStage03