// constructors
 public CServerLobby( ELobbyID id, CLobbyConfig config, EPersistenceID creator )
     : base(id, config, creator)
 {
 }
 private bool Validate_Create_Request( CLobbyConfig config )
 {
     return true;
 }
        private CServerLobby Create_Lobby( EPersistenceID creator_id, CLobbyConfig config )
        {
            ELobbyID lobby_id = Allocate_Lobby_ID();
            CServerLobby lobby = new CServerLobby( lobby_id, config, creator_id );
            m_Lobbies.Add( lobby_id, lobby );
            m_LobbiesByCreator.Add( creator_id, lobby_id );

            return lobby;
        }
        // Methods
        // Public interface
        public void Initialize( ELobbyID id, CLobbyConfig config, DateTime creation_time, EPersistenceID creator, uint player_count, uint observer_count )
        {
            Config = config.Clone( false );

            ID = id;
            CreationTime = creation_time;
            Creator = creator;
            PlayerCount = player_count;
            ObserverCount = observer_count;
        }
		private static void Build_Browse_Lobby_Message_Samples( List< CNetworkMessage > message_list )
		{
			message_list.Add( new CStartBrowseLobbyRequest( EGameModeType.Two_Players, ELobbyMemberType.Player, true ) );

			CLobbyConfig lobby_config = new CLobbyConfig();
			lobby_config.Initialize( "Pimps", EGameModeType.Two_Players, false, "BigPimpin" );

			CStartBrowseLobbyResponse browse_response = new CStartBrowseLobbyResponse( EMessageRequestID.Invalid, EStartBrowseResult.Success );
			for ( int i = 0; i < 10; i++ )
			{
				CLobbySummary lobby_summary = new CLobbySummary();
				lobby_summary.Initialize( ELobbyID.Invalid, lobby_config, DateTime.Now, EPersistenceID.Invalid, 2, 2 );
				browse_response.Add_Summary( lobby_summary );
			}

			message_list.Add( browse_response );
			message_list.Add( new CEndBrowseLobbyMessage() );
			message_list.Add( new CBrowseNextLobbySetRequest() );
			message_list.Add( new CBrowsePreviousLobbySetRequest() );

			CCursorBrowseLobbyResponse cursor_response = new CCursorBrowseLobbyResponse( EMessageRequestID.Invalid, ECursorBrowseResult.Success );
			for ( int i = 0; i < 10; i++ )
			{
				CLobbySummary lobby_summary = new CLobbySummary();
				lobby_summary.Initialize( ELobbyID.Invalid, lobby_config, DateTime.Now, EPersistenceID.Invalid, 2, 2 );
				cursor_response.Add_Summary( lobby_summary );
			}

			message_list.Add( cursor_response );

			CLobbySummary summary = new CLobbySummary();
			summary.Initialize( ELobbyID.Invalid, lobby_config, DateTime.Now, EPersistenceID.Invalid, 1, 4 );
			message_list.Add( new CBrowseLobbyAddRemoveMessage( summary, ELobbyID.Invalid ) );

			CLobbySummaryDelta summary_delta = new CLobbySummaryDelta();
			summary_delta.Initialize( ELobbyID.Invalid, 4, 1 );
			message_list.Add( new CBrowseLobbyDeltaMessage( summary_delta ) );
		}
		private static void Build_Lobby_Message_Samples( List< CNetworkMessage > message_list )
		{
			CLobbyConfig lobby_config = new CLobbyConfig();
			lobby_config.Initialize( "SampleLobbyConfig", EGameModeType.Four_Players, true, "SamplePassword" );

			message_list.Add( new CCreateLobbyRequest( lobby_config ) );
			message_list.Add( new CCreateLobbyFailure( EMessageRequestID.Start, ECreateLobbyFailureReason.Invalid_Config_Data ) );

			CLobbyState lobby_state = new CLobbyState( (ELobbyID) 666, lobby_config, (EPersistenceID) 5 );
			for ( int i = 0; i < 4; i++ )
			{
				lobby_state.Members.Add( (EPersistenceID) i, new CLobbyMember( (EPersistenceID) i ) );
				lobby_state.PlayersBySlot.Add( (uint) i, (EPersistenceID) i );
			}

			for ( int i = 0; i < 2; i++ )
			{
				lobby_state.Members.Add( (EPersistenceID) (i + 4), new CLobbyMember( (EPersistenceID) (i + 4) ) );
				lobby_state.Observers.Add( (EPersistenceID) (i + 4) );
			}

			message_list.Add( new CCreateLobbySuccess( EMessageRequestID.Start, lobby_state ) );
			message_list.Add( new CJoinLobbyByPlayerRequest( "SomePlayerName", "SomePassword" ) );
			message_list.Add( new CJoinLobbyByIDRequest( (ELobbyID) 5 ) );
			message_list.Add( new CJoinLobbyFailure( EMessageRequestID.Start, EJoinLobbyFailureReason.Creator_Is_Ignoring_You ) );
			message_list.Add( new CJoinLobbySuccess( EMessageRequestID.Start, lobby_state ) );
			message_list.Add( new CLeaveLobbyRequest() );
			message_list.Add( new CLeaveLobbyResponse( EMessageRequestID.Start, ELeaveLobbyFailureReason.Creator_Cannot_Leave ) );

			message_list.Add( new CLobbyOperationMessage( new CLobbyMemberJoinedOperation( (EPersistenceID) 4, "LeavingPlayer", ELobbyMemberType.Player, 1 ) ) );
			message_list.Add( new CLobbyOperationMessage( new CLobbyMemberLeftOperation( (EPersistenceID) 4, ERemovedFromLobbyReason.Lobby_Destroyed_By_Creator ) ) );
			message_list.Add( new CLobbyOperationMessage( new CLobbyMemberMovedOperation( (EPersistenceID) 4, ELobbyMemberType.Player, 1 ) ) );
			message_list.Add( new CLobbyOperationMessage( new CLobbyMembersSwappedOperation( (EPersistenceID) 4, (EPersistenceID) 5 ) ) );
			message_list.Add( new CLobbyOperationMessage( new CLobbyMemberChangeStateOperation( (EPersistenceID) 4, ELobbyMemberState.Ready ) ) );
			message_list.Add( new CLobbyOperationMessage( new CLobbyPlayerBannedOperation( (EPersistenceID) 4 ) ) );
			message_list.Add( new CLobbyOperationMessage( new CLobbyPlayerUnbannedOperation( (EPersistenceID) 4 ) ) );

			message_list.Add( new CDestroyLobbyRequest() );
			message_list.Add( new CDestroyLobbyResponse( EMessageRequestID.Start, EDestroyLobbyFailureReason.Not_In_A_Lobby ) );

			message_list.Add( new CLobbyChangeMemberStateMessage( ELobbyMemberState.Disconnected ) );
			message_list.Add( new CKickPlayerFromLobbyRequest( "PlayerToKick" ) );
			message_list.Add( new CKickPlayerFromLobbyResponse( EMessageRequestID.Start, EKickPlayerFromLobbyError.Cannot_Kick_Self ) );
			message_list.Add( new CBanPlayerFromLobbyRequest( "PlayerToBan" ) );
			message_list.Add( new CBanPlayerFromLobbyResponse( EMessageRequestID.Start, EBanPlayerFromLobbyError.Not_Lobby_Creator ) );
			message_list.Add( new CUnbanPlayerFromLobbyRequest( "PlayerToUnban" ) );
			message_list.Add( new CUnbanPlayerFromLobbyResponse( EMessageRequestID.Start, EUnbanPlayerFromLobbyError.Player_Not_Banned ) );
			message_list.Add( new CUnbannedFromLobbyNotificationMessage( "UnbannedPlayer" ) );
			message_list.Add( new CMovePlayerInLobbyRequest( (EPersistenceID) 10, ELobbyMemberType.Player, 1 ) );
			message_list.Add( new CMovePlayerInLobbyResponse( EMessageRequestID.Start, EMovePlayerInLobbyError.Invalid_Move_Destination ) );
			message_list.Add( new CLobbyStartMatchRequest() );
			message_list.Add( new CLobbyStartMatchResponse( EMessageRequestID.Start, EStartMatchError.Not_Everyone_Ready ) );
		}
 // Construction
 public CCreateLobbyRequest( CLobbyConfig config )
     : base()
 {
     Config = config;
 }
        private void Handle_Create_Lobby_Command( CCreateLobbySlashCommand command )
        {
            CLobbyConfig config = new CLobbyConfig();
            config.Initialize( command.GameDescription, command.GameMode, command.AllowObservers, command.Password );

            CClientLogicalThread.Instance.Send_Message_To_Server( new CCreateLobbyRequest( config ) );
        }