public void Server_DestroyServer(string reason) { GameNetworkServer server = GameNetworkServer.Instance; if (server != null) { server.Dispose(reason); SuspendWorkingWhenApplicationIsNotActive = true; } }
private void CreateServer_Click(Button sender) { //if (string.IsNullOrEmpty(serverUserName)) if (string.IsNullOrEmpty(Program.username)) { SetInfo("Invalid user name.", true); return; } SetInfo("Creating server...", false); GameNetworkServer server = new GameNetworkServer(createServerName.ToString(), EngineVersionInformation.Version, 128, true); //int port = 229; string error; if (!server.BeginListen(createserverport, out error)) { SetInfo("Server Listen Error: " + error, true); server.Dispose(""); return; } //create user for server server.UserManagementService.CreateServerUser(Program.username); //close all windows foreach (Control 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 CreateServer_Click(Button 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 this window SetShouldDetach(); //create lobby window MultiplayerLobbyWindow lobbyWindow = new MultiplayerLobbyWindow(); GameEngineApp.Instance.ControlManager.Controls.Add(lobbyWindow); GameEngineApp.Instance.Server_OnCreateServer(); }