using TMPro;
using UnityEngine;
using UnityEngine.UI;

/// <summary>
/// Handles actions when a user presses the account button (upper left corner)
/// </summary>
public class UserButton : MonoBehaviour
{
    /// <summary>
    /// Reference to the user list, so we can extract the current user
    /// </summary>
    public UserList userList;

    /// <summary>
    /// UI Reference to the avatar object
    /// </summary>
    public Image avatar;

    /// <summary>
    /// UI Reference to the username object
    /// </summary>
    public TMP_Text username;

    /// <summary>
    /// Start is called before the first frame update
    /// </summary>
    void Start()
    {
        User user = userList.GetCurrentUser();
        avatar.sprite = user.avatar;
        username.text = user.username;
    }
}
