using TMPro; using UnityEngine; using UnityEngine.UI; /// /// Handles actions when a user presses the account button (upper left corner) /// public class UserButton : MonoBehaviour { /// /// UI reference to the avatar object /// public Image avatar; /// /// UI reference to the username object /// public TMP_Text username; /// /// UI reference to the dropdown box with all options /// public GameObject dropdownBox; /// /// Start is called before the first frame update /// void Start() { PersistentDataController.GetInstance().Load(); User user = UserList.GetCurrentUser(); avatar.sprite = user.GetAvatar(); username.text = user.GetUsername(); dropdownBox.SetActive(false); } /// /// Change to the UserProgressScreen scene /// public void OpenProgressCallback() { SystemController.GetInstance().LoadNextScene("Accounts/Scenes/UserProgressScreen"); } /// /// Change to the ChangeUserScreen scene /// public void ChangeUserCallback() { SystemController.GetInstance().LoadNextScene("Accounts/Scenes/ChangeUserScreen"); } /// /// Toggle the dropdown box /// public void ToggleDropdown() { dropdownBox.SetActive(!dropdownBox.activeSelf); } }