public void Handle_Continue_Match_Request( CContinueMatchRequest request, EPersistenceID source_player ) { if ( !MatchState.Is_Player( source_player ) ) { CServerMessageRouter.Send_Message_To_Player( new CContinueMatchResponse( request.RequestID, EContinueMatchFailure.Not_A_Player ), source_player ); return; } if ( MatchState.State == EMatchInstanceState.Idle ) { CServerMessageRouter.Send_Message_To_Player( new CContinueMatchResponse( request.RequestID, EContinueMatchFailure.Match_Not_Halted ), source_player ); return; } if ( MatchState.State == EMatchInstanceState.Halted_End_Of_Match ) { CServerMessageRouter.Send_Message_To_Player( new CContinueMatchResponse( request.RequestID, EContinueMatchFailure.Match_Is_Over ), source_player ); return; } if ( MatchState.Get_Continue_State_For_Player( source_player ) != EMatchContinueState.None ) { CServerMessageRouter.Send_Message_To_Player( new CContinueMatchResponse( request.RequestID, EContinueMatchFailure.Cannot_Change_Previous_Commitment ), source_player ); return; } CServerMessageRouter.Send_Message_To_Player( new CContinueMatchResponse( request.RequestID, EContinueMatchFailure.None ), source_player ); EMatchContinueState continue_state = request.ShouldContinueMatch ? EMatchContinueState.Accepted : EMatchContinueState.Declined; MatchState.Set_Continue_State_For_Player( source_player, continue_state ); List< CAbstractMatchDelta > deltas = new List< CAbstractMatchDelta >(); deltas.Add( new CMatchState.CMatchContinueStateDelta( source_player, continue_state ) ); Send_Message_To_Members( new CMatchStateDeltaMessage( deltas ), EPersistenceID.Invalid ); EMatchContinueState collective_state = MatchState.Get_Collective_Ready_State(); switch ( collective_state ) { case EMatchContinueState.Declined: Halt_Match( EMatchInstanceState.Halted_End_Of_Match ); break; case EMatchContinueState.Accepted: Start_New_Game(); break; } }
private void Handle_Continue_Match_Request( CContinueMatchRequest request, EPersistenceID source_player ) { CConnectedPlayer player = CConnectedPlayerManager.Instance.Get_Player_By_Persistence_ID( source_player ); if ( player == null ) { return; } CServerMatchInstance match_instance = Get_Match_Instance( player.MatchID ); if ( match_instance == null ) { CServerMessageRouter.Send_Message_To_Player( new CContinueMatchResponse( request.RequestID, EContinueMatchFailure.Not_In_Match ), source_player ); return; } match_instance.Handle_Continue_Match_Request( request, source_player ); }