Resolve WES-99 "Cc refactor"
This commit is contained in:
74
Assets/Common/Scripts/CourseActivityScreen.cs
Normal file
74
Assets/Common/Scripts/CourseActivityScreen.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Manager infopage for the Courses
|
||||
/// </summary>
|
||||
public class CourseActivityScreen : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to the courses
|
||||
/// </summary>
|
||||
public CourseList courseList;
|
||||
// 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 progressBar;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the infopage for a given course
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
int index = courseList.currentCourseIndex;
|
||||
Course course = courseList.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)
|
||||
progressBar.value = progress.Get<float>("courseProgress");
|
||||
else
|
||||
progressBar.value = 0.0f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback to start the course
|
||||
/// </summary>
|
||||
public void StartCourse()
|
||||
{
|
||||
SystemController.GetInstance().LoadNextScene("Courses/Scenes/TemplateCourse");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user