예제 #1
0
        /// <summary>
        /// Retrieves the global high scores for a level.
        /// </summary>
        /// <param name="levelNumber">The level number.</param>
        /// <returns>The high scores for the level or null if input is invalid.</returns>
        public LevelScoreTable GetGlobalScoresFor(int levelNumber)
        {
            if (levelNumber < 1 || levelNumber > GameSettings.TotalLevels)
            {
                return(null);
            }
            else
            {
                Collection <ScoreNamePair> scoresForLevel = this.scoreServiceManager.GetScoresFor(levelNumber);
                LevelScoreTable            scoreTable     = new LevelScoreTable(1);
                foreach (ScoreNamePair scoreNamePair in scoresForLevel)
                {
                    scoreTable.AddScore(scoreNamePair);
                }

                return(scoreTable);
            }
        }
예제 #2
0
 /// <summary>
 /// Manages state changes from the leaderboard select menu, based on user input.
 /// </summary>
 /// <param name="selectedItemName">The name of the selected item.</param>
 /// <param name="gameSettings">The game settings.</param>
 private void HandleLeaderboardSelection(string selectedItemName, GameSettings gameSettings)
 {
     try
     {
         int level = int.Parse(selectedItemName);
         this.ActiveMenu = MenuType.Leaderboard;
         Collection <MenuItem> leaderboardItems = this.menus[MenuType.Leaderboard].MenuItems;
         LevelScoreTable       scoreTable       = this.localLeaderboardActive ? gameSettings.LevelScoreTables[level - 1] : gameSettings.GetGlobalScoresFor(level);
         int changedCount = 0;
         for (int count = 0; count < leaderboardItems.Count; count++)
         {
             if (leaderboardItems[count].Type == typeof(MenuText) && (leaderboardItems[count] as MenuText).IsChangeable)
             {
                 (leaderboardItems[count] as MenuText).SetText(scoreTable.Scores[changedCount].ToString());
                 changedCount++;
             }
         }
     }
     catch
     {
         this.ActiveMenu = MenuType.LeaderboardTypeSelect;
     }
 }
예제 #3
0
        /// <summary>
        /// Retrieves the global high scores for a level.
        /// </summary>
        /// <param name="levelNumber">The level number.</param>
        /// <returns>The high scores for the level or null if input is invalid.</returns>
        public LevelScoreTable GetGlobalScoresFor(int levelNumber)
        {
            if (levelNumber < 1 || levelNumber > GameSettings.TotalLevels)
            {
                return null;
            }
            else
            {
                Collection<ScoreNamePair> scoresForLevel = this.scoreServiceManager.GetScoresFor(levelNumber);
                LevelScoreTable scoreTable = new LevelScoreTable(1);
                foreach (ScoreNamePair scoreNamePair in scoresForLevel)
                {
                    scoreTable.AddScore(scoreNamePair);
                }

                return scoreTable;
            }
        }