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

@@ -1,21 +1,33 @@
using UnityEngine;
using UnityEngine.SceneManagement;
/// <summary>
/// Class to handle scene loading callbacks
/// </summary>
public class ChangeSceneOnClick : MonoBehaviour
{
// Load scene from path name
/// <summary>
/// Method used as callback for gameobject onClick events
/// </summary>
/// <param name="sceneName">The path to the new scene (<c>path == $"Assets/{sceneName}"</c>)</param>
public void LoadScene(string sceneName)
{
SceneManager.LoadScene(sceneName);
}
// Load scene from reference
/// <summary>
/// Method used as callback for gameobject onClick events
/// </summary>
/// <param name="scene">Reference to a scene</param>
public void LoadScene(Scene scene)
{
SceneManager.LoadScene(scene.buildIndex);
}
// Load scene from build index
/// <summary>
/// Method used as callback from gameobject onClick events
/// </summary>
/// <param name="buildIndex">Build index of the scene to be loaded</param>
public void LoadScene(int buildIndex)
{
SceneManager.LoadScene(buildIndex);

View File

@@ -3,33 +3,58 @@ using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
/// <summary>
/// Handles the display of courses in the ListCourseScreen and CourseScreenManager scene
/// </summary>
public class CourseItem : MonoBehaviour
{
[Header("Course")]
// Reference to the course
/// <summary>
/// Reference to the course object
/// </summary>
public Course course;
// Progress of the current user on this course
/// <summary>
/// Progress of the current user on this specific course
/// </summary>
public float progress;
[Header("UI references")]
// Reference to thumbnail object
/// <summary>
/// UI Reference to the image for displaying the course thumbnail
/// </summary>
public Image thumbnail;
// Reference to title object
/// <summary>
/// UI Reference to the gameobject for displaying the course title
/// </summary>
public TMP_Text title;
// Refetence to object so correct callback can be trigger on click
/// <summary>
/// UI Reference to the button so the correct callback can be trigger on click
/// </summary>
public Button button;
// Reference to progress bar
/// <summary>
/// Reference to the slider that displays the progress of the user
/// </summary>
public GameObject slider;
// Reference to `COMPLETED`
/// <summary>
/// Reference to the gameobject that holds the text 'COMPLETED'
/// </summary>
public GameObject completed;
/// <summary>
/// Start is called before the first frame update
/// </summary>
void Start()
{
// Use public function so that this component can get Instantiated
GenerateContent();
}
/// <summary>
/// (Re)generate the CourseItem object and update its appearance
/// </summary>
public void GenerateContent()
{
// Set appearance

View File

@@ -1,20 +1,29 @@
using UnityEngine;
using UnityEngine.SceneManagement;
/// <summary>
/// ListCourseScreen scene manager
/// </summary>
public class CourseListManager : MonoBehaviour
{
[Header("Course list UI components")]
// Reference to course-list holder object
/// <summary>
/// Reference to the course-list container object
/// </summary>
public Transform courseContainer;
[Header("Prefabs")]
// Prefab of item
/// <summary>
/// Prefab of the course item object
/// </summary>
public GameObject courseItemPrefab;
[Header("Courses")]
// Reference to the list of all courses
/// <summary>
/// Reference to the list of all courses
/// </summary>
public CourseList courseList;
/// <summary>
/// Start is called before the first frame update
/// </summary>
void Start()
{
foreach (Course course in courseList.courses)
@@ -28,7 +37,10 @@ public class CourseListManager : MonoBehaviour
}
}
// Method used as callback for on click events
/// <summary>
/// Method used as callback for course item onClick events
/// </summary>
/// <param name="sceneName">The path to the new scene (<c>path == $"Assets/{sceneName}"</c>)</param>
public void LoadScene(string sceneName)
{
SceneManager.LoadScene(sceneName);

View File

@@ -3,26 +3,44 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
/// <summary>
/// CourseScreen scene manager
/// </summary>
public class CourseScreenManager : MonoBehaviour
{
[Header("Course Screen Components")]
// Reference to text that displays when there are no recent courses
/// <summary>
/// Reference to text that displays when there are no recent courses
/// </summary>
public GameObject noRecentCourses;
// Reference to recent-courses-list holder object
/// <summary>
/// Reference to recent-courses-list container object
/// </summary>
public Transform recentCoursesContainer;
// Reference to recommended-courses-list holder object
/// <summary>
/// Reference to recommended-courses-list container object
/// </summary>
public Transform recommendedCoursesContainer;
[Header("Prefabs")]
// CourseItem prefab
/// <summary>
/// Prefab of the course item object
/// </summary>
public GameObject courseItem;
[Header("User")]
// Reference to the users so we can get the current user;
/// <summary>
/// Reference to the users so we can get the current user;
/// </summary>
public UserList userList;
// Reference to the courses
/// <summary>
/// Reference to the courses
/// </summary>
public CourseList courseList;
/// <summary>
/// Start is called before the first frame update
/// </summary>
void Start()
{
User user = userList.GetCurrentUser();
@@ -55,7 +73,10 @@ public class CourseScreenManager : MonoBehaviour
}
}
// Method used as callback for on click events
/// <summary>
/// Method used as callback for course item onClick events
/// </summary>
/// <param name="sceneName">The path to the new scene (<c>path == $"Assets/{sceneName}"</c>)</param>
public void LoadScene(string sceneName)
{
SceneManager.LoadScene(sceneName);

View File

@@ -1,19 +1,33 @@
using UnityEngine;
/// <summary>
/// Class for holding all (static) data about a certain minigame
/// </summary>
[CreateAssetMenu(menuName = "Create new Scriptable/Minigame")]
public class Minigame : ScriptableObject
{
[Header("Minigame info")]
// Minigame index
/// <summary>
/// Index of the minigame
/// </summary>
public MinigameIndex index;
// Minigame title
/// <summary>
/// The minigame title
/// </summary>
public string title;
// Short desciption of the course
/// <summary>
/// A short description of the minigame
/// </summary>
public string description;
// Thumbnail of the course
/// <summary>
/// Reference to the minigame thumbnail
/// </summary>
public Sprite thumbnail;
[Header("Scene")]
// Reference to the minigame starting scene
/// <summary>
/// The path to the minigame starting scene (<c>path == $"Assets/{minigameEntryPoint}"</c>)
/// </summary>
public string minigameEntryPoint;
}

View File

@@ -1,5 +1,7 @@
// TODO: add other courses
/// <summary>
/// Enum for easy indexing and checking if a minigame is of a certain kind
/// </summary>
public enum MinigameIndex
{
SPELLING_BEE,

View File

@@ -3,27 +3,43 @@ using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
/// <summary>
/// Handles the display of minigames in the ListMinigameScreen scene
/// </summary>
public class MinigameItem : MonoBehaviour
{
// TODO: change to ScriptableObject Minigame;
[Header("ScriptableObject Course")]
/// <summary>
/// Reference to the minigame object
/// </summary>
public Minigame minigame;
[Header("UI references")]
// Reference to thumbnail object
/// <summary>
/// UI Reference to the image for displaying the minigame thumbnail
/// </summary>
public Image thumbnail;
// Reference to title object
/// <summary>
/// UI Reference to the gameobject for displaying the minigame title
/// </summary>
public TMP_Text title;
// Refetence to object so correct callback can be trigger on click
/// <summary>
/// UI Reference to the button so the correct callback can be trigger on click
/// </summary>
public Button button;
/// <summary>
/// Start is called before the first frame update
/// </summary>
void Start()
{
// Use public function so that this component can get Instantiated
GenerateContent();
}
/// <summary>
/// (Re)generate the MinigameItem object and update its appearance
/// </summary>
public void GenerateContent()
{
// Set appearance

View File

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

View File

@@ -1,20 +1,29 @@
using UnityEngine;
using UnityEngine.SceneManagement;
/// <summary>
/// ListMinigameScreen scene manager
/// </summary>
public class MinigameListManager : MonoBehaviour
{
[Header("Minigame list UI components")]
// Reference to minigame-list holder object
/// <summary>
/// Reference to minigame-list container object
/// </summary>
public Transform minigameContainer;
[Header("Prefabs")]
// Prefab of item
/// <summary>
/// Prefab of the minigame item object
/// </summary>
public GameObject minigameItemPrefab;
[Header("Minigames")]
// Reference to the list of all minigames
/// <summary>
/// Reference to the list of all minigames
/// </summary>
public MinigameList minigameList;
/// <summary>
/// Start is called before the first frame update
/// </summary>
void Start()
{
foreach (Minigame minigame in minigameList.minigames)
@@ -28,7 +37,10 @@ public class MinigameListManager : MonoBehaviour
}
}
// Method used as callback for on click events
/// <summary>
/// Method used as callback for minigame item onClick events
/// </summary>
/// <param name="sceneName">The path to the new scene (<c>path == $"Assets/{sceneName}"</c>)</param>
public void LoadScene(string sceneName)
{
SceneManager.LoadScene(sceneName);

View File

@@ -1,14 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.SceneManagement;
/// <summary>
/// StartScreen scene manager
/// </summary>
public class StartScreenManager : MonoBehaviour
{
/// <summary>
/// Referece to the userlist to check whether an user account is present
/// </summary>
public UserList userList;
/// <summary>
/// Check on load whether a user is already present,
/// if not load the UserCreationScreen scene so the user can create a new account
/// </summary>
void Awake()
{
if (!File.Exists(UserList.PATH) || userList.GetUsers().Count <= 0)

View File

@@ -2,18 +2,29 @@ using TMPro;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// Handles actions when a user presses the account button (upper left corner)
/// </summary>
public class UserButton : MonoBehaviour
{
[Header("User")]
// Reference to the user list, so we can extract the current user
/// <summary>
/// Reference to the user list, so we can extract the current user
/// </summary>
public UserList userList;
[Header("UI References")]
// Reference to the avatar object
/// <summary>
/// UI Reference to the avatar object
/// </summary>
public Image avatar;
// Reference to the username object
/// <summary>
/// UI Reference to the username object
/// </summary>
public TMP_Text username;
/// <summary>
/// Start is called before the first frame update
/// </summary>
void Start()
{
User user = userList.GetCurrentUser();