using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro; // For text
///
/// Manager infopage for the Courses
///
public class InfoCourse : MonoBehaviour
{
///
/// Reference to the courses
///
public CourseList list;
// private float maxvalue; In case we want to change progress e.g. amount of words correct, then change maxvalue amount of words etc.
///
/// Reference to the users
///
public UserList userList;
///
/// Reference to the course progress
///
private Progress progress;
///
/// Title Display
///
public TMP_Text title;
///
/// Description Display
///
public TMP_Text description;
///
/// Image Display (Thumbnail)
///
public Image courseImage;
///
/// Progress bar Display
///
public Slider slider;
// Start is called before the first frame update
///
/// Sets the infopage for a given course
///
void Start()
{
int index = list.currentCourseIndex;
Course course = list.courses[index];
title.text = course.title;
description.text = course.description;
courseImage.sprite = course.thumbnail;
//slider.value = progressValue;
// Set progress
progress = userList.GetCurrentUser().GetCourseProgress(course.index);
if (progress != null)
slider.value = progress.Get("courseProgress");
else
slider.value = 0.0f;
}
}