public override void Play(bool forward) { if (null == _tweenSequence || _tweenSequence.Count == 0) { return; } _playingTweenInSequeue = _tweenSequence.Peek(); _playingTweenInSequeue.Play(forward); // if(forward) _tweenSequence.PlayForward(); // else _tweenSequence.PlayBackwards(); if (null != SyncTweenWidgets) { for (int i = SyncTweenWidgets.Length - 1; i >= 0; i--) { if (null == SyncTweenWidgets[i]) { continue; } SyncTweenWidgets[i].Play(forward); } } _isPlaying = true; }
private void TweenCallback() { if (_tweenSequence.Count > 0) { _tweenSequence.Dequeue(); } if (_tweenSequence.Count > 0) { _playingTweenInSequeue = _tweenSequence.Peek(); _playingTweenInSequeue.Play(true); } else { OnSequenceCallback(); } }
public override void AppendCompleteCallback(UnityEngine.Events.UnityAction action) { IDOTweenUtil tween = null; for (int i = AsyncTweenWidgets.Length - 1; i >= 0; i--) { tween = AsyncTweenWidgets[i]; if (null == tween) { continue; } tween.AppendCompleteCallback(action); break; } // if(tween == null) _appendCallback = action; }
protected virtual void SetupSequence(IDOTweenUtil[] asyncTweens, IDOTweenUtil[] syncTweens, bool isInit) { /* * if(null != _tweenSequence) _tweenSequence.Kill(); * * _tweenSequence = DOTween.Sequence(); * * IDOTweenUtil tween; * for(int i = 0, count = asyncTweens.Length; i<count; i++) * { * tween = asyncTweens[i]; * if(null == tween) continue; * tween.SetTarget(Target); * tween.SetResetOnDisable(false); * tween.SetAutoPlayOnEnable(false); * tween.ResetTween(); * _tweenSequence.Append(tween.GetTween()); * } * * _tweenSequence.OnComplete(OnSequenceCallback); * * if(null != syncTweens && syncTweens.Length > 0) * { * for(int i = 0, count = syncTweens.Length; i<count; i++) * { * tween = syncTweens[i]; * if(null == tween) continue; * tween.SetTarget(Target); * tween.SetResetOnDisable(false); * tween.SetAutoPlayOnEnable(false); * tween.ResetTween(); * } * } */ _tweenSequence.Clear(); _isPlaying = false; _playingTweenInSequeue = null; IDOTweenUtil tween; for (int i = 0, count = asyncTweens.Length; i < count; i++) { tween = asyncTweens[i]; if (null == tween) { continue; } if (tween == this) { DYLogger.LogError("Can not add self to sequence"); continue; } tween.SetTarget(Target); tween.SetResetOnDisable(false); tween.SetAutoPlayOnEnable(false); tween.ResetTween(); AppendTween(tween); } if (null != syncTweens && syncTweens.Length > 0) { for (int i = 0, count = syncTweens.Length; i < count; i++) { tween = syncTweens[i]; if (null == tween) { continue; } tween.SetTarget(Target); tween.SetResetOnDisable(false); tween.SetAutoPlayOnEnable(false); tween.ResetTween(); } } Pause(); }
private void AppendTween(IDOTweenUtil tween) { _tweenSequence.Enqueue(tween); tween.AppendCompleteCallback(TweenCallback); }