Exemplo n.º 1
0
        private void P2C_QueryInFightInfo(MobaMessage msg)
        {
            InBattleRuntimeInfo probufMsg = msg.GetProbufMsg <InBattleRuntimeInfo>();

            PvpStateBase.LogState("receive P2C_QueryInFightInfo " + StringUtils.DumpObject(probufMsg));
            this.SyncFightInfo(probufMsg);
        }
Exemplo n.º 2
0
        protected override void P2C_LoginAsViewer(MobaMessage msg)
        {
            RetaMsg probufMsg = msg.GetProbufMsg <RetaMsg>();
            byte    retaCode  = probufMsg.retaCode;

            PvpStateBase.LogState("===>receive: P2C_LoginAsViewer:" + retaCode);
            if (retaCode == 0)
            {
                if (this._prevState == PvpStateCode.PveLoad)
                {
                    Singleton <PvpManager> .Instance.LoadPvpSceneBegin();

                    base.RecoverFinish(new PvpStateLoad());
                }
                else
                {
                    base.QueryPsPvpState();
                    base.RecoverFinish(new PvpStateStart(PvpStateCode.PvpStart));
                }
            }
            else
            {
                ClientLogger.Error("P2C_LoginAsViewer: failed for " + retaCode);
                Singleton <PvpManager> .Instance.AbandonGame(PvpErrorCode.UnknowError);
            }
        }
Exemplo n.º 3
0
        private void P2C_ViewerUpdate(MobaMessage msg)
        {
            ViewerInfo probufMsg = msg.GetProbufMsg <ViewerInfo>();
            int        count     = probufMsg.count;

            Singleton <PvpManager> .Instance.ObserverCount = count;
        }
        private void P2C_BackLoadingInfo(MobaMessage msg)
        {
            InLoadingRuntimeInfo probufMsg = msg.GetProbufMsg <InLoadingRuntimeInfo>();

            PvpStateBase.LogState("receive P2C_BackLoadingInfo  " + StringUtils.DumpObject(probufMsg));
            Singleton <PvpManager> .Instance.RoomInfo.UpdateAllLoadProgress(probufMsg.loadProcessDic);
        }
        private void P2C_QueryInFightInfo(MobaMessage msg)
        {
            InBattleRuntimeInfo probufMsg = msg.GetProbufMsg <InBattleRuntimeInfo>();

            PvpStateBase.LogState("receive P2C_QueryInFightInfo " + StringUtils.DumpObject(probufMsg));
            if (probufMsg == null)
            {
                PvpStateBase.LogState("no fight info");
            }
            else
            {
                GameManager.Instance.ReplayController.SaveReconnectSyncMsgForRecord(msg.Param);
                PvpProtocolTools.SyncFightInfo(probufMsg);
                if (probufMsg.roomState == 3)
                {
                    Singleton <PvpManager> .Instance.AbandonGame(PvpErrorCode.StateError);
                }
            }
            if (this.TargetState == PlayerState.InFight || probufMsg != null)
            {
                this.RecoverFinish(new PvpStateStart(PvpStateCode.PvpStart));
            }
            else
            {
                SendMsgManager.Instance.SendPvpMsg(PvpCode.C2P_LoadingOK, null);
                this.RecoverFinish(new PvpStateLoad());
            }
        }
Exemplo n.º 6
0
        private void P2C_LoadingOK(MobaMessage msg)
        {
            InBattleRuntimeInfo probufMsg = msg.GetProbufMsg <InBattleRuntimeInfo>();

            PvpStateBase.LogState("receive P2C_LoadingOK " + StringUtils.DumpObject(probufMsg));
            Singleton <PvpManager> .Instance.HasRecvLoadingOk = true;
            Singleton <PvpManager> .Instance.GameStartTime    = new DateTime?(DateTime.Now);
            this.OnAfterLoadOk(probufMsg);
        }
Exemplo n.º 7
0
        protected override void OnGetMsg(MobaMessage msg)
        {
            P2CCaption probufMsg = msg.GetProbufMsg <P2CCaption>();

            if (probufMsg != null)
            {
                string captionStr = probufMsg.captionStr;
                this.data.mQueue.Enqueue(captionStr);
            }
        }
        private void P2C_RefreshInFightInfo(MobaMessage msg)
        {
            PvpServer.LockScreen(false);
            InBattleRuntimeInfo probufMsg = msg.GetProbufMsg <InBattleRuntimeInfo>();

            PvpStateBase.LogState("receive P2C_RefreshInFightInfo  " + StringUtils.DumpObject(probufMsg));
            PvpProtocolTools.SyncFightInfo(probufMsg);
            if (probufMsg != null && probufMsg.roomState == 3)
            {
                Singleton <PvpManager> .Instance.AbandonGame(PvpErrorCode.StateError);
            }
            this.RecoverFinish(new PvpStateStart(PvpStateCode.PvpStart));
        }
