first commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class InteractionPromptUI : MonoBehaviour
|
||||
{
|
||||
public static InteractionPromptUI Instance { get; private set; }
|
||||
|
||||
public GameObject root;
|
||||
public Text promptText;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null && Instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
Instance = this;
|
||||
Hide();
|
||||
}
|
||||
|
||||
public void Show(string message)
|
||||
{
|
||||
if (root == null || promptText == null || string.IsNullOrWhiteSpace(message))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
promptText.text = message;
|
||||
root.SetActive(true);
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
if (root != null)
|
||||
{
|
||||
root.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user