Resolve WES-43 "Minigame framework"

This commit is contained in:
Dries Van Schuylenbergh
2023-03-06 12:14:25 +00:00
parent f670c0cd0a
commit 9eebf4e4f2
34 changed files with 3092 additions and 2354 deletions

View File

@@ -1,4 +1,3 @@
using JetBrains.Annotations;
using System.Collections;
using System.Collections.Generic;
using TMPro;
@@ -16,10 +15,15 @@ public class CourseItem : MonoBehaviour
public string courseScene;
[Header("UI references")]
// Reference to thumbnail object
public Image thumbnail;
// Reference to title object
public TMP_Text title;
// Refetence to object so correct callback can be trigger on click
public Button button;
// Reference to progress bar
public GameObject slider;
// Reference to `COMPLETED`
public GameObject completed;
@@ -29,11 +33,6 @@ public class CourseItem : MonoBehaviour
GenerateContent();
}
private void LoadCourseInfo()
{
SceneManager.LoadScene(courseScene);
}
public void GenerateContent()
{
// Set appearance
@@ -45,8 +44,8 @@ public class CourseItem : MonoBehaviour
completed.SetActive(1.0f <= progress);
slider.SetActive(0.0f < progress && progress < 1.0f);
slider.GetComponent<Slider>().value = progress;
// Add click functionality
button.onClick.AddListener(LoadCourseInfo);
button.onClick.AddListener(() => SceneManager.LoadScene(courseScene));
}
}