private void SetHighScoresList() { string text = ""; SortedList <int, HighScore> highScores = HighScoreUtils.GetHighScores(); int count = highScores.Count; IList <int> keys = highScores.Keys; for (int i = 0; i < count && i < HighScoreUtils.MAX_HIGH_SCORES; i++) { int nextEntryNum = (i + 1); HighScore current = highScores[keys[i]]; text += string.Format(HIGH_SCORE_FORMAT, nextEntryNum, current.Initials, current.Score); } GetComponent <Text>().text = (text != null) ? text : DEFAULT; }
private bool IsNewHighScore() { HUDInventoryAndScoreController scoreController = (HUDInventoryAndScoreController)Object.FindObjectOfType(typeof(HUDInventoryAndScoreController)); int score = scoreController.GetCurrentScore(); SortedList <int, HighScore> highScores = HighScoreUtils.GetHighScores(); if (highScores.Count < 10) { return(true); } foreach (HighScore highScore in highScores.Values) { if (score >= highScore.Score) { return(true); } } return(false); }