Exemplo n.º 9
0
        private void OnBattleEnd(MobaMessage msg)
        {
            P2CBattleEndInfo probufMsg = msg.GetProbufMsg <P2CBattleEndInfo>();
            PvpTeamInfo      teamInfo  = probufMsg.teamInfo;

            Singleton <PvpManager> .Instance.RoomInfo.WinTeam      = new TeamType?(PvpProtocolTools.GroupToTeam((int)probufMsg.winGroup));
            Singleton <PvpManager> .Instance.RoomInfo.BattleResult = teamInfo;
            this.OnAfterBattleEnd(probufMsg);
            AutoTestController.InvokeTestLogic(AutoTestTag.LeavePvp, delegate
            {
                PvpUtils.GoHome();
            }, 1f);
        }
Exemplo n.º 10
0
        private void P2C_VoteSurrender(MobaMessage msg)
        {
            SurrenderStartInfo probufMsg = msg.GetProbufMsg <SurrenderStartInfo>();

            if (Singleton <PvpManager> .Instance.IsObserver)
            {
                return;
            }
            if (probufMsg.code != 0)
            {
                this.ShowError((SurrenderErrorCode)probufMsg.code);
                return;
            }
            this.TryUpdateInfo(probufMsg.info);
        }
        private void P2C_Reconnect(MobaMessage msg)
        {
            PvpServer.LockScreen(false);
            RetaMsg      probufMsg    = msg.GetProbufMsg <RetaMsg>();
            byte         retaCode     = probufMsg.retaCode;
            PvpErrorCode pvpErrorCode = (PvpErrorCode)retaCode;

            PvpStateBase.LogState("receive P2C_Reconnect " + pvpErrorCode);
            if (pvpErrorCode != PvpErrorCode.OK)
            {
                NetWorkHelper.Instance.DisconnectPvpServer();
                PvpStateBase.LogState("P2C_Reconnect failed " + pvpErrorCode);
                this.ConfirmQuiting("游戏已经结束,戳确认退出", "游戏结束");
            }
        }
Exemplo n.º 12
0
        private void P2C_SurrenderTakeEffect(MobaMessage msg)
        {
            SurrenderStartInfo probufMsg = msg.GetProbufMsg <SurrenderStartInfo>();
            TeamType           teamType  = this.IsLm(probufMsg.info);

            if (teamType == Singleton <PvpManager> .Instance.SelfTeamType)
            {
                this.IsPassed    = true;
                this.HasAllVoted = true;
            }
            PromptHelper.PromptFormat("167", new object[]
            {
                PromptHelper.GetFriendlyText(teamType)
            });
            CtrlManager.CloseWindow(WindowID.SurrenderView);
        }
        private void C2P_LoginAsViewer(MobaMessage msg)
        {
            RetaMsg probufMsg = msg.GetProbufMsg <RetaMsg>();
            byte    retaCode  = probufMsg.retaCode;

            if (retaCode == 0)
            {
                Singleton <PvpManager> .Instance.LoadPvpSceneBegin();

                PvpStateManager.Instance.ChangeState(new PvpStateLoad());
            }
            else
            {
                ClientLogger.Error("C2P_LoginAsViewer: failed for " + retaCode);
                this.AlertAndGoHome("连接Pvp服务器失败");
            }
        }
        private void P2C_BackGame(MobaMessage msg)
        {
            PvpServer.LockScreen(false);
            RetaMsg      probufMsg    = msg.GetProbufMsg <RetaMsg>();
            byte         retaCode     = probufMsg.retaCode;
            PvpErrorCode pvpErrorCode = (PvpErrorCode)retaCode;

            PvpStateBase.LogState("receive P2C_BackGame " + pvpErrorCode);
            GameManager.Instance.ReConnected();
            Singleton <PvpManager> .Instance.LoadPvpSceneBegin();

            this.OnP2CBackGame(pvpErrorCode);
            if (pvpErrorCode != PvpErrorCode.OK)
            {
                Singleton <PvpManager> .Instance.AbandonGame(pvpErrorCode);
            }
        }
Exemplo n.º 15
0
        private void P2C_LoginFight(MobaMessage msg)
        {
            RetaMsg probufMsg = msg.GetProbufMsg <RetaMsg>();
            byte    retaCode  = probufMsg.retaCode;

            PvpStateBase.LogState("===>receive: P2C_LoginFight:" + retaCode);
            if (retaCode == 0)
            {
                Singleton <PvpManager> .Instance.LoadPvpSceneBegin();

                PvpStateManager.Instance.ChangeState(new PvpStateLoad());
            }
            else
            {
                ClientLogger.Error("P2C_LoginFight: 别怕,帮助@liuchen定位问题,failed for " + (PvpErrorCode)retaCode);
                CtrlManager.ShowMsgBox("错误", "服务器错误码" + retaCode, new Action(PvpUtils.GoHome), PopViewType.PopOneButton, "确定", "取消", null);
            }
        }
Exemplo n.º 16
0
        private void P2C_LoginAsViewer(MobaMessage msg)
        {
            RetaMsg probufMsg = msg.GetProbufMsg <RetaMsg>();
            byte    retaCode  = probufMsg.retaCode;

            PvpStateBase.LogState("===>receive: P2C_LoginAsViewer:" + retaCode);
            if (retaCode == 0)
            {
                Singleton <PvpManager> .Instance.LoadPvpSceneBegin();

                PvpStateManager.Instance.ChangeState(new PvpStateLoad());
            }
            else
            {
                ClientLogger.Error("P2C_LoginAsViewer: 别怕,帮助@汪洋定位问题,failed for " + retaCode);
                CtrlManager.ShowMsgBox("观战失败", "观战失败,游戏已经结束或者没有观战的权限", new Action(PvpUtils.GoHome), PopViewType.PopOneButton, "确定", "取消", null);
            }
        }
Exemplo n.º 17
0
        private void NewbieP2C_LoginFight(MobaMessage msg)
        {
            RetaMsg probufMsg = msg.GetProbufMsg <RetaMsg>();
            byte    retaCode  = probufMsg.retaCode;

            if (retaCode == 0)
            {
                NewbieManager.Instance.SetSpecialEnterBattleSuc();
                Singleton <PvpManager> .Instance.LoadPvpSceneBegin();

                PvpStateManager.Instance.ChangeState(new PvpStateLoad());
            }
            else
            {
                ClientLogger.Error("P2C_LoginFight: 别怕,帮助@汪洋定位问题,failed for " + retaCode);
                CtrlManager.ShowMsgBox("错误", "服务器错误码" + retaCode, new Action(PvpUtils.GoHome), PopViewType.PopOneButton, "确定", "取消", null);
            }
        }
        protected virtual void P2C_LoginAsViewer(MobaMessage msg)
        {
            PvpServer.LockScreen(false);
            RetaMsg probufMsg = msg.GetProbufMsg <RetaMsg>();
            byte    retaCode  = probufMsg.retaCode;

            PvpStateBase.LogState("===>receive: P2C_LoginAsViewer:" + retaCode);
            if (retaCode == 0)
            {
                Singleton <PvpManager> .Instance.LoadPvpSceneBegin();

                this.RecoverFinish(new PvpStateLoad());
            }
            else
            {
                ClientLogger.Error("P2C_LoginAsViewer: failed for " + retaCode);
                CtrlManager.ShowMsgBox("观战失败", "观战失败,游戏已经结束或者没有观战的权限", new Action(PvpUtils.GoHome), PopViewType.PopOneButton, "确定", "取消", null);
            }
        }
Exemplo n.º 19
0
        private void P2C_LoginPve(MobaMessage msg)
        {
            PveLoginRetaMsg probufMsg = msg.GetProbufMsg <PveLoginRetaMsg>();

            byte[] data     = probufMsg.data;
            byte   retaCode = probufMsg.retaCode;

            PvpStateBase.LogState("receive P2C_LoginPve " + retaCode);
            if (retaCode == 0)
            {
                PveBattlePreloadInfo pveBattlePreloadInfo = SerializeHelper.Deserialize <PveBattlePreloadInfo>(data);
                PvpStateBase.LogState("receive P2C_LoginPve ok" + StringUtils.DumpObject(pveBattlePreloadInfo));
                Singleton <PveManager> .Instance.SetBattleInfo(pveBattlePreloadInfo);

                Singleton <PvpManager> .Instance.SetRoomInfoOnServerPve(Singleton <PveManager> .Instance.MyLobbyUserId);

                Singleton <PveManager> .Instance.LoadPvpSceneBegin();
            }
        }
Exemplo n.º 20
0
        private void P2C_LoadProcess(MobaMessage msg)
        {
            Shader.WarmupAllShaders();
            C2PLoadProcess probufMsg = msg.GetProbufMsg <C2PLoadProcess>();
            int            newUid    = probufMsg.newUid;
            byte           process   = probufMsg.process;

            PvpStateBase.LogState(string.Concat(new object[]
            {
                "===>receive: P2C_LoadProcess:",
                newUid,
                " ",
                process
            }));
            HeroExtraInRoom heroExtraByUserId = Singleton <PvpManager> .Instance.RoomInfo.GetHeroExtraByUserId(newUid);

            if (heroExtraByUserId != null)
            {
                heroExtraByUserId.LoadProgress = (int)process;
            }
            MobaMessageManager.DispatchMsg(ClientC2C.PvpLoadProcess, new ParamLoadProcess(newUid, process));
        }
Exemplo n.º 21
0
        private void OnMsg_C2P_SellItem(MobaMessage msg)
        {
            P2CSellItem probufMsg = msg.GetProbufMsg <P2CSellItem>();

            this.OnEnd_SellItem(probufMsg);
        }
Exemplo n.º 22
0
        private void OnMsg_C2P_RevertShop(MobaMessage msg)
        {
            RetaMsg probufMsg = msg.GetProbufMsg <RetaMsg>();

            this.OnEnd_RevertShop(probufMsg);
        }