Score: Display rank too

parent c4f151fb
...@@ -32,12 +32,16 @@ public class HighScores : MonoBehaviour { ...@@ -32,12 +32,16 @@ public class HighScores : MonoBehaviour {
if (Server.Scores.scores.Length > 0) { if (Server.Scores.scores.Length > 0) {
for (int i = 0; i < highScores.Length; i++) { 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]; Score score = highScores [i];
string name = score.playerName; string name = score.playerName;
if (score.team != null && score.team.Length > 0) { if (score.team != null && score.team.Length > 0) {
name += " (" + score.team + ")"; name += " (" + score.team + ")";
} }
ScoreText.text += WWW.UnEscapeURL(name) + ": " + score.score + " points\n"; ScoreText.text += positionText + " " + WWW.UnEscapeURL(name) + ": " + score.score + " points\n";
} }
} else { } else {
ScoreText.text = "No high-score yet... Play a game and show you are the best!"; ScoreText.text = "No high-score yet... Play a game and show you are the best!";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment