40 lines
747 B
C#
40 lines
747 B
C#
|
|
using TMPro;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class ToastUI : MonoBehaviourSingletonTemplate<ToastUI>
|
||
|
|
{
|
||
|
|
public TextMeshProUGUI label_msg;
|
||
|
|
|
||
|
|
float t;
|
||
|
|
|
||
|
|
public void Set(int _msgkey)
|
||
|
|
{
|
||
|
|
Set_Common();
|
||
|
|
label_msg.text = table_localtext.Ins.Get_Text(_msgkey);
|
||
|
|
}
|
||
|
|
public void Set(int _msgkey, params object[] args)
|
||
|
|
{
|
||
|
|
Set_Common();
|
||
|
|
label_msg.text = DSUtil.Format(_msgkey, args);
|
||
|
|
}
|
||
|
|
public void Set(string msg)
|
||
|
|
{
|
||
|
|
Set_Common();
|
||
|
|
label_msg.text = msg;
|
||
|
|
}
|
||
|
|
void Set_Common()
|
||
|
|
{
|
||
|
|
On();
|
||
|
|
t = 3f;
|
||
|
|
}
|
||
|
|
|
||
|
|
private void Update()
|
||
|
|
{
|
||
|
|
if (t > 0f)
|
||
|
|
{
|
||
|
|
t -= Time.deltaTime;
|
||
|
|
if (t <= 0f)
|
||
|
|
Off();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|