using System.Collections.Generic; using UnityEngine; namespace Core.UI.UTool.UITween { [System.Serializable] public class TweenAssetGrpupInfo { [HideInInspector] public bool Foldout; public bool isActive; public string animName; public List allTargets = new List(); public TweenAssetInfo TweenAssetInfo; public bool TargetFoldout = true; public float maxDuration; public bool isUpdate; [HideInInspector] public float currTime; // public List allTweenInfo = new List(); public void StartPlay() { if (TweenAssetInfo == null) { return; } maxDuration = 0; for (int i = 0; i < TweenAssetInfo.allTweenInfo.Count; i++) { TweenEntity tweenEntity = TweenAssetInfo.allTweenInfo[i]; if (tweenEntity.duration + tweenEntity.delay > maxDuration) { maxDuration = tweenEntity.duration + tweenEntity.delay; } tweenEntity.Prepare(); tweenEntity.Rest(allTargets[i]); } isUpdate = true; currTime = 0; } public void SetMaxTime() { maxDuration = 0; if (TweenAssetInfo == null) { return; } for (int i = 0; i < TweenAssetInfo.allTweenInfo.Count; i++) { TweenEntity tweenEntity = TweenAssetInfo.allTweenInfo[i]; if (tweenEntity.duration + tweenEntity.delay > maxDuration) { maxDuration = tweenEntity.duration + tweenEntity.delay; } } } public void JumpToTime(float t) { if (TweenAssetInfo == null) { return; } for (int i = 0; i < TweenAssetInfo.allTweenInfo.Count; i++) { TweenAssetInfo.allTweenInfo[i].Prepare(); // allTweenInfo[i].Rest(); } PlayTween(t, true); } public void PlayTween(float t, bool isFallBack) { if (TweenAssetInfo == null) { return; } for (int i = 0; i < TweenAssetInfo.allTweenInfo.Count; i++) { TweenAssetInfo.allTweenInfo[i].Play(allTargets[i], t, isFallBack); } } } }