コード例 #1
0
        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());
            }
        }
コード例 #2
0
        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
ファイル: PvpStateBase.cs プロジェクト: whztt07/mobahero_src
        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);
        }
コード例 #4
0
 private void BattleEnd(MobaMessage msg)
 {
     if (LevelManager.m_CurLevel.battle_type == 9 || LevelManager.Instance.IsZyBattleType || LevelManager.m_CurLevel.battle_type == 2 || LevelManager.Instance.IsPvpBattleType)
     {
         TeamType teamType = (GameManager.FinalResult != TeamType.LM) ? TeamType.LM : TeamType.BL;
         Units    home     = MapManager.Instance.GetHome(teamType);
         if (home)
         {
             if (Singleton <PvpManager> .Instance.IsInPvp && home.isLive)
             {
                 PvpProtocolTools.ToDie(home, null, 100L);
             }
             this.SetRoleObj(home, false);
         }
     }
 }
コード例 #5
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;
            }
        }