Integrate minigame and courses
This commit is contained in:
@@ -3,7 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(menuName = "Create new Scriptable/User/User")]
|
||||
[CreateAssetMenu(menuName = "Create new Scriptable/User")]
|
||||
public class User : ScriptableObject
|
||||
{
|
||||
[Header("Personal data")]
|
||||
@@ -24,4 +24,40 @@ public class User : ScriptableObject
|
||||
[SerializeField]
|
||||
// List of minigames a user played
|
||||
public List<Progress> minigames = new List<Progress>();
|
||||
|
||||
// Get a list of all recently started courses, returns a list of tuples of `<CourseIndex idx, float courseProgress>`
|
||||
public List<Tuple<CourseIndex, float>> GetRecentCourses()
|
||||
{
|
||||
// TODO: return better results (for now only return all courses)
|
||||
List<Tuple<CourseIndex, float>> recentCourses = new List<Tuple<CourseIndex, float>>();
|
||||
foreach (Progress courseProgress in courses)
|
||||
{
|
||||
CourseIndex idx = courseProgress.Get<CourseIndex>("courseIndex");
|
||||
float progress = courseProgress.Get<float>("courseProgress");
|
||||
recentCourses.Add(Tuple.Create<CourseIndex, float>(idx, progress));
|
||||
}
|
||||
return recentCourses;
|
||||
}
|
||||
|
||||
// Get a list of all recommended courses, returns a list of tuples of `<CourseIndex idx, float courseProgress>`
|
||||
public List<Tuple<CourseIndex, float>> GetRecommendedCourses()
|
||||
{
|
||||
List<Tuple<CourseIndex, float>> recommenedCourses = new List<Tuple<CourseIndex, float>>();
|
||||
if (courses.Count == 0)
|
||||
{
|
||||
recommenedCourses.Add(Tuple.Create<CourseIndex, float>(CourseIndex.FINGERSPELLING, 0.0f));
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: return better results (for now only return all courses)
|
||||
foreach (Progress courseProgress in courses)
|
||||
{
|
||||
CourseIndex idx = courseProgress.Get<CourseIndex>("courseIndex");
|
||||
float progress = courseProgress.Get<float>("courseProgress");
|
||||
recommenedCourses.Add(Tuple.Create<CourseIndex, float>(idx, progress));
|
||||
}
|
||||
}
|
||||
|
||||
return recommenedCourses;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user