private void OnConfirmExit(GameObject go)
 {
     GameSystem.Instance.mClient.pause = false;
     LuaInterface.LuaTable table = LuaScriptMgr.Instance.lua.NewTable();
     table.Set("uiBack", (object)"UIHall");
     LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { "UIPracticeCourt", null, table });
 }
示例#2
0
    private void ExitMatch()
    {
        PlatNetwork.Instance.onReconnected -= ExitMatch;

        GameMatch curMatch = GameSystem.Instance.mClient.mCurMatch;

        GameMatch.LeagueType type = curMatch.leagueType;
        if (type == GameMatch.LeagueType.eCareer)
        {
            EndSectionMatch career = new EndSectionMatch();
            career.session_id = curMatch.m_config.session_id;

            ExitGameReq req = new ExitGameReq();
            req.acc_id    = MainPlayer.Instance.AccountID;
            req.type      = MatchType.MT_CAREER;
            req.exit_type = ExitMatchType.EMT_OPTION;
            req.career    = career;
            GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID);
            GameSystem.Instance.mClient.mUIManager.curLeagueType = curMatch.leagueType;
        }
        else if (type == GameMatch.LeagueType.ePractise1vs1)
        {
            EndPracticePve endPracticePve = new EndPracticePve();
            endPracticePve.session_id     = curMatch.m_config.session_id;
            endPracticePve.main_role_side = 0;                          //Ö÷¶ÓOr¿Í¶Ó
            endPracticePve.score_home     = (uint)curMatch.m_homeScore; //Ö÷¶ÓµÃ·Ö
            endPracticePve.score_away     = (uint)curMatch.m_awayScore; //¿Í¶ÓµÃ·Ö

            ExitGameReq req = new ExitGameReq();
            req.acc_id       = MainPlayer.Instance.AccountID;
            req.type         = MatchType.MT_PRACTICE_1V1;
            req.exit_type    = ExitMatchType.EMT_OPTION;
            req.practice_pve = endPracticePve;
            GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID);
            GameSystem.Instance.mClient.mUIManager.curLeagueType = curMatch.leagueType;
        }
        else if (type == GameMatch.LeagueType.eQualifying)
        {
            QualifyingEndReq qualifying = new QualifyingEndReq();
            qualifying.session_id = curMatch.m_config.session_id;
            qualifying.type       = MatchType.MT_QUALIFYING;

            ExitGameReq req = new ExitGameReq();
            req.acc_id     = MainPlayer.Instance.AccountID;
            req.type       = MatchType.MT_QUALIFYING;
            req.exit_type  = ExitMatchType.EMT_OPTION;
            req.qualifying = qualifying;
            GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID);
            GameSystem.Instance.mClient.mUIManager.curLeagueType = curMatch.leagueType;
        }
        else if (type == GameMatch.LeagueType.eTour)
        {
            //TourExitReq req = new TourExitReq();
            //req.session_id = curMatch.m_config.session_id;
            TourEndReq tour = new TourEndReq();
            tour.session_id = curMatch.m_config.session_id;
            ExitGameReq req = new ExitGameReq();
            req.acc_id    = MainPlayer.Instance.AccountID;
            req.type      = MatchType.MT_TOUR;
            req.exit_type = ExitMatchType.EMT_OPTION;
            req.tour      = tour;
            GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID);
            MainPlayer.Instance.TourFailTimes++;
            LuaInterface.LuaTable table = LuaScriptMgr.Instance.lua.NewTable();
            table.Set("uiBack", (object)"UICompetition");
            LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { curMatch.leagueType, null, table });
        }
        else if (type == GameMatch.LeagueType.ePVP)
        {
            ExitGameReq req = new ExitGameReq();
            req.acc_id    = MainPlayer.Instance.AccountID;
            req.type      = GameMatch_PVP.ToMatchType(curMatch.leagueType, curMatch.m_config.type);
            req.exit_type = ExitMatchType.EMT_OPTION;

            if (GameSystem.Instance.mNetworkManager.m_gameConn != null)
            {
                Debug.Log("send exit game req");
                GameSystem.Instance.mNetworkManager.m_gameConn.SendPack(0, req, MsgID.ExitGameReqID);
            }

            GameSystem.Instance.mClient.mUIManager.curLeagueType = curMatch.leagueType;
            LuaInterface.LuaTable table = LuaScriptMgr.Instance.lua.NewTable();
            if (req.type == MatchType.MT_PVP_1V1_PLUS)
            {
                if (GameSystem.Instance.mNetworkManager.m_gameConn == null)
                {
                    table.Set("uiBack", (object)"UIPVPEntrance");
                    LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { "UI1V1Plus", null, table });
                }
            }
            else if (req.type == MatchType.MT_PVP_3V3)
            {
                table.Set("nextShowUI", (object)"UIPVPEntrance");
                LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { "UIChallenge", null, table });
            }
        }
        else if (type == GameMatch.LeagueType.eRegular1V1)
        {
            ExitGameReq req = new ExitGameReq();
            req.acc_id             = MainPlayer.Instance.AccountID;
            req.type               = MatchType.MT_REGULAR_RACE;
            req.exit_type          = ExitMatchType.EMT_OPTION;
            req.regular            = new PVPEndRegularReq();
            req.regular.session_id = curMatch.m_config.session_id;

            if (curMatch.GetMatchType() == GameMatch.Type.ePVP_1PLUS)
            {
                if (GameSystem.Instance.mNetworkManager.m_gameConn != null)
                {
                    Debug.Log("send exit game req to game server");
                    GameSystem.Instance.mNetworkManager.m_gameConn.SendPack(0, req, MsgID.ExitGameReqID);
                }
            }
            else if (curMatch.GetMatchType() == GameMatch.Type.eAsynPVP3On3)
            {
                req.regular.rival_score = (curMatch as GameMatch_AsynPVP3ON3).GetRivalScore();
                GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID);
            }
            else
            {
                Debug.Log("send exit game req to plat server");
                GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID);
            }
        }
        else if (type == GameMatch.LeagueType.eQualifyingNew)
        {
            ExitGameReq req = new ExitGameReq();
            req.acc_id                    = MainPlayer.Instance.AccountID;
            req.type                      = MatchType.MT_QUALIFYING_NEW;
            req.exit_type                 = ExitMatchType.EMT_OPTION;
            req.qualifying_new            = new PVPEndQualifyingReq();
            req.qualifying_new.session_id = curMatch.m_config.session_id;

            if (curMatch.GetMatchType() == GameMatch.Type.ePVP_1PLUS)
            {
                if (GameSystem.Instance.mNetworkManager.m_gameConn != null)
                {
                    Debug.Log("send exit game req to game server");
                    GameSystem.Instance.mNetworkManager.m_gameConn.SendPack(0, req, MsgID.ExitGameReqID);
                }
            }
            else if (curMatch.GetMatchType() == GameMatch.Type.eAsynPVP3On3)
            {
                req.qualifying_new.rival_score = (curMatch as GameMatch_AsynPVP3ON3).GetRivalScore();
                GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID);
            }
            else
            {
                Debug.Log("send exit game req to plat server");
                GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID);
            }
        }
        else if (type == GameMatch.LeagueType.ePractise)
        {
            EndPractice practice = new EndPractice();
            practice.session_id = curMatch.m_config.session_id;

            ExitGameReq req = new ExitGameReq();
            req.acc_id    = MainPlayer.Instance.AccountID;
            req.type      = MatchType.MT_PRACTICE;
            req.exit_type = ExitMatchType.EMT_OPTION;
            req.practice  = practice;
            GameSystem.Instance.mNetworkManager.m_platConn.SendPack(0, req, MsgID.ExitGameReqID);
        }
        else if (type == GameMatch.LeagueType.eBullFight)
        {
            LuaInterface.LuaTable table = LuaScriptMgr.Instance.lua.NewTable();
            table.Set("uiBack", (object)"UICompetition");
            LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { curMatch.leagueType, null, table });
        }
        else
        {
            LuaInterface.LuaTable table = LuaScriptMgr.Instance.lua.NewTable();
            table.Set("uiBack", (object)"UICompetition");
            LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { curMatch.leagueType, null, table });
        }

        curMatch.m_stateMachine.m_curState.OnExit();
        GameSystem.Instance.mClient.pause = false;
    }
    private void ShowOffLine()
    {
        UIEventListener.VoidDelegate onConfirmExit = (GameObject go) =>
        {
            UIManager uiManager = GameSystem.Instance.mClient.mUIManager;
            GameMatch match     = GameSystem.Instance.mClient.mCurMatch;
            if (match.leagueType == GameMatch.LeagueType.eRegular1V1)
            {
                LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", "UIHall");
            }
            else if (match.leagueType == GameMatch.LeagueType.eQualifyingNew)
            {
                LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", "UIQualifyingNew");
            }
            else if (match.GetMatchType() == GameMatch.Type.ePVP_1PLUS)
            {
                LuaInterface.LuaTable table = LuaScriptMgr.Instance.lua.NewTable();
                table.Set("uiBack", (object)"UIPVPEntrance");
                table.Set("autoMatch", (object)true);
                LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { "UI1V1Plus", null, table });
            }
            else if (match.GetMatchType() == GameMatch.Type.ePVP_3On3)
            {
                LuaInterface.LuaTable table = LuaScriptMgr.Instance.lua.NewTable();
//				table.Set("nextShowUI", (object)"UIPVPEntrance");
//				table.Set("autoMatch", (object)true);
                LuaScriptMgr.Instance.CallLuaFunction("jumpToUI", new object[] { "UIHall", null, table });
            }
        };

        bool isNotify = false;

        if (!string.IsNullOrEmpty(pvpPlusEndResp.off_name))
        {
            CommonFunction.ShowPopupMsg(string.Format(CommonFunction.GetConstString("STR_PVP_DISCONNECT"), pvpPlusEndResp.off_name), UIManager.Instance.m_uiRootBasePanel.transform, onConfirmExit);
            isNotify = true;
        }
        else if (!string.IsNullOrEmpty(pvpExEndResp.off_name))
        {
            CommonFunction.ShowPopupMsg(string.Format(CommonFunction.GetConstString("STR_PVP_DISCONNECT"), pvpExEndResp.off_name), UIManager.Instance.m_uiRootBasePanel.transform, onConfirmExit);
            isNotify = true;
        }
        else if (!string.IsNullOrEmpty(qualifyingNewerResp.off_name))
        {
            CommonFunction.ShowPopupMsg(string.Format(CommonFunction.GetConstString("STR_PVP_DISCONNECT"), qualifyingNewerResp.off_name), UIManager.Instance.m_uiRootBasePanel.transform, onConfirmExit);
            isNotify = true;
        }
        else if (!string.IsNullOrEmpty(pvpRegularEndResp.off_name))
        {
            CommonFunction.ShowPopupMsg(string.Format(CommonFunction.GetConstString("STR_PVP_DISCONNECT"), pvpRegularEndResp.off_name), UIManager.Instance.m_uiRootBasePanel.transform, onConfirmExit);
            isNotify = true;
        }
        else if (!string.IsNullOrEmpty(pvpQualifyingEndResp.off_name))
        {
            CommonFunction.ShowPopupMsg(string.Format(CommonFunction.GetConstString("STR_PVP_DISCONNECT"), pvpQualifyingEndResp.off_name), UIManager.Instance.m_uiRootBasePanel.transform, onConfirmExit);
            isNotify = true;
        }

        if (MainPlayer.Instance.inPvpJoining)
        {
            CommonFunction.ShowPopupMsg(CommonFunction.GetConstString("GAME_OVER"), UIManager.Instance.m_uiRootBasePanel.transform, onConfirmExit);
            MainPlayer.Instance.inPvpJoining = false;
            isNotify = true;
        }

        if (!isNotify)
        {
            CommonFunction.ShowPopupMsg(string.Format(CommonFunction.GetConstString("STR_PVP_DISCONNECT"), ""), UIManager.Instance.m_uiRootBasePanel.transform, onConfirmExit);
        }
    }