/// <summary> /// Asynchronous handler for the highscore player name popup messagebox. /// </summary> /// <param name="result">The popup messagebox result. The result's /// AsyncState property should be true if the user successfully finished /// the game, or false otherwise.</param> private void ShowHighscorePromptEnded(IAsyncResult result) { string playerName = Guide.EndShowKeyboardInput(result); bool finishedGame = (bool)result.AsyncState; if (playerName != null) { if (playerName.Length > 15) { playerName = playerName.Substring(0, 15); } HighScoreScreen.PutHighScore(playerName, currentLevelNumber); } if (finishedGame) { moveToHighScore = true; } else { AudioManager.PlaySound("fail"); isActive = true; currentLevelNumber = 1; isLevelChange = true; } }
/// <summary> /// Asynchronous handler for the highscore player name popup messagebox. /// </summary> /// <param name="result">The popup messagebox result. The result's /// AsyncState should contain the level number which acts as the /// highscore.</param> private void ShowHighscorePromptEnded(IAsyncResult result) { string playerName = Guide.EndShowKeyboardInput(result); int levelNumber = (int)result.AsyncState; if (playerName != null) { if (playerName.Length > 15) { playerName = playerName.Substring(0, 15); } HighScoreScreen.PutHighScore(playerName, levelNumber); } moveToHighScore = true; }