/// <summary> /// Finish the current game /// </summary> private void FinishCurrentGame() { IsActive = false; foreach (GameScreen screen in ScreenManager.GetScreens()) { screen.ExitScreen(); } if (HighScoreScreen.IsInHighscores(gameTime)) { // Show the device's keyboard Guide.BeginShowKeyboardInput(PlayerIndex.One, "Player Name", "Enter your name (max 15 characters)", "Player", (r) => { string playerName = Guide.EndShowKeyboardInput(r); if (playerName != null && playerName.Length > 15) { playerName = playerName.Substring(0, 15); } HighScoreScreen.PutHighScore(playerName, gameTime); ScreenManager.AddScreen(new BackgroundScreen(), null); ScreenManager.AddScreen(new HighScoreScreen(), null); }, null); return; } ScreenManager.AddScreen(new BackgroundScreen(), null); ScreenManager.AddScreen(new HighScoreScreen(), null); }
private void DrawEndGame(GameTime gameTime) { string text = HighScoreScreen.IsInHighscores(this.gameTime) ? " You got a High Score!" : " Game Over"; text += "\nTouch the screen to continue"; Vector2 size = timeFont.MeasureString(text); Vector2 textPosition = (new Vector2(ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height) - size) / 2f; ScreenManager.SpriteBatch.DrawString(timeFont, text, textPosition, Color.White); }