2025-09-13 02:42:04 +00:00
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class ToastUI : MonoBehaviour
|
|
|
|
|
{
|
2025-09-13 21:35:38 +00:00
|
|
|
public RectTransform rt_bg;
|
2025-09-13 02:42:04 +00:00
|
|
|
public TextMeshProUGUI t_mgs;
|
|
|
|
|
|
|
|
|
|
public void Set(string text)
|
|
|
|
|
{
|
|
|
|
|
gameObject.SetActive(true);
|
|
|
|
|
t_mgs.text = text;
|
2025-09-13 21:35:38 +00:00
|
|
|
rt_bg.sizeDelta = new Vector2(rt_bg.sizeDelta.x, t_mgs.preferredHeight + 50);
|
2025-09-13 02:42:04 +00:00
|
|
|
|
|
|
|
|
if (IsInvoking()) CancelInvoke();
|
|
|
|
|
Invoke("Off", 3f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Off() { gameObject.SetActive(false); }
|
|
|
|
|
}
|