From 74e938b59a2ea201473dd55f875a7a6be212d796 Mon Sep 17 00:00:00 2001 From: Paul-Louis NECH Date: Sat, 29 Oct 2016 11:14:13 -0400 Subject: [PATCH] Score: Display rank too --- Assets/Scripts/HighScores.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/HighScores.cs b/Assets/Scripts/HighScores.cs index c996e3d..4b42b70 100644 --- a/Assets/Scripts/HighScores.cs +++ b/Assets/Scripts/HighScores.cs @@ -32,12 +32,16 @@ public class HighScores : MonoBehaviour { if (Server.Scores.scores.Length > 0) { for (int i = 0; i < highScores.Length; i++) { + int position = i + 1; + string positionText = position + (position == 1 ? "st" : + position == 2 ? "nd" : + position == 3 ? "rd" : "th"); Score score = highScores [i]; string name = score.playerName; if (score.team != null && score.team.Length > 0) { name += " (" + score.team + ")"; } - ScoreText.text += WWW.UnEscapeURL(name) + ": " + score.score + " points\n"; + ScoreText.text += positionText + " " + WWW.UnEscapeURL(name) + ": " + score.score + " points\n"; } } else { ScoreText.text = "No high-score yet... Play a game and show you are the best!"; -- libgit2 0.27.0