Ejemplo n.º 1
0
        public static void InitializeGame(bool enableListeners)
        {
            Thread.CurrentThread.Name = "Main Game Worker";

            SayToServer("\nGame initializing:\n");

            SayToServer("\nStarting PHASE 1 \"Core Startup\" - Basic worldgen and prefab testing:\n");
            WorldMap.Generate();
            Prefabs.TestGenerationDatabase();
            SayToServer("PHASE 1 completed.\n");

            SayToServer("\nStarting PHASE 2 \"Plugin Startup\" - Run Mapper and Spawner Plugin Startup Procedures:\n");
            Plugins.LoadPlugins();
            Plugins.RunStartupPlugins();
            SayToServer("PHASE 2 completed.\n");

            SayToServer("\nStarting PHASE 3 \"Finalization\" - Syncing plugins w/ core (rehashing dictionaries), cleaning garbage, starting listener (if enabled):\n");
            WorldMap.PopulateLookupDictionary();
            GarbageCollect();
            if (enableListeners)
            {
                NetworkServer.CreateAsyncListener <NetworkClient>();
            }
            SayToServer("PHASE 3 completed.\n");

            SayToServer("\nGame has been initialized!\n\n");
            Running = true;

            RunGame(CancelToken);

            SayToServer("\nGame engine shutdown detected!\n\n");
            if (enableListeners)
            {
                NetworkServer.CloseAsyncListener();
            }
        }