Пример #1
0
        public GameManager(ModSettings modSettings)
        {
            ThreadUtil.Instantiate();

            FontManager.LoadFonts();
            TextureManager.LoadTextures();

            var packetManager        = new PacketManager();
            var serverKnightsManager = new ServerKnightsManager();

            var networkManager = new NetworkManager(packetManager, serverKnightsManager);

            serverKnightsManager._networkManager = networkManager;

            var clientGameSettings = new Settings.GameSettings();
            var serverGameSettings = modSettings.GameSettings ?? new Settings.GameSettings();

            var playerManager = new PlayerManager(networkManager, clientGameSettings, modSettings, serverKnightsManager);

            var animationManager =
                new AnimationManager(networkManager, playerManager, packetManager, clientGameSettings, serverKnightsManager);

            var mapManager = new MapManager(networkManager, clientGameSettings);

            var clientManager = new ClientManager(
                networkManager,
                playerManager,
                animationManager,
                mapManager,
                clientGameSettings,
                packetManager,
                serverKnightsManager
                );


            var serverManager = new ServerManager(networkManager, serverGameSettings, packetManager, serverKnightsManager);

            new UI.UIManager(
                serverManager,
                clientManager,
                clientGameSettings,
                serverGameSettings,
                modSettings
                );
        }
Пример #2
0
        /// <summary>
        /// Constructs this GameManager instance by instantiating all other necessary classes.
        /// </summary>
        /// <param name="modSettings">The loaded ModSettings instance or null if no such instance could be
        /// loaded.</param>
        public GameManager(ModSettings modSettings)
        {
            ThreadUtil.Instantiate();

            FontManager.LoadFonts();
            TextureManager.LoadTextures();

            var packetManager = new PacketManager();

            var netClient = new NetClient(packetManager);
            var netServer = new NetServer(packetManager);

            var clientGameSettings = new Settings.GameSettings();
            var serverGameSettings = modSettings.GameSettings ?? new Settings.GameSettings();

            var uiManager = new UiManager(
                clientGameSettings,
                modSettings,
                netClient
                );

            var serverManager = new ModServerManager(
                netServer,
                serverGameSettings,
                packetManager,
                uiManager
                );

            serverManager.Initialize();

            new ClientManager(
                netClient,
                serverManager,
                packetManager,
                uiManager,
                clientGameSettings,
                modSettings
                );
        }