Esempio n. 1
0
        /// <summary>
        /// Activates the loading screen.
        /// </summary>
        public static void Load(ScreenManager screenManager, bool loadingIsSlow,
                                PlayerIndex? controllingPlayer,
                                params GameScreen[] screensToLoad)
        {
            // Tell all the current screens to transition off.
            foreach (GameScreen screen in screenManager.GetScreens())
            {
                screen.ExitScreen();
            }

            // Create and activate the loading screen.
            var loadingScreen = new LoadingScreen(screenManager, loadingIsSlow, screensToLoad);
            screenManager.AddScreen(loadingScreen, controllingPlayer);
        }
Esempio n. 2
0
        private TetrisGame()
        {
            // ReSharper disable once ObjectCreationAsStatement
            new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth = Configuration.GetInstance().WindowWidth,
                PreferredBackBufferHeight = Configuration.GetInstance().WindowHeight,
                PreferMultiSampling = true,
                SynchronizeWithVerticalRetrace = true
            };
            IsMouseVisible = true;
            Content.RootDirectory = "Content";
            BackgroundColor = Defaults.Game.BackgroundColor;

            var screenManager = new ScreenManager(this) { TraceEnabled = false };
            screenManager.AddScreen(new BackgroundScreen(), null);
            screenManager.AddScreen(new MainMenuScreen(), null);
            Components.Add(screenManager);
            IsRunning = true;
        }
Esempio n. 3
0
 /// <summary>
 /// The constructor is private: loading screens should
 /// be activated via the static Load method instead.
 /// </summary>
 // ReSharper disable once UnusedParameter.Local
 private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow, GameScreen[] screensToLoad)
 {
     _loadingIsSlow = loadingIsSlow;
     _screensToLoad = screensToLoad;
     TransitionOnTime = TimeSpan.FromSeconds(0.5);
 }