| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 | 
							- using System;
 
- using System.Collections.Generic;
 
- using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
 
- using UnityEngine;
 
- using Utility;
 
- using Object = UnityEngine.Object;
 
- namespace Core.UI.UTool.UITween
 
- {
 
-     [ExecuteAlways]
 
-     public class UITweenController : MonoBehaviour
 
-     {
 
-         public float maxDuration;
 
-         public bool isUpdate;
 
-         [HideInInspector] public float currTime;
 
-         public List<TweenAssetGrpupInfo> GrpupInfos = new List<TweenAssetGrpupInfo>();
 
-         private BetterList<TweenAssetGrpupInfo> _currPlay = new BetterList<TweenAssetGrpupInfo>();
 
-         public ParticleSystem.MinMaxGradient MinMaxGradient = new ParticleSystem.MinMaxGradient();
 
-         public bool isLoop;
 
-         private List<UITweenController> _uiTweenControllers = new List<UITweenController>();
 
-         private Map<TweenBasic, TweenCacheDataBasic> _currPayCacheData = new Map<TweenBasic, TweenCacheDataBasic>();
 
-         private void OnEnable()
 
-         {
 
-             if (Application.isPlaying)
 
-             {
 
-                 StartPlay(false);
 
-             }
 
-         }
 
-         void OnDrawGizmos()
 
-         {
 
- #if UNITY_EDITOR
 
-             if (!Application.isPlaying)
 
-             {
 
-                 UnityEditor.EditorApplication.QueuePlayerLoopUpdate();
 
-                 UnityEditor.SceneView.RepaintAll();
 
-             }
 
- #endif
 
-         }
 
-         public T GetCacheData<T>(TweenBasic tweenBasic) where T : TweenCacheDataBasic, new()
 
-         {
 
-             if (_currPayCacheData.TryGetValue(tweenBasic, out TweenCacheDataBasic tweenPlayFxCacheData))
 
-             {
 
-                 return tweenPlayFxCacheData as T;
 
-             }
 
-             T t = new T();
 
-             _currPayCacheData.Add(tweenBasic, t as TweenCacheDataBasic);
 
-             return t;
 
-         }
 
-         public void Play(string animName, bool isChildren)
 
-         {
 
-             _uiTweenControllers.Clear();
 
-             maxDuration = 0;
 
-             _currPlay.Clear();
 
-             isLoop = false;
 
-             for (int i = 0; i < GrpupInfos.Count; i++)
 
-             {
 
-                 TweenAssetGrpupInfo tweenAssetGrpupInfo = GrpupInfos[i];
 
-                 tweenAssetGrpupInfo.SetMaxTime();
 
-                 if (tweenAssetGrpupInfo.animName.Equals(animName))
 
-                 {
 
-                     if (tweenAssetGrpupInfo.maxDuration > maxDuration)
 
-                     {
 
-                         maxDuration = tweenAssetGrpupInfo.maxDuration;
 
-                     }
 
-                     if (tweenAssetGrpupInfo.isLoop)
 
-                     {
 
-                         isLoop = true;
 
-                     }
 
-                     tweenAssetGrpupInfo.StartPlay(this);
 
-                     _currPlay.Add(tweenAssetGrpupInfo);
 
-                 }
 
-             }
 
-             if (isChildren)
 
-             {
 
-                 UITweenController[] uiTweenControllers =
 
-                     gameObject.transform.GetComponentsInChildren<UITweenController>();
 
-                 _uiTweenControllers.AddRange(uiTweenControllers);
 
-                 _uiTweenControllers.Remove(this);
 
-                 for (int i = 0; i < _uiTweenControllers.Count; i++)
 
-                 {
 
-                     UITweenController uiTweenController = _uiTweenControllers[i];
 
-                     // if(uiTweenController.)
 
-                     uiTweenController.StartPlay(false);
 
-                     if (uiTweenController.maxDuration > maxDuration)
 
-                     {
 
-                         maxDuration = uiTweenController.maxDuration;
 
-                     }
 
-                     if (uiTweenController.isLoop)
 
-                     {
 
-                         isLoop = true;
 
-                     }
 
-                 }
 
-             }
 
-             isUpdate = true;
 
-             currTime = 0;
 
-         }
 
-         public void Stop()
 
-         {
 
-             isUpdate = false;
 
-         }
 
-         public void StartPlay(bool isChildren)
 
-         {
 
-             _uiTweenControllers.Clear();
 
-             maxDuration = 0;
 
-             _currPlay.Clear();
 
-             isLoop = false;
 
-             for (int i = 0; i < GrpupInfos.Count; i++)
 
-             {
 
-                 TweenAssetGrpupInfo tweenAssetGrpupInfo = GrpupInfos[i];
 
-                 tweenAssetGrpupInfo.SetMaxTime();
 
-                 if (tweenAssetGrpupInfo.isActive)
 
-                 {
 
-                     if (tweenAssetGrpupInfo.maxDuration > maxDuration)
 
-                     {
 
-                         maxDuration = tweenAssetGrpupInfo.maxDuration;
 
-                     }
 
-                     if (tweenAssetGrpupInfo.isLoop)
 
-                     {
 
-                         isLoop = true;
 
-                     }
 
-                     tweenAssetGrpupInfo.StartPlay(this);
 
-                     _currPlay.Add(tweenAssetGrpupInfo);
 
-                 }
 
-             }
 
-             if (isChildren)
 
-             {
 
-                 UITweenController[] uiTweenControllers =
 
-                     gameObject.transform.GetComponentsInChildren<UITweenController>();
 
-                 _uiTweenControllers.AddRange(uiTweenControllers);
 
-                 _uiTweenControllers.Remove(this);
 
-                 for (int i = 0; i < _uiTweenControllers.Count; i++)
 
-                 {
 
-                     UITweenController uiTweenController = _uiTweenControllers[i];
 
-                     uiTweenController.StartPlay(false);
 
-                     if (uiTweenController.maxDuration > maxDuration)
 
-                     {
 
-                         maxDuration = uiTweenController.maxDuration;
 
-                     }
 
-                     if (uiTweenController.isLoop)
 
-                     {
 
-                         isLoop = true;
 
-                     }
 
-                 }
 
-             }
 
-             isUpdate = true;
 
-             currTime = 0;
 
-         }
 
-         public void SetMaxTime()
 
-         {
 
-             maxDuration = 0;
 
-             for (int i = 0; i < GrpupInfos.Count; i++)
 
-             {
 
-                 TweenAssetGrpupInfo tweenAssetGrpupInfo = GrpupInfos[i];
 
-                 tweenAssetGrpupInfo.SetMaxTime();
 
-                 if (tweenAssetGrpupInfo.isActive)
 
-                 {
 
-                     if (tweenAssetGrpupInfo.maxDuration > maxDuration)
 
-                     {
 
-                         maxDuration = tweenAssetGrpupInfo.maxDuration;
 
-                     }
 
-                 }
 
-             }
 
-             for (int i = 0; i < _uiTweenControllers.Count; i++)
 
-             {
 
-                 UITweenController uiTweenController = _uiTweenControllers[i];
 
-                 uiTweenController.SetMaxTime();
 
-                 if (uiTweenController.maxDuration > maxDuration)
 
-                 {
 
-                     maxDuration = uiTweenController.maxDuration;
 
-                 }
 
-             }
 
-         }
 
-         public void JumpToTime(float t)
 
-         {
 
-             _currPlay.Clear();
 
-             for (int i = 0; i < GrpupInfos.Count; i++)
 
-             {
 
-                 TweenAssetGrpupInfo tweenAssetGrpupInfo = GrpupInfos[i];
 
-                 tweenAssetGrpupInfo.SetMaxTime();
 
-                 if (tweenAssetGrpupInfo.isActive)
 
-                 {
 
-                     if (tweenAssetGrpupInfo.maxDuration > maxDuration)
 
-                     {
 
-                         maxDuration = tweenAssetGrpupInfo.maxDuration;
 
-                     }
 
-                     //
 
-                     // if (tweenAssetGrpupInfo.isLoop)
 
-                     // {
 
-                     //     isLoop = true;
 
-                     // }
 
-                     tweenAssetGrpupInfo.StartPlay(this);
 
-                     _currPlay.Add(tweenAssetGrpupInfo);
 
-                 }
 
-             }
 
-             for (int i = 0; i < _currPlay.Count; i++)
 
-             {
 
-                 _currPlay[i].JumpToTime(this, t);
 
-                 // allTweenInfo[i].Rest();
 
-             }
 
-             for (int i = 0; i < _currPlay.Count; i++)
 
-             {
 
-                 _currPlay[i].PlayTween(this, t, true);
 
-             }
 
-             UITweenController[] uiTweenControllers =
 
-                 gameObject.transform.GetComponentsInChildren<UITweenController>();
 
-             _uiTweenControllers.AddRange(uiTweenControllers);
 
-             _uiTweenControllers.Remove(this);
 
-             for (int i = 0; i < _uiTweenControllers.Count; i++)
 
-             {
 
-                 UITweenController uiTweenController = _uiTweenControllers[i];
 
-                 uiTweenController.JumpToTime(t);
 
-                 if (uiTweenController.maxDuration > maxDuration)
 
-                 {
 
-                     maxDuration = uiTweenController.maxDuration;
 
-                 }
 
-             }
 
-             // PlayTween(t, true);
 
-         }
 
-         private void PlayTween(float t, bool isFallBack)
 
-         {
 
-             for (int i = 0; i < GrpupInfos.Count; i++)
 
-             {
 
-                 GrpupInfos[i].PlayTween(this, t, isFallBack);
 
-             }
 
-         }
 
-         private void Update()
 
-         {
 
-             if (!isUpdate)
 
-             {
 
-                 return;
 
-             }
 
-             currTime += Time.deltaTime;
 
-             for (int i = 0; i < _currPlay.Count; i++)
 
-             {
 
-                 _currPlay[i].PlayTween(this, currTime, false);
 
-             }
 
-             for (int i = 0; i < _uiTweenControllers.Count; i++)
 
-             {
 
-                 _uiTweenControllers[i].PlayTween(currTime, false);
 
-             }
 
-             if (!isLoop && currTime >= maxDuration)
 
-             {
 
-                 isUpdate = false;
 
-                 _currPlay.Clear();
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |