Ejemplo n.º 1
0
        protected override void Initialize()
        {
            ViewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, GameConfig.VirtualResolution.X, GameConfig.VirtualResolution.Y);

            Camera       = new Camera(this, ViewportAdapter);
            MusicManager = new MusicManager();

            SpriteBatchManager.Initialize();

            base.Initialize();

            Pause = false;

            GameManager.Initialize();

            // Input manager
            Components.Add(new InputManager(this));

            // Animation and tweening
            var animationComponent = new AnimationComponent(this);

            Components.Add(animationComponent);
            Components.Add(new TweeningComponent(this, animationComponent));

            // GUI
            GuiManager = new GuiManager(this);

            PerformanceManager.Initialize();

            // Player data
#if ANDROID
            ISharedPreferences prefs = AndroidActivity.GetSharedPreferences("XmasHell", FileCreationMode.Private);
            var androidPreferences   = new AndroidPreferences(prefs);
            PlayerData = new PlayerData.PlayerData(androidPreferences);
#elif LINUX
            var desktopPreferences = new DesktopPreferences();
            PlayerData = new PlayerData.PlayerData(desktopPreferences);
#endif

            // Screens
            ScreenManager = new ScreenManager(this);

            if (GameConfig.DebugScreen)
            {
                ScreenManager.AddScreen(new DebugScreen(this));

                ScreenManager.GoTo <DebugScreen>();
            }
            else
            {
                ScreenManager.AddScreen(new MainMenuScreen(this));
                ScreenManager.AddScreen(new BossSelectionScreen(this));
                ScreenManager.AddScreen(new GameScreen(this));

                ScreenManager.GoTo <MainMenuScreen>();
            }
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public Task InitializeAsync(CancellationToken cancellationToken = default)
        {
            _logger.LogInformation("Initialization of performance monitoring service started...");

            _logger.LogInformation($"Initialization of {nameof(PerformanceManager)} started (using log with name {PerformanceLogName})...");

            var performanceLog = _loggerFactory.CreateLogger(PerformanceLogName);

            PerformanceManager.Initialize(performanceLog);

            _logger.LogInformation($"Initialization of {nameof(StuckCodeManager)} completed.");

            _logger.LogInformation($"Initialization of {nameof(StuckCodeManager)} started (using log with name {StuckCodeLogName})...");
            var stuckCodeLog = _loggerFactory.CreateLogger(StuckCodeLogName);

            StuckCodeManager.Initialize(stuckCodeLog);
            _logger.LogInformation($"Initialization of {nameof(StuckCodeManager)} completed.");

            _logger.LogInformation("Initialization of performance monitoring service completed.");

            return(Task.CompletedTask);
        }