using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using DG.Tweening; /* 弹窗管理者 */ public class PopupMgr : MonoBehaviour { public static PopupMgr _ins; public static PopupMgr ins { get { if (!_ins) { _ins = new GameObject("PopupMgr").AddComponent(); } return _ins; } } Transform popupRoot; void Awake() { popupRoot = GameObject.Instantiate(Resources.Load("Prefabs/Popups/PopupRoot"), transform).transform; } void OnDestroy() { if (_ins == this) _ins = null; } public void ShowTip(string text) { Transform tipGroup = popupRoot.Find("TipGroup"); ClearAllTip(); GameObject tipPrefab = tipGroup.Find("Tip").gameObject; GameObject tipObj = GameObject.Instantiate(tipPrefab, tipGroup); tipObj.GetComponentInChildren().text = text; tipObj.SetActive(true); Sequence seq = DOTween.Sequence(); seq.PrependInterval(4f); seq.AppendCallback(() => { HideTip(tipObj); FadeOutTip(tipObj); }); tipObj.GetComponent