public void DisplayHighscores(List <Highscore> highscores) { ClearEntries(); statusText.text = ""; for (int i = 0; i < highscores.Count; i++) { int rank = i + 1; HighscoreEntry entry = Instantiate(entryPrefab, entriesParent).GetComponent <HighscoreEntry>(); entry.Populate(rank + ".", "", ""); entry.SetTextColourBasedOnRank(rank); if (highscores.Count > i) { entry.Populate(rank + ".", highscores[i].GetName(), highscores[i].GetScore().ToString()); entry.SetTextColourBasedOnRank(rank); } } }
public void DisplayHighscores(List <Highscore> highscores) { this.highscores = highscores; statusText.SetText(""); ClearEntries(); for (int i = 0; i < highscores.Count; i++) { int rank = i + 1; HighscoreEntry entry = Instantiate(entryPrefab, leaderboardContent).GetComponent <HighscoreEntry>(); entry.Populate(rank, "", ""); if (this.highscores.Count > i) { Highscore highscore = this.highscores[i]; string value = this.sortByScore ? highscore.GetScore().ToString() : highscore.GetDistance().ToString(); entry.Populate(rank, highscore.GetName(), value); entry.SetIcons(highscore.GetShip(), highscore.isVrMode()); entry.SetTextColourBasedOnRank(rank); } } }