83 lines
2.0 KiB
C#
83 lines
2.0 KiB
C#
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
/// <summary>
|
|
/// UserProgressScreen scene manager
|
|
/// </summary>
|
|
public class UserProgressScreen : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// Reference to the current user
|
|
/// </summary>
|
|
private User user;
|
|
|
|
/// <summary>
|
|
/// UI reference to the username
|
|
/// </summary>
|
|
public TMP_Text username;
|
|
|
|
/// <summary>
|
|
/// UI reference to the user's avatar
|
|
/// </summary>
|
|
public Image avatar;
|
|
|
|
/// <summary>
|
|
/// Reference to the courses panel
|
|
/// </summary>
|
|
public GameObject coursesPanel;
|
|
|
|
/// <summary>
|
|
/// Reference to the minigame panel
|
|
/// </summary>
|
|
public GameObject minigamesPanel;
|
|
|
|
/// <summary>
|
|
/// Reference to the courses tab button (to set nice color)
|
|
/// </summary>
|
|
public Image coursesTabButton;
|
|
|
|
/// <summary>
|
|
/// Reference to the minigames tab button (to set nice color)
|
|
/// </summary>
|
|
public Image minigamesTabButton;
|
|
|
|
/// <summary>
|
|
/// Start is called before the first frame update
|
|
/// </summary>
|
|
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();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Switch to displaying the courses
|
|
/// </summary>
|
|
public void DisplayCourses()
|
|
{
|
|
coursesPanel.SetActive(true);
|
|
coursesTabButton.color = new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f);
|
|
minigamesPanel.SetActive(false);
|
|
minigamesTabButton.color = Color.gray;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Switch to displaying the minigames
|
|
/// </summary>
|
|
public void DisplayMinigames()
|
|
{
|
|
coursesPanel.SetActive(false);
|
|
coursesTabButton.color = Color.gray;
|
|
minigamesPanel.SetActive(true);
|
|
minigamesTabButton.color = new Color(66 / 255f, 158 / 255f, 189 / 255f, 1f);
|
|
}
|
|
}
|