using UnityEngine; using UnityEngine.UI; using System.Collections; using DG.Tweening; /// /// UIÌáʾ /// public class ImageTips : MonoBehaviour { public Image image; // UI Image×é¼þ private RectTransform selfRect; private Tween tween; public void ShowTips(RectTransform target) { gameObject.SetActive(true); selfRect = GetComponent(); image.enabled = true; selfRect.SetParent(target); selfRect.anchoredPosition = Vector2.zero; selfRect.sizeDelta = new Vector2(target.sizeDelta.x + 20f, target.sizeDelta.x + 20f); tween = DOVirtual.Float(1, 0.2f, 1f, t => { Color finalColor = image.color; finalColor.a = t; image.color = finalColor; }).SetLoops(-1, LoopType.Yoyo); } public void HideTips() { if (tween != null) tween.Kill(true); transform.parent = null; gameObject.SetActive(false); } }