34 lines
713 B
C#
34 lines
713 B
C#
using TMPro;
|
|
using UnityEngine;
|
|
|
|
namespace RoR2.UI;
|
|
|
|
[RequireComponent(typeof(TextMeshProUGUI))]
|
|
[RequireComponent(typeof(MPEventSystemLocator))]
|
|
public class ProfileNameLabel : MonoBehaviour
|
|
{
|
|
public string token;
|
|
|
|
private MPEventSystemLocator eventSystemLocator;
|
|
|
|
private TextMeshProUGUI label;
|
|
|
|
private string currentUserName;
|
|
|
|
private void Awake()
|
|
{
|
|
eventSystemLocator = GetComponent<MPEventSystemLocator>();
|
|
label = GetComponent<TextMeshProUGUI>();
|
|
}
|
|
|
|
private void LateUpdate()
|
|
{
|
|
string text = PlatformSystems.userManager.GetUserName() ?? string.Empty;
|
|
if (text != currentUserName)
|
|
{
|
|
currentUserName = text;
|
|
label.text = Language.GetStringFormatted(token, currentUserName);
|
|
}
|
|
}
|
|
}
|