From c10683a6f69de348f0eaa32a4ebe38e0d54a4c1f Mon Sep 17 00:00:00 2001 From: Marine Date: Sun, 25 Feb 2024 18:30:14 +0100 Subject: [PATCH] show score --- Assets/Scripts/ScoringPage.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/ScoringPage.cs b/Assets/Scripts/ScoringPage.cs index f2b722c..a337208 100644 --- a/Assets/Scripts/ScoringPage.cs +++ b/Assets/Scripts/ScoringPage.cs @@ -39,11 +39,13 @@ public void Initialize(Room _room) scoreByUser = scoreByUser.OrderByDescending(x => x.Value).ToDictionary(x => x.Key, x => x.Value); List playersId = scoreByUser.Keys.ToList(); - for ( int i = 0; i < playersId.Count; i++) + int countPlayers = scoreByUser.Keys.ToList().Count; + for (int i = 0; i < countPlayers; i++) { - Player p = _room.GetPlayerById(playersId[i]); + Player p = _room.GetPlayerById(scoreByUser.Keys.ToList()[i]); playerStickers[i].gameObject.SetActive(true); - playerStickers[i].Initialize( p.name , i); + string nameAndScore = p.name +'\n'+ scoreByUser[p.id] +" pts"; + playerStickers[i].Initialize(nameAndScore, i); } }