123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- 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<TweenPlayFxCacheData>(this);
- if (!tweenPlayFxCacheData.isPalyFx)
- {
- ParticleSystem[] particleSystems = graphic.transform.GetComponentsInChildren<ParticleSystem>();
- 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<TweenPlayFxCacheData>(this);
- tweenPlayFxCacheData.isPalyFx = false;
- }
- }
- }
|