41 lines
756 B
C#
41 lines
756 B
C#
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.UI;
|
||
|
|
|
||
|
|
namespace OTGIntegrated.UI
|
||
|
|
{
|
||
|
|
public sealed class TooltipUI : MonoBehaviour
|
||
|
|
{
|
||
|
|
public GameObject root;
|
||
|
|
public Text contentText;
|
||
|
|
|
||
|
|
private void Awake()
|
||
|
|
{
|
||
|
|
if (root == null)
|
||
|
|
{
|
||
|
|
root = gameObject;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Show(string content)
|
||
|
|
{
|
||
|
|
if (root != null)
|
||
|
|
{
|
||
|
|
root.SetActive(true);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (contentText != null)
|
||
|
|
{
|
||
|
|
contentText.text = content;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Hide()
|
||
|
|
{
|
||
|
|
if (root != null)
|
||
|
|
{
|
||
|
|
root.SetActive(false);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|