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

@@ -40,15 +40,10 @@ public class MinigameActivityScreen : MonoBehaviour
/// </summary>
public TMP_Text controls;
/// <summary>
/// Reference to the users
/// </summary>
public UserList userList;
/// <summary>
/// Reference to the Minigame progress
/// </summary>
private Progress progress;
private PersistentDataController.SavedMinigameProgress progress;
/// <summary>
/// Reference to the users-high-scores container object
@@ -65,7 +60,7 @@ public class MinigameActivityScreen : MonoBehaviour
/// </summary>
void Start()
{
userList.Load();
PersistentDataController.GetInstance().Load();
GenerateContent();
GenerateHighScores();
}
@@ -109,17 +104,17 @@ public class MinigameActivityScreen : MonoBehaviour
Minigame minigame = minigameList.minigames[index];
List<Tuple<string, Sprite, Score>> allScores = new List<Tuple<string, Sprite, Score>>();
foreach (User user in userList.GetUsers())
foreach (User user in UserList.GetUsers())
{
// Get user's progress for this minigame
progress = user.GetMinigameProgress(minigame.index);
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, Sprite, Score>(user.username, user.avatar, score));
allScores.Add(new Tuple<string, Sprite, Score>(user.GetUsername(), user.GetAvatar(), score));
}
}
}