| 123456789101112131415161718192021222324252627282930 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using DG.Tweening;
- public class PopupMgr
- {
- public static PopupMgr _ins;
- public static PopupMgr ins {
- get {
- if (_ins == null) {
- _ins = new PopupMgr();
- }
- return _ins;
- }
- }
- public void ShowTip(string text) {
- GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Popups/PopupCanvas"));
- Text textComp = o.transform.Find("Tip").GetComponent<Text>();
- textComp.text = text;
- GameObject.DontDestroyOnLoad(o);
- Sequence seq = DOTween.Sequence();
- seq.PrependInterval(3);
- seq.AppendCallback(() => {
- GameObject.Destroy(o);
- });
- }
- }
|