using UnityEngine; using UnityEngine.UI; using XFrame.Core.UI; using XFrame.Core.Tool; using System.Collections; using DG.Tweening; public class TipPanel : XUIPanel { public Image bg; public Text tip; Tween t; public TipPanel() : base(UIType.PopUp, UIMode.HideOther, UICollider.None) { uiPath = "UI/TipPanel/Prefabs/TipPanel"; } public override void Awake(GameObject go) { AutoAssign.InitObject(this, transform); } public override void Active() { base.Active(); string tips = (string)Data; // 排序,最高层 transform.SetAsLastSibling(); if (string.IsNullOrEmpty(tips)) { Hide(); } else { t.Kill(); XUIPanel.ClosePanel(); tip.text = tips; float timeCount = 1; t = DOTween.To(() => timeCount, a => timeCount = a, 1, 3).OnComplete(() => { Hide(); }); } } }