private void Process_Response_Local( CPersistenceRequest request, CPersistenceResponse response ) { switch ( response.RequestType ) { case EPersistenceRequestType.Get_Player_Data: CGetPlayerDataPersistenceRequest get_data_request = request as CGetPlayerDataPersistenceRequest; CGetPlayerDataPersistenceResponse get_data_response = response as CGetPlayerDataPersistenceResponse; if ( get_data_response.PlayerData != null ) { Register_Known_Player( get_data_request.PlayerName, get_data_response.PlayerData.ID ); Register_Player_Data( get_data_response.PlayerData ); } break; case EPersistenceRequestType.Get_Player_ID: CGetPlayerIDPersistenceRequest get_id_request = request as CGetPlayerIDPersistenceRequest; CGetPlayerIDPersistenceResponse get_id_response = response as CGetPlayerIDPersistenceResponse; if ( get_id_response.PlayerID != EPersistenceID.Invalid ) { Register_Known_Player( get_id_request.PlayerName, get_id_response.PlayerID ); } break; case EPersistenceRequestType.Add_Ignored_Player: CAddIgnoredPlayerPersistenceRequest add_ignore_request = request as CAddIgnoredPlayerPersistenceRequest; CAddIgnoredPlayerPersistenceResponse add_ignore_response = response as CAddIgnoredPlayerPersistenceResponse; if ( add_ignore_response.Error == EPersistenceError.None && add_ignore_response.Result == EIgnorePlayerResult.Success ) { CPersistentPlayerData add_player_data = Get_Player_Data( add_ignore_request.SourcePlayer ); if ( add_player_data != null ) { add_player_data.IgnoreList.Add( add_ignore_response.IgnoredPlayerID ); } } break; case EPersistenceRequestType.Remove_Ignored_Player: CRemoveIgnoredPlayerPersistenceRequest remove_ignore_request = request as CRemoveIgnoredPlayerPersistenceRequest; CRemoveIgnoredPlayerPersistenceResponse remove_ignore_response = response as CRemoveIgnoredPlayerPersistenceResponse; if ( remove_ignore_response.Error == EPersistenceError.None && remove_ignore_response.Result == EUnignorePlayerResult.Success ) { CPersistentPlayerData remove_player_data = Get_Player_Data( remove_ignore_request.SourcePlayer ); if ( remove_player_data != null ) { remove_player_data.IgnoreList.Remove( remove_ignore_response.IgnoredPlayerID ); } } break; } }
// Methods // Public interface public void Submit_Request( CPersistenceRequest request ) { request.RequestID = Allocate_Request_ID(); m_UnprocessedRequests.Add( request ); }
private void Process_Request_Local( CPersistenceRequest request ) { m_PendingRequests.Add( request.RequestID, request ); CPersistenceResponse response = null; switch ( request.RequestType ) { case EPersistenceRequestType.Get_Player_Data: response = Handle_Get_Player_Data_Request_Locally( request as CGetPlayerDataPersistenceRequest ); break; case EPersistenceRequestType.Get_Player_ID: response = Handle_Get_Player_ID_Request_Locally( request as CGetPlayerIDPersistenceRequest ); break; case EPersistenceRequestType.Add_Ignored_Player: case EPersistenceRequestType.Remove_Ignored_Player: break; } if ( response == null ) { CServerLogicalThread.Instance.Submit_Persistence_Request( request ); } else { m_UnprocessedResponses.Add( response ); } }
public void Submit_Persistence_Request( CPersistenceRequest request ) { m_CurrentPersistenceFrame.Add_Request( request ); }