/// <summary> /// Updates the loading screen. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); // If all the previous screens have finished transitioning // off, it is time to actually perform the load. if (otherScreensAreGone) { ScreenManager.Pop(this); foreach (Screen screen in screensToLoad) { if (screen != null) { ScreenManager.Push(screen); } } // Once the load has finished, we use ResetElapsedTime to tell // the game timing mechanism that we have just finished a very // long frame, and that it should not try to catch up. ScreenManager.Game.ResetElapsedTime(); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); ScreenManager.LoadContent(this); ScreenManager.Push(new BackgroundScreen()); ScreenManager.Push(new SplashScreen()); }
public override void HandleInput() { if (InputManager.IsActionTriggered(InputManager.Action.Back)) { ExitScreen(); ScreenManager.Push(new SplashScreen()); return; } base.HandleInput(); }
public override void HandleInput() { if (InputManager.IsActionTriggered(InputManager.Action.Select)) { ExitScreen(); ScreenManager.Push(new MenuScreen()); } else if (InputManager.IsActionTriggered(InputManager.Action.Exit)) { string message = "Are you sure you want to exit?"; MessageBox exitBox = new MessageBox(message, true); exitBox.Accepted += ConfirmAccepted; ScreenManager.Push(exitBox); } }
public override void HandleInput() { if (InputManager.IsActionTriggered(InputManager.Action.Exit)) { // add a confirmation message box const string message = "Are you sure you want to exit? All unsaved progress will be lost." + "\n\n <Esc> : cancel " + "\n <Enter> : confirm"; MessageBox exitBox = new MessageBox(message, true); exitBox.Accepted += ConfirmExitAccepted; ScreenManager.Push(exitBox); //return; } }
/// <summary> /// Activates the loading screen. /// </summary> public static void Load(/*ScreenManager screenManager, */ bool loadingIsSlow, /*PlayerIndex? controllingPlayer,*/ params Screen[] screensToLoad) { // Tell all the current screens to transition off. foreach (Screen screen in ScreenManager.GetScreens()) { screen.ExitScreen(); } // Create and activate the loading screen. LoadingScreen loadingScreen = new LoadingScreen(/*screenManager,*/ loadingIsSlow, screensToLoad); ScreenManager.Push(loadingScreen); }
public static void HandleInput() { motion = Vector2.Zero; if (InputManager.IsKeyTriggered(Keys.Space)) { // update NPC // update chests UpdateChests(); // update switches UpdateSwitches(); // update blocks UpdateBlocks(); } else if (InputManager.IsKeyTriggered(Keys.D)) { const string message = "Hello there! This is a dialog box. Wheee!"; DialogBox dialog = new DialogBox(message, null); dialog.Accepted += DialogAccepted; ScreenManager.Push(dialog); } if (InputManager.IsKeyPressed(Keys.Up)) { motion.Y--; } if (InputManager.IsKeyPressed(Keys.Down)) { motion.Y++; } if (InputManager.IsKeyPressed(Keys.Left)) { motion.X--; } if (InputManager.IsKeyPressed(Keys.Right)) { motion.X++; } }
protected override void OnCancel() { string message = String.Empty; if (this.IsActive) { message = "Are you sure you want to exit?" + "All unsaved progress will be lost."; } else { message = "Are you sure you want to exit?"; } MessageBox confirmExitBox = new MessageBox(message, true); confirmExitBox.Accepted += ConfirmAccepted; ScreenManager.Push(confirmExitBox); }