private void L2C_UserBack(MobaMessage msg) { OperationResponse operationResponse = msg.Param as OperationResponse; byte b = (byte)operationResponse.Parameters[0]; byte[] buffer = operationResponse.Parameters[1] as byte[]; PlayerState playerState = (PlayerState)b; PvpStateBase.LogState("receive L2C_UserBack " + playerState + " "); Singleton <PvpManager> .Instance.LoginInfo = null; Singleton <PvpManager> .Instance.ServerBattleRoomInfo = null; this.TargetState = PlayerState.Free; switch (playerState) { case PlayerState.Free: this.RecoverFinish(new PvpStateHome()); return; case PlayerState.CheckReady: ClientLogger.Error("Cannot be here anymore."); this.RecoverFinish(new PvpStateHome()); return; case PlayerState.SelectHore: { CtrlManager.CloseWindow(WindowID.PvpWaitView); InSelectAllInfo inSelectAllInfo = SerializeHelper.Deserialize <InSelectAllInfo>(buffer); Singleton <PvpManager> .Instance.SetBattleInfoWithoutJoinType(inSelectAllInfo.roomInfo.battleId); Singleton <PvpManager> .Instance.SetRoomInfo(inSelectAllInfo.roomInfo, inSelectAllInfo.newUid, inSelectAllInfo.playerInfos, null); PvpMatchMgr.Instance.SelectHeroTime = new DateTime?(DateTime.Now - TimeSpan.FromTicks(inSelectAllInfo.useTime)); this.RecoverViewsForSelectHero(); this.RecoverFinish(new PvpStateSelectHero()); return; } case PlayerState.Loading: { InBattleLobbyInfo inBattleLobbyInfo = SerializeHelper.Deserialize <InBattleLobbyInfo>(buffer); InBattleRoomInfo inBattleRoomInfo = SerializeHelper.Deserialize <InBattleRoomInfo>(inBattleLobbyInfo.InBattleRoomInfoBytes); this.RecoverFromLoadingState(inBattleRoomInfo.roomInfo, inBattleLobbyInfo.loginInfo, inBattleRoomInfo.playerInfos, false); this.TargetState = PlayerState.Loading; return; } case PlayerState.InFight: { InBattleLobbyInfo inBattleLobbyInfo2 = SerializeHelper.Deserialize <InBattleLobbyInfo>(buffer); InBattleRoomInfo inBattleRoomInfo2 = SerializeHelper.Deserialize <InBattleRoomInfo>(inBattleLobbyInfo2.InBattleRoomInfoBytes); this.RecoverFromLoadingState(inBattleRoomInfo2.roomInfo, inBattleLobbyInfo2.loginInfo, inBattleRoomInfo2.playerInfos, true); this.TargetState = PlayerState.InFight; return; } } ClientLogger.Warn("L2C_UserBack: unknown state " + playerState); }
private void L2C_LookFriendFight(MobaMessage msg) { this._roomId = 0; OperationResponse operationResponse = msg.Param as OperationResponse; string text = (string)operationResponse.Parameters[0]; PlayerState playerState = (PlayerState)((byte)operationResponse.Parameters[1]); byte[] buffer = (byte[])operationResponse.Parameters[2]; if (playerState == PlayerState.InFight || playerState == PlayerState.Loading) { InBattleLobbyInfo inBattleLobbyInfo = SerializeHelper.Deserialize <InBattleLobbyInfo>(buffer); if (inBattleLobbyInfo != null) { InBattleRoomInfo inBattleRoomInfo = SerializeHelper.Deserialize <InBattleRoomInfo>(inBattleLobbyInfo.InBattleRoomInfoBytes); this.SaveCurrentState(inBattleRoomInfo.roomInfo, inBattleLobbyInfo.loginInfo, inBattleRoomInfo.playerInfos); return; } } this.AlertAndGoHome("战斗已经结束"); }