42 lines
1007 B
C#
42 lines
1007 B
C#
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<float, float, FloatOptions> dotw;
|
|
|
|
public void Init(float time, int count = -1, string finishedEvent = null)
|
|
{
|
|
high = GetComponent<HighlightEffect>();
|
|
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;
|
|
}
|
|
|
|
|
|
}
|