using DG.Tweening; using DG.Tweening.Core; using DG.Tweening.Plugins.Options; using HighlightPlus; using QFramework; using System.Collections; using System.Collections.Generic; using UnityEngine; public class HighLightFlashItem : MonoBehaviour { HighlightEffect high; TweenerCore dotw; private void Awake() { high = GetComponent(); } public void Init(float time, int count = -1, string finishedEvent = null) { high.outline = 0; dotw = DOTween.To(() => high.outline, (v) => high.outline = v, 1, time).SetEase(Ease.OutFlash).SetLoops(count, LoopType.Yoyo).OnComplete(() => { if (string.IsNullOrEmpty(finishedEvent)==false) { StringEventSystem.Global.Send(finishedEvent); } this.Stop(); }); } public void Stop() { if (dotw != null) { dotw.Kill(); dotw = null; } high.highlighted = false; } }