Resolve WES-95 "User progress"

This commit is contained in:
Dries Van Schuylenbergh
2023-03-18 10:25:49 +00:00
parent 5e26970bad
commit 9dfadece44
39 changed files with 4208 additions and 69 deletions

View File

@@ -1,43 +0,0 @@
using UnityEngine;
/// <summary>
/// Class for holding all (static) data about a certain minigame
/// </summary>
[CreateAssetMenu(menuName = "Create new Scriptable/Minigame")]
public class Minigame : ScriptableObject
{
/// <summary>
/// Index of the minigame
/// </summary>
public MinigameIndex index;
/// <summary>
/// The minigame title
/// </summary>
public string title;
/// <summary>
/// A short description of the minigame
/// </summary>
public string description;
/// <summary>
/// Whether or not the game needs a theme to be selected
/// </summary>
public bool needsTheme;
/// <summary>
/// Reference to the minigame thumbnail
/// </summary>
public Sprite thumbnail;
/// <summary>
/// The path to the minigame starting scene (<c>path == $"Assets/{minigameEntryPoint}"</c>)
/// </summary>
public string minigameEntryPoint;
/// <summary>
/// An explanation on how to play the game and score points
/// </summary>
public string controls;
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d7809d135a59849458ccb29ffad535c5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -111,11 +111,11 @@ public class MinigameActivityScreen : MonoBehaviour
foreach (User user in userList.GetUsers())
{
// Get user's progress for this minigame
progress = user.minigames.Find((p) => p != null && p.Get<MinigameIndex>("minigameIndex") == minigame.index);
progress = user.GetMinigameProgress(minigame.index);
if (progress != null)
{
// Add scores to dictionary
List<Score> scores = progress.Get<List<Score>>("scores");
List<Score> scores = progress.Get<List<Score>>("highestScores");
foreach (Score score in scores)
{
allScores.Add(new Tuple<string, Sprite, Score>(user.username, user.avatar, score));

View File

@@ -1,20 +0,0 @@
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Keep track off installed minigames
/// </summary>
[CreateAssetMenu(menuName = "Create new Scriptable/MinigameList")]
public class MinigameList : ScriptableObject
{
/// <summary>
/// Index of the active/to be loaded/current minigame
/// </summary>
public int currentMinigameIndex = 0;
/// <summary>
/// List of all installed minigames
/// </summary>
public List<Minigame> minigames = new List<Minigame>();
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 3976e4310b716de4eb24f1916c10ff3d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: