Resolve WES-117 "Persistent data handling"

This commit is contained in:
Dries Van Schuylenbergh
2023-04-04 17:00:47 +00:00
parent 3499e61bb0
commit 5f4408063f
82 changed files with 1963 additions and 1190 deletions

View File

@@ -7,8 +7,6 @@ using UnityEngine.UI;
public class GameEndedPanel : MonoBehaviour
{
public UserList userList;
/// <summary>
/// "VERLOREN" or "GEWONNEN"
/// </summary>
@@ -125,17 +123,17 @@ public class GameEndedPanel : MonoBehaviour
// Instantiate new entries
// Get all scores from all users
List<Tuple<string, Score>> allScores = new List<Tuple<string, Score>>();
foreach (User user in userList.GetUsers())
foreach (User user in UserList.GetUsers())
{
// Get user's progress for this minigame
Progress progress = user.GetMinigameProgress(MinigameIndex.SPELLING_BEE);
var progress = user.GetMinigameProgress(MinigameIndex.SPELLING_BEE);
if (progress != null)
{
// Add scores to dictionary
List<Score> scores = progress.Get<List<Score>>("highestScores");
List<Score> scores = progress.highestScores;
foreach (Score score in scores)
{
allScores.Add(new Tuple<string, Score>(user.username, score));
allScores.Add(new Tuple<string, Score>(user.GetUsername(), score));
}
}
}
@@ -154,7 +152,7 @@ public class GameEndedPanel : MonoBehaviour
scoreboardEntries.Add(entry);
// Set the player icon
entry.transform.Find("Image").GetComponent<Image>().sprite = userList.GetUserByUsername(username).avatar;
entry.transform.Find("Image").GetComponent<Image>().sprite = UserList.GetUserByUsername(username).GetAvatar();
// Set the player name
entry.transform.Find("PlayerName").GetComponent<TMP_Text>().text = username;