Resolve WES-117 "Persistent data handling"
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user