using TMPro; using UnityEngine; using UnityEngine.UI; /// /// UserProgressScreen scene manager /// public class UserProgressScreen : MonoBehaviour { /// /// Reference to the current user /// private User user; /// /// UI reference to the username /// public TMP_Text username; /// /// UI reference to the user's avatar /// public Image avatar; /// /// Reference to the courses panel /// public GameObject coursesPanel; /// /// Reference to the minigame panel /// public GameObject minigamesPanel; /// /// Reference to the courses tab button (to set nice color) /// public Image coursesTabButton; /// /// Reference to the minigames tab button (to set nice color) /// public Image minigamesTabButton; /// /// Start is called before the first frame update /// void Start() { // Assign the current user PersistentDataController.GetInstance().Load(); user = UserList.GetCurrentUser(); // Set correct displayed items username.text = user.GetUsername(); avatar.sprite = user.GetAvatar(); DisplayCourses(); } /// /// Switch to displaying the courses /// public void DisplayCourses() { coursesPanel.SetActive(true); coursesTabButton.color = new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f); minigamesPanel.SetActive(false); minigamesTabButton.color = Color.gray; } /// /// Switch to displaying the minigames /// public void DisplayMinigames() { coursesPanel.SetActive(false); coursesTabButton.color = Color.gray; minigamesPanel.SetActive(true); minigamesTabButton.color = new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f); } }