72 lines
1.7 KiB
C#
72 lines
1.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using TMPro; // For text
|
|
|
|
/// <summary>
|
|
/// Manager infopage for the Courses
|
|
/// </summary>
|
|
public class InfoCourse : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// Reference to the courses
|
|
/// </summary>
|
|
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.
|
|
|
|
/// <summary>
|
|
/// Reference to the users
|
|
/// </summary>
|
|
public UserList userList;
|
|
|
|
/// <summary>
|
|
/// Reference to the course progress
|
|
/// </summary>
|
|
private Progress progress;
|
|
|
|
/// <summary>
|
|
/// Title Display
|
|
/// </summary>
|
|
public TMP_Text title;
|
|
|
|
/// <summary>
|
|
/// Description Display
|
|
/// </summary>
|
|
public TMP_Text description;
|
|
|
|
/// <summary>
|
|
/// Image Display (Thumbnail)
|
|
/// </summary>
|
|
public Image courseImage;
|
|
|
|
/// <summary>
|
|
/// Progress bar Display
|
|
/// </summary>
|
|
public Slider slider;
|
|
|
|
|
|
// Start is called before the first frame update
|
|
/// <summary>
|
|
/// Sets the infopage for a given course
|
|
/// </summary>
|
|
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<float>("courseProgress");
|
|
else
|
|
slider.value = 0.0f;
|
|
}
|
|
|
|
}
|