using Fort23.UTool; using UnityEngine; namespace Core.UI.UTool.UITween { [System.Serializable] public class TweenPlayFx : TweenBasic { public GameObject GetCanvasGroup(Object CanvasGroup) { GameObject graphic = CanvasGroup as GameObject; if (graphic == null) { GameObject gameObject = CanvasGroup as GameObject; if (gameObject != null) { graphic = gameObject; } } return graphic; } protected override void ProPlay(UITweenController uiTweenController, Object CanvasGroup, float allTime) { GameObject graphic = GetCanvasGroup(CanvasGroup); if (graphic == null) { return; } TweenPlayFxCacheData tweenPlayFxCacheData = uiTweenController.GetCacheData(this); if (!tweenPlayFxCacheData.isPalyFx) { ParticleSystem[] particleSystems = graphic.transform.GetComponentsInChildren(); tweenPlayFxCacheData.isPalyFx = true; for (int i = 0; i < particleSystems.Length; i++) { particleSystems[i].Stop(); particleSystems[i].Clear(false); particleSystems[i].Play(false); } } } protected override void ProRest(UITweenController uiTweenController, Object CanvasGroup) { TweenPlayFxCacheData tweenPlayFxCacheData = uiTweenController.GetCacheData(this); tweenPlayFxCacheData.isPalyFx = false; } } }