Project_WL/Assets/Script/UI/ETC/ToastUI.cs

41 lines
843 B
C#

using TMPro;
using UnityEngine;
public class ToastUI : MonoBehaviourSingletonTemplate<ToastUI>
{
public GameObject m_go;
public TextMeshProUGUI label_msg;
float t;
protected override void Awake()
{
base.Awake();
m_go.SetActive(false);
}
public void Set(int _msgkey)
{
m_go.SetActive(false);
m_go.SetActive(true);
label_msg.text = table_localtext.Ins.Get_Text(_msgkey);
t = 3f;
}
public void Set(int _msgkey, params object[] args)
{
m_go.SetActive(false);
m_go.SetActive(true);
label_msg.text = DSUtil.Format(_msgkey, args);
t = 3f;
}
private void Update()
{
if (t > 0f)
{
t -= Time.deltaTime;
if (t <= 0f)
m_go.SetActive(false);
}
}
}