Add formatting rules

This commit is contained in:
Dries Van Schuylenbergh
2023-03-10 09:21:11 +00:00
parent 6d762a63f7
commit 26f3322e4e
30 changed files with 975 additions and 160 deletions

View File

@@ -2,29 +2,45 @@ using System;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// A class holding all information of a user
/// </summary>
[Serializable]
public class User
{
[Header("Personal data")]
// User nickname
/// <summary>
/// User nickname
/// </summary>
public string username;
// User avatar
/// <summary>
/// The avatar of the user
/// </summary>
public Sprite avatar;
[Header("Personal settings")]
// TODO: set personal settings and preferences
[Header("Progress")]
// Total playtime
/// <summary>
/// The total playtime of the user
/// </summary>
/// <remarks>TODO: needs to be implemented</remarks>
public double playtime;
/// <summary>
/// List of courses a user started/completed
/// </summary>
[SerializeField]
// List of courses a user started/completed
public List<Progress> courses = new List<Progress>();
/// <summary>
/// List of minigames a user played
/// </summary>
[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>`
/// <summary>
/// Get a list of all recently started courses
/// </summary>
/// <returns>A <c>List</c> of <c>Tuples</c>, containing the <c>CourseIndex</c>
/// and a <c>float</c> holding the progress (value between 0 and 1) of the user in this course</returns>
public List<Tuple<CourseIndex, float>> GetRecentCourses()
{
// TODO: return better results (for now only return all courses)
@@ -38,7 +54,11 @@ public class User
return recentCourses;
}
// Get a list of all recommended courses, returns a list of tuples of `<CourseIndex idx, float courseProgress>`
/// <summary>
/// Get a list of all recommended courses
/// </summary>
/// <returns>A <c>List</c> of <c>Tuples</c>, containing the <c>CourseIndex</c>
/// and a <c>float</c> holding the progress (value between 0 and 1) of the user in this course</returns>
public List<Tuple<CourseIndex, float>> GetRecommendedCourses()
{
List<Tuple<CourseIndex, float>> recommenedCourses = new List<Tuple<CourseIndex, float>>();
@@ -59,4 +79,24 @@ public class User
return recommenedCourses;
}
/// <summary>
/// Get the progress of a certain course
/// </summary>
/// <param name="courseIndex">Index of course</param>
/// <returns><c>Progress</c> belonging to the <c>courseIndex</c>, <c>null</c> if course was not found</returns>
public Progress GetCourseProgress(CourseIndex courseIndex)
{
return courses.Find((p) => p.Get<CourseIndex>("courseIndex") == courseIndex);
}
/// <summary>
/// Get the progress of certain minigame
/// </summary>
/// <param name="minigameIndex">Index of the minigame</param>
/// <returns><c>Progress</c> belonging to the <c>minigameIndex</c>, <c>null</c> if minigame was not found</returns>
public Progress GetMinigameProgress(MinigameIndex minigameIndex)
{
return minigames.Find((p) => p.Get<MinigameIndex>("minigameIndex") == minigameIndex);
}
}