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

@@ -0,0 +1,58 @@
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
/// <summary>
/// Class to handle course progress card display
/// </summary>
public class CourseProgressCard : MonoBehaviour
{
/// <summary>
/// Callback to the UpdateSelection
/// </summary>
public UnityAction selectActivity;
/// <summary>
/// Button to place to callback on
/// </summary>
public Button button;
/// <summary>
/// Reference to the progress so we can display a progress bar
/// </summary>
public Progress courseProgress;
/// <summary>
/// Reference to the list of courses so we can query the correct course
/// </summary>
public CourseList courseList;
/// <summary>
/// UI reference to the thumbnail of the course
/// </summary>
public Image thumbnail;
/// <summary>
/// UI refeerence to the title of the course
/// </summary>
public TMP_Text title;
/// <summary>
/// Reference to the progress bar for the course
/// </summary>
public Slider progressBar;
/// <summary>
/// Start is called before the first frame update
/// </summary>
void Start()
{
Course course = courseList.GetCourseByIndex(courseProgress.Get<CourseIndex>("courseIndex"));
thumbnail.sprite = course.thumbnail;
title.text = course.title;
progressBar.value = courseProgress.Get<float>("courseProgress");
button.onClick.AddListener(selectActivity);
}
}