Beispiel #1
0
        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;
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        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();
        }
Beispiel #5
0
        void Create()
        {
            if (GameNetworkServer.Instance != null)
            {
                Log("Error: Server already created");
                return;
            }

            //public GameNetworkServer(string serverName, string serverVersion, int maxConnections, string serverPassword,
            //bool entitySystemServiceEnabled)
            //: base(serverName, serverVersion, maxConnections)

            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;
            server.CustomMessagesService.ReceiveMessage += CustomMessagesService_ReceiveMessage;

            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;
            buttonMapLoad.Enabled = true;
        }
Beispiel #6
0
        private void Create()
        {
            if (GameNetworkServer.Instance != null)
            {
                Log("Error: Server already created");
                return;
            }

            if (serverName == "" || serverName == null)
            {
                Log("Set Server Name first, then we can add your server");
                return;
            }
            else
            {
                serverName = textServerName.Text.ToString();
            }

            if (PortTextBox.Text == "" || PortTextBox.Text == null)
            {
                Log("Invalid server port set, please set 1 to 65535");
                return;
            }
            else
            {
                port = int.Parse(PortTextBox.Text);
            }

            GameNetworkServer server = new GameNetworkServer(serverName,
                                                             EngineVersionInformation.Version, 128, serverPassword, true);

            server.UserManagementService.AddUserEvent    += UserManagementService_AddUserEvent;
            server.UserManagementService.RemoveUserEvent += UserManagementService_RemoveUserEvent;
            server.ChatService.ReceiveText += ChatService_ReceiveText;
            server.CustomMessagesService.ReceiveMessage += CustomMessagesService_ReceiveMessage;
            // server.CustomMessagesService.ReceiveMessage += SpawnInfo;

            string error;

            if (!server.BeginListen(port, out error))
            {
                Log("Error: " + error);
                Destroy();
                servercreated = false;
                maploaded     = false;
                return;
            }
            else
            {
                servercreated = true;
            }

            //load map at startup

            if (comboBoxMaps.SelectedItem != null)
            {
                //Create();

                string mapName = comboBoxMaps.SelectedItem as string;

                if (!MapLoad(mapName))
                {
                    return;
                }

                mapname = mapName;

                //if (makePrivate == false)
                //{
                //    Log("Server has been made public.");
                //}
                //else
                //{
                //    Log("Server has been set private.");
                //}

                SqlAdd();

                if (Program.AKsqlcon.State.ToString() == "Open")
                {
                    SQLCon.Text      = "Connection Active";;
                    SQLCon.BackColor = Color.LightGreen;
                }
                else
                {
                    SQLCon.Text      = "Connection Lost";;
                    SQLCon.BackColor = Color.Red;
                }
            }

            Log("Server has been created");
            Log("Listening port {0}...", port);

            buttonCreate.Enabled       = false;
            buttonDestroy.Enabled      = true;
            buttonMapLoad.Enabled      = true;
            checkPrivateServer.Enabled = false;
            ntbMapTime.Enabled         = false;
        }