예제 #1
0
파일: Game.cs 프로젝트: Julyuary/paradox
        /// <summary>
        /// Initializes a new instance of the <see cref="Game"/> class.
        /// </summary>
        public Game()
        {
            // Register the logger backend before anything else
            logListener = GetLogListener();

            if (logListener != null)
                GlobalLogger.GlobalMessageLogged += logListener;

            // Create and register all core services
            Input = new InputManager(Services);
            Script = new ScriptSystem(Services);
            SceneSystem = new SceneSystem(Services);
            Audio = new AudioSystem(Services);
            UI = new UISystem(Services);
            gameFontSystem = new GameFontSystem(Services);
            SpriteAnimation = new SpriteAnimationSystem(Services);

            // ---------------------------------------------------------
            // Add common GameSystems - Adding order is important 
            // (Unless overriden by gameSystem.UpdateOrder)
            // ---------------------------------------------------------

            // Add the input manager
            GameSystems.Add(Input);

            // Add the scheduler system
            // - Must be after Input, so that scripts are able to get latest input
            // - Must be before Entities/Camera/Audio/UI, so that scripts can apply 
            // changes in the same frame they will be applied
            GameSystems.Add(Script);

            // Add the UI System
            GameSystems.Add(UI);

            // Add the Audio System
            GameSystems.Add(Audio);

            // Add the Font system
            GameSystems.Add(gameFontSystem);

            //Add the sprite animation System
            GameSystems.Add(SpriteAnimation);

            Asset.Serializer.LowLevelSerializerSelector = ParameterContainerExtensions.DefaultSceneSerializerSelector;

            // Creates the graphics device manager
            GraphicsDeviceManager = new GraphicsDeviceManager(this);

            AutoLoadDefaultSettings = true;
        }