--[[ 8进4界面 ]] local UIHeroMatch3v3Stage3 = UIViewClass() function UIHeroMatch3v3Stage3:OnOpened(context) self:RegistSystemEvent(EventID.UI_HeroMatch3v3_RefreshPlayerInfo, self.RefreshStage3) -- 刷新选手信息 self:RefreshStage3() end function UIHeroMatch3v3Stage3:RefreshPlayerInfo() self:RefreshStage3() end function UIHeroMatch3v3Stage3:OnButtonClicked(comp) for k, battle in ipairs(self.group_Battle) do for playerIndex, playerCell in ipairs(battle) do local groupInfo = self.winnerInfo.groupInfos[k] local teamInfo = groupInfo.teamInfos[playerIndex] if comp == playerCell.btn_LeftWatch then -- 左边观战 MDL.WatchBattle.WatchBattleRequest(teamInfo.groomId, MDL.WatchBattle.WatchBattleType.HeroMatch3v3, teamInfo.playerIds[1], MDL.HeroMatch3v3.GetCurStageID()) elseif comp == playerCell.btn_LeftGuess then -- 左边竞猜 MDL.HeroMatch3v3.HeroMatchBattleBetRequest(self.winnerInfo.stageId, groupInfo.groupId, teamInfo.teamId) elseif comp == playerCell.btn_RightWatch then -- 右边观战 MDL.WatchBattle.WatchBattleRequest(teamInfo.groomId, MDL.WatchBattle.WatchBattleType.HeroMatch3v3, teamInfo.playerIds[1], MDL.HeroMatch3v3.GetCurStageID()) elseif comp == playerCell.btn_RightGuess then -- 右边竞猜 MDL.HeroMatch3v3.HeroMatchBattleBetRequest(self.winnerInfo.stageId, groupInfo.groupId, teamInfo.teamId) elseif comp == playerCell.group_Player3v3.btn_TeamInfo then local teamId if playerIndex == 3 then local leftPlayerInfo = groupInfo.teamInfos[1] local rightPlayerInfo = groupInfo.teamInfos[2] local leftHavePlayerInfo, rightHavePlayerInfo = leftPlayerInfo.teamId ~= "", rightPlayerInfo.teamId ~= "" if leftHavePlayerInfo and rightHavePlayerInfo then local leftWin = leftPlayerInfo.winNum or 0 local rightWin = rightPlayerInfo.winNum or 0 if leftWin > rightWin then teamId = leftPlayerInfo.teamId else teamId = rightPlayerInfo.teamId end elseif leftHavePlayerInfo and not rightHavePlayerInfo then teamId = leftPlayerInfo.teamId elseif rightHavePlayerInfo and not leftHavePlayerInfo then teamId = rightPlayerInfo.teamId end else teamId = teamInfo.teamId end -- 打开队伍详情 MDL.HeroMatch3v3.GetHeroMatchTeamSimpleInfoRequest(teamId) end end end end function UIHeroMatch3v3Stage3:RefreshStage3() self.winnerInfo = MDL.HeroMatch3v3.GetMatchStageInfo(MDL.HeroMatch3v3.Stage.match_8T4) self.curTurn = self.winnerInfo.groupInfos[1].turn if self.winnerInfo.state == MDL.HeroMatch3v3.Enum_State.Finish then self.state_Round:SetState(3) else self.state_Round:SetState(self.curTurn - 1) end for k, v in ipairs(self.group_Battle) do CTL.HeroMatch3v3.SetBattleGroupPlayerInfo(v, self.group_Line[k], self.winnerInfo, self.winnerInfo.groupInfos[k], self.curTurn, k <= 2) end end return UIHeroMatch3v3Stage3