void CreateServer_Click( EButton sender ) { if( string.IsNullOrEmpty( userName ) ) { SetInfo( "Invalid user name.", true ); return; } SetInfo( "Creating server...", false ); GameNetworkServer server = new GameNetworkServer( "NeoAxis Server", EngineVersionInformation.Version, 128, true ); int port = 56565; string error; if( !server.BeginListen( port, out error ) ) { SetInfo( "Error: " + error, true ); server.Dispose( "" ); return; } //create user for server server.UserManagementService.CreateServerUser( userName ); //close all windows foreach( EControl control in GameEngineApp.Instance.ControlManager.Controls ) control.SetShouldDetach(); //create lobby window MultiplayerLobbyWindow lobbyWindow = new MultiplayerLobbyWindow(); GameEngineApp.Instance.ControlManager.Controls.Add( lobbyWindow ); GameEngineApp.Instance.Server_OnCreateServer(); }
void Create() { if( GameNetworkServer.Instance != null ) { Log( "Error: Already created" ); return; } GameNetworkServer server = new GameNetworkServer( "NeoAxis Chat Server", EngineVersionInformation.Version, 128, false ); server.UserManagementService.AddUserEvent += UserManagementService_AddUserEvent; server.UserManagementService.RemoveUserEvent += UserManagementService_RemoveUserEvent; server.ChatService.ReceiveText += ChatService_ReceiveText; int port = 56565; string error; if( !server.BeginListen( port, out error ) ) { Log( "Error: " + error ); Destroy(); return; } Log( "Server has been created" ); Log( "Listening port {0}...", port ); buttonCreate.Enabled = false; buttonDestroy.Enabled = true; }
void Create() { if( GameNetworkServer.Instance != null ) { Log( "Error: Server already created" ); return; } string mapName = comboBoxMaps.SelectedItem as string; if( string.IsNullOrEmpty( mapName ) ) { Log( "Error: You should choose a start map" ); return; } GameNetworkServer server = new GameNetworkServer( "NeoAxis Game Server", EngineVersionInformation.Version, 128, true ); server.UserManagementService.AddUserEvent += UserManagementService_AddUserEvent; server.UserManagementService.RemoveUserEvent += UserManagementService_RemoveUserEvent; server.ChatService.ReceiveText += ChatService_ReceiveText; int port = 56565; string error; if( !server.BeginListen( port, out error ) ) { Log( "Error: " + error ); Destroy(); return; } Log( "Server has been created" ); Log( "Listening port {0}...", port ); buttonCreate.Enabled = false; buttonDestroy.Enabled = true; comboBoxMaps.Enabled = false; //load a map Log( "Loading map \"{0}\"...", mapName ); MapLoad( mapName ); }