new_10009_YanCheng_Metrology/Assets/Template/Scripts/CXX/UI/TipPanel.cs

37 lines
770 B
C#

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class TipPanel : MonoBehaviour
{
public static TipPanel tipPrefb;
public TextMeshProUGUI m_TextMeshProUGUI;
public void Init(string tip)
{
m_TextMeshProUGUI.text= tip;
Invoke("Des", 2);
}
public void Des()
{
Destroy(gameObject);
}
public static TipPanel ShowTip(string msg)
{
if(tipPrefb==null)
tipPrefb= Resources.Load<TipPanel>("UI/UI_Tip/TipPanel");
if (GameManager.UIMgr != null)
{
TipPanel tip2 = Instantiate(tipPrefb, GameManager.UIMgr.canvas.transform);
tip2.Init(msg);
return tip2;
}
return null;
}
}