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 = Color.blue;
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 = Color.blue;
}
}