/// <summary> /// Activates the loading screen. /// </summary> public static void Load(ScreenManager screenManager, bool loadingIsSlow, bool closeOtherWindows, string backgroundTexture, bool showText, float fadeBackBufferToWhiteAlpha, params GameScreen[] screensToLoad) { if (closeOtherWindows) { // Tell all the current screens to transition off. foreach (GameScreen screen in screenManager.GetScreens()) { screen.ExitScreen(); } } //screenManager.Game.Content.Unload(); // Create and activate the loading screen. var loadingScreen = new LoadingScreen(loadingIsSlow, screensToLoad) { _backgroundTexture = backgroundTexture, _showText = showText, _fadeBackBufferToWhiteAlpha = fadeBackBufferToWhiteAlpha }; if (!closeOtherWindows) { loadingScreen._otherScreensAreGone = true; } screenManager.AddScreen(loadingScreen); }
public static void Load(ScreenManager screenManager, bool loadingIsSlow, params GameScreen[] screensToLoad) { foreach (GameScreen screen in screenManager.GetScreens()) screen.ExitScreen(); LoadingScreen loadingScreen = new LoadingScreen(screenManager, loadingIsSlow, screensToLoad); screenManager.AddScreen(loadingScreen); }
/// <summary> /// Event handler for when the Play Game menu entry is selected. /// </summary> void PlayGameMenuEntrySelected(object sender, PlayerIndexEventArgs e) { // Tell all the current screens to transition off. foreach (GameScreen screen in ScreenManager.GetScreens()) { screen.ExitScreen(); } ScreenManager.AddScreen(new GameplayScreen(), e.PlayerIndex); }
public static void Load(ScreenManager screenManager, bool loadingIsSlow, PlayerIndex? controllingPlayer, params MainMenuScreen[] screensToLoad) { foreach (GameScreen screen in screenManager.GetScreens()) screen.ExitScreen(); SplashScreenLoading splashScreenLoading = new SplashScreenLoading(screenManager, loadingIsSlow, screensToLoad); screenManager.AddScreen(splashScreenLoading, controllingPlayer); }
/// <summary> /// Activates the loading screen. /// </summary> public static void Load(ScreenManager screenManager, bool loadingIsSlow, 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. LoadingScreen loadingScreen = new LoadingScreen(screenManager, loadingIsSlow, screensToLoad); screenManager.AddScreen(loadingScreen); }
/// <summary> /// Activates the loading screen /// </summary> public static void Load(ScreenManager screenManager, bool loadingIsSlow, 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 LoadingScreen loadingScreen = new LoadingScreen(screenManager, loadingIsSlow, screensToLoad); screenManager.AddScreen(loadingScreen); }
/// <summary> /// Активация экрана загруззки. /// </summary> public static void Load(ScreenManager screenManager, bool loadingIsSlow, PlayerIndex? controllingPlayer, params GameScreen[] screensToLoad) { //Даем команду текущим экранам исчезнуть. foreach (GameScreen screen in screenManager.GetScreens()) screen.ExitScreen(); //Создаем и активируем экран загрузки. LoadingScreen loadingScreen = new LoadingScreen(screenManager, loadingIsSlow, screensToLoad); screenManager.AddScreen(loadingScreen, controllingPlayer); }
/// <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(); // Remove any existing looping sounds Helpers.GetSoundLibrary(screenManager).StopAllSounds(); // Create and activate the loading screen. LoadingScreen loadingScreen = new LoadingScreen(screenManager, loadingIsSlow, screensToLoad); screenManager.AddScreen(loadingScreen, controllingPlayer); }
/// <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(); //Flush GC GC.Collect(); // Create and activate the loading screen. LoadingScreen loadingScreen = new LoadingScreen(screenManager, loadingIsSlow, screensToLoad); screenManager.AddScreen(loadingScreen, controllingPlayer); }
public static void Load(ScreenManager screenManager, bool loadingIsSlow, string message, 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. LoadingScreen loadingScreen = new LoadingScreen(screenManager, loadingIsSlow, message, screensToLoad); screenManager.AddScreen(loadingScreen, controllingPlayer); }
/// <summary> /// Draws the loading screen. /// </summary> public override void Draw(GameTime gameTime) { // TODO: I'd like to figure out a way to let the background screen keep drawing // the paralax wihout a spit second of purple when transitioning. this.ScreenManager.GraphicsDevice.Clear(Color.Black); // If we are the only active screen, that means all the previous screens // must have finished transitioning off. We check for this in the Draw // method, rather than in Update, because it isn't enough just for the // screens to be gone: in order for the transition to look good we must // have actually drawn a frame without them before we perform the load. if ((ScreenState == ScreenState.Active) && (ScreenManager.GetScreens().Length == 1)) { otherScreensAreGone = true; } // The gameplay screen takes a while to load, so we display a loading // message while that is going on, but the menus load very quickly, and // it would look silly if we flashed this up for just a fraction of a // second while returning from the game to the menus. This parameter // tells us how long the loading is going to take, so we know whether // to bother drawing the message. if (loadingIsSlow) { SpriteBatch spriteBatch = ScreenManager.SpriteBatch; SpriteFont font = ScreenManager.Font; const string message = "Loading..."; // Center the text in the viewport. Viewport viewport = ScreenManager.GraphicsDevice.Viewport; Vector2 viewportSize = new Vector2(viewport.Width, viewport.Height); Vector2 textSize = font.MeasureString(message); Vector2 textPosition = (viewportSize - textSize) / 2; Color color = Color.White * TransitionAlpha; // Draw the text. spriteBatch.Begin(); spriteBatch.DrawString(font, message, textPosition, color); spriteBatch.End(); } }
public override void HandleInput(InputState input) { PlayerIndex playerIndex; if (input.IsMenuCancel(ControllingPlayer, out playerIndex)) { // Remove all MedalsMenuScreens open GameScreen[] screens = ScreenManager.GetScreens(); for (int i = screens.Length - 1; i >= 0; i--) { if (screens[i] is MedalsMenuScreen) { screens[i].ExitScreen(); } } } else if (input.IsNewButtonPress(Buttons.LeftShoulder, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Left, ControllingPlayer, out playerIndex)) { if (medalStartIndex != 0) { screenChangeSFX.Play(0.5f, -0.1f, 0.0f); // Remove this page of medals OnCancel(playerIndex); } } else if (input.IsNewButtonPress(Buttons.RightShoulder, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Right, ControllingPlayer, out playerIndex)) { // Add a new page of medals if needed if (medalStartIndex + MEDALS_PER_SCREEN < ActivePlayer.Profile.MedalList.Count) { screenChangeSFX.Play(0.5f, 0.1f, 0.0f); ScreenManager.AddScreen(new MedalsMenuScreen(medalStartIndex + MEDALS_PER_SCREEN, 0), ActivePlayer.PlayerIndex); } } }
/// <summary> /// Draws the loading screen /// </summary> public override void Draw(GameTime gameTime) { // If we are the only active screen, that means all the previous screens // must have finished transitioning off. We check for this in the Draw // method, rather than in Update, because it isn't enough just for the // screens to be gone: in order for the transition to look good we must // have actually drawn a frame without them before we perform the load if ((ScreenState == ScreenState.Active) && (ScreenManager.GetScreens().Length == 1)) { // Set the other screens gone to true otherScreensAreGone = true; } // We display a loading message while that is going on if the loading is slow, // but the menus load very quickly, and it would look strange if we flashed this // up for just a fraction of a second while returning from the game to the menus. // This parameter tells us how long the loading is going to take, so we know whether // to bother drawing the message if (loadingIsSlow) { // Define our sprite batch and font SpriteBatch spriteBatch = ScreenManager.SpriteBatch; SpriteFont font = ScreenManager.Font; // Define our loading message const string message = "Loading....."; // Define the center vector Vector2 center = new Vector2(350, 210); // Draw the text. spriteBatch.Begin(); spriteBatch.DrawString(font, message, center, Color.White); spriteBatch.End(); } }
/// <summary> /// Draws the loading screen. /// </summary> public override void Draw(GameTime gameTime) { // If we are the only active screen, that means all the previous screens // must have finished transitioning off. We check for this in the Draw // method, rather than in Update, because it isn't enough just for the // screens to be gone: in order for the transition to look good we must // have actually drawn a frame without them before we perform the load. if ((ScreenState == ScreenState.Active) && (ScreenManager.GetScreens().Length == 1)) { _otherScreensAreGone = true; } // The gameplay screen takes a while to load, so we display a loading // message while that is going on, but the menus load very quickly, and // it would look silly if we flashed this up for just a fraction of a // second while returning from the game to the menus. This parameter // tells us how long the loading is going to take, so we know whether // to bother drawing the message. if (_loadingIsSlow) { SpriteBatch spriteBatch = ScreenManager.SpriteBatch; spriteBatch.Begin(); #if IPHONE var screenSize = new Vector2(ScreenManager.Graphics.PreferredBackBufferWidth, ScreenManager.Graphics.PreferredBackBufferHeight); #else var screenSize = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height); #endif if (_background != null) { spriteBatch.Draw(_background, screenSize / 2, null, Color.White, 0, new Vector2(_background.Width, _background.Height) / 2, 1, SpriteEffects.None, 0); } if (_showText) { SpriteFont font = ScreenManager.Font; const string message = "Loading..."; // Center the text in the screen. Vector2 textSize = font.MeasureString(message); Vector2 textPosition = (screenSize - textSize) / 2; #if SILVERLIGHT var color = new Color(Color.White, MathHelper.Clamp(TransitionAlpha, 0, 1)); #else var color = Color.White * TransitionAlpha; #endif // Draw the text. spriteBatch.DrawString(font, message, textPosition, color); } spriteBatch.End(); // Fix for Silversprite spriteBatch.Begin(); spriteBatch.End(); if (_fadeBackBufferToWhiteAlpha > 0) { ScreenManager.FadeBackBufferToWhite(_fadeBackBufferToWhiteAlpha); } } }