コード例 #1
0
        /// <summary>
        /// The main start method that loads the controllers and prints information to the console
        /// </summary>
        public void Start()
        {
            String[] serverArgs = new String[]
            {
                "",
            };

            m_serverThread = ServerWrapper.HellionDedi.StartServer(serverArgs);

            m_serverWrapper.Init();

            Thread.Sleep(5000);

            m_server = ServerWrapper.HellionDedi.Server;

            if (IsRunning)
            {
                Console.WriteLine("Hellion Extended Server: World Initialized!");

                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                Thread.Sleep(1);
                stopwatch.Stop();
                long num = (long)(1000.0 / stopwatch.Elapsed.TotalMilliseconds);

                Console.WriteLine(string.Format("==============================================================================\r\n\tServer name: {5}\r\n\tServer ID: {1}\r\n\tStart date: {0}\r\n\tServer ticks: {2}{4}\r\n\tMax server ticks (not precise): {3}\r\n==============================================================================", (object)DateTime.UtcNow.ToString("yyyy/MM/dd HH:mm:ss.ffff"), (object)(Server.NetworkController.ServerID <= 0L ? "Not yet assigned" : string.Concat((object)Server.NetworkController.ServerID)), 64, (object)num, (object)(64 > num ? " WARNING: Server ticks is larger than max tick" : ""), (object)Server.ServerName));
            }

            new NetworkController(m_server.NetworkController);

            Console.WriteLine("Ready for connections!");

            HES.PrintHelp();
        }
コード例 #2
0
        /// <summary>
        /// The main start method that loads the controllers and prints information to the console
        /// </summary>
        public async void Start()
        {
            if (m_assembly == null)
            {
                Console.WriteLine($"HELLION_Dedicated.exe does not exist.\r\n Cannot start the server.");
                return;
            }

            if (Server.IsRunning)
            {
                return;
            }

            String[] serverArgs = new String[]
            {
                "",
            };

            await ServerWrapper.HellionDedi.StartServer(serverArgs);

            m_serverWrapper.Init();

            while (ServerWrapper.HellionDedi.Server == null)
            {
                await Task.Delay(25);
            }

            m_server = ServerWrapper.HellionDedi.Server;
            OnServerRunning?.Invoke(m_server);

            if (IsRunning)
            {
                Log.Instance.Info("Hellion Extended Server: World Initialized!");

                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                Thread.Sleep(1);
                stopwatch.Stop();
                long num = (long)(1000.0 / stopwatch.Elapsed.TotalMilliseconds);

                Console.WriteLine(string.Format(HES.Localization.Sentences["ServerDesc"], DateTime.UtcNow.ToString("yyyy/MM/dd HH:mm:ss.ffff"), (Server.NetworkController.ServerID <= 0L ? "Not yet assigned" : string.Concat(Server.NetworkController.ServerID)), 64, num, (64 > num ? " WARNING: Server ticks is larger than max tick" : ""), Server.ServerName));
            }

            Server.NetworkController.EventSystem.RemoveListener(typeof(TextChatMessage), new EventSystem.NetworkDataDelegate(Server.TextChatMessageListener)); //Deletes Old Listener
            Server.NetworkController.EventSystem.AddListener(typeof(TextChatMessage), new EventSystem.NetworkDataDelegate(this.TextChatMessageListener));      //Referances New Listener

            new NetworkManager(m_server.NetworkController);
            //Load Permission
            m_permissionmanager = new PermissionManager();
            //Load Events
            m_eventhelper = new EventHelper();
            //Load Commands
            m_commandManager = new CommandManager();
            //Load Plugins!
            m_pluginManager = new PluginManager();
            PluginManager.InitializeAllPlugins();
            //TODO load Server Event Listeners
            EventHelper.RegisterEvent(new EventListener(typeof(JoinEvent).GetMethod("PlayerSpawnRequest"), typeof(JoinEvent), EventID.PlayerSpawnRequest));
            //Command Listner

            Log.Instance.Info(HES.Localization.Sentences["ReadyForConnections"]);

            HES.PrintHelp();

            HES.KeyPressSimulator();
        }