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());
            }
        }
        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));
        }
示例#3
0
        private void SyncFightInfo(InBattleRuntimeInfo fightInfo)
        {
            if (Singleton <PvpManager> .Instance.LoadStatus != LoadSceneStatus.Finished)
            {
                return;
            }
            if (fightInfo == null)
            {
                this.TryStartObserving();
                PvpStateBase.LogState("no fight info");
                return;
            }
            RoomState roomState = (RoomState)fightInfo.roomState;

            PvpStateBase.LogState("roomstate " + roomState);
            switch (roomState)
            {
            case RoomState.Wait:
                this.TryStartObserving();
                break;

            case RoomState.Fighting:
            case RoomState.LogicStart:
                PvpProtocolTools.SyncFightInfo(fightInfo);
                this.TryStartObserving();
                PvpStateManager.Instance.ChangeState(new PvpStateStart(PvpStateCode.PvpStart));
                break;

            case RoomState.End:
                Singleton <PvpManager> .Instance.AbandonGame(PvpErrorCode.StateError);

                break;

            default:
                ClientLogger.Assert(false, "unknown roomstate " + roomState);
                break;
            }
        }