Example #1
0
        /// <summary>
        /// A handler invoked after the user has enter his name.
        /// </summary>
        /// <param name="result"></param>
        private void AfterPlayerEnterName(IAsyncResult result)
        {
            // Gets the name entered
            string playerName = Guide.EndShowKeyboardInput(result);

            if (!string.IsNullOrEmpty(playerName))
            {
                // Ensure that it is valid
                if (playerName != null && playerName.Length > 15)
                {
                    playerName = playerName.Substring(0, 15);
                }

                // Puts it in high score
                HighScoreScreen.PutHighScore(playerName, GameplayScreen.FinalScore);
                HighScoreScreen.HighScoreChanged();
            }

            // Moves to the next screen
            foreach (GameScreen screen in ScreenManager.GetScreens())
            {
                screen.ExitScreen();
            }

            ScreenManager.AddScreen(new BackgroundScreen("highScoreScreen"), null);
            ScreenManager.AddScreen(new HighScoreScreen(), null);
        }
        /// <summary>
        /// A handler invoked after the user has entered his name.
        /// </summary>
        /// <param name="result"></param>
        private void AfterPlayerEnterName(IAsyncResult result)
        {
            // Get the name entered by the user
            string playerName = Guide.EndShowKeyboardInput(result);

            if (!string.IsNullOrEmpty(playerName))
            {
                // Ensure that it is valid
                if (playerName != null && playerName.Length > 15)
                {
                    playerName = playerName.Substring(0, 15);
                }

                // Puts it in high score
                HighScoreScreen.PutHighScore(playerName, Score);
            }

            // Moves to the next screen
            MoveToNextScreen((bool)result.AsyncState);
        }