chip-game/Assets/Scripts/ContactsLabel.cs

31 lines
759 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using TMPro;
using UnityEngine;
public class ContactsLabel : MonoBehaviour
{
public string startText = "администрация: ";
TextMeshProUGUI label;
private void OnEnable()
{
label = GetComponent<TextMeshProUGUI>();
SettingsManager.OnSettingsChanged.AddListener(pullSettings);
InvokeRepeating("pullSettings", 0, 10);
}
void pullSettings()
{
string contact;
if (PlayerPrefs.HasKey("NumberTech"))
{
contact = PlayerPrefs.GetString("NumberTech");
}
else contact = "<Не указано>";
if (SettingsManager.GetBool("ShowNumber", true))
label.text = startText + contact;
else
label.text = "";
}
}