public static TweenOperation Create(Action callback) { var state = new State() { callback = callback, }; return(TweenAction <State> .Prepare(state, new TweenOptions(0))); }
public static TweenOperation Create(TweenFunction function, float duration) { var state = new State() { function = function }; return(TweenAction <State> .Prepare(state, new TweenOptions(duration))); }
static TweenParallel() { TweenAction <State> .RegisterStart(OnStart); TweenAction <State> .RegisterUpdate(OnUpdate); TweenAction <State> .RegisterComplete(OnComplete); TweenAction <State> .RegisterPreRelease(OnPreRelease); }
static TweenRepeatForever() { TweenAction <State> .RegisterStart(OnStart); TweenAction <State> .RegisterUpdate(OnUpdate); TweenAction <State> .RegisterComplete(OnCompleted); TweenAction <State> .RegisterPreRelease(OnPreRelease); }
public static TweenOperation MoveToAsync(this Transform transform, MoveToOptions options) { var state = new State() { options = options, target = transform, }; return(TweenAction <State> .Prepare(state, options.tweenOptions)); }
public static TweenOperation Prepare(object target, IPropertyAccesser <TValue> property, TValue delta, TweenOptions options) { var state = new State() { delta = delta, target = target, property = property }; return(TweenAction <State> .Prepare(state, options)); }
public static TweenOperation Create(TweenOperation source, int repeatCount) { source.autoRelease = false; source.paused = true; var state = new State() { source = source, repeatCount = repeatCount }; return(TweenAction <State> .Prepare(state, new TweenOptions(repeatCount *source.duration))); }
public void RanToEnd() { if (this.status == TweenStatus.Prepared) { ChangeStatusToRunning(); } AssertStatus(TweenStatus.Running); _actionState.elapsedTime = _actionState.duration; TweenAction <TState> .Update(_actionState, ref _userState); this.SucceedToEnd(); }
private void ReturnToPool() { AssertCompleted(); TweenAction <TState> .PreRelease(_actionState, ref _userState); UnregisterTick(); _continuations.Clear(); _token = 0; _pool.Release(this); _actionState.status = TweenStatus.NotPrepared; _userState = default(TState); Trace.TraceReturn(this); }
public static TweenOperation Create(TweenOperation source) { if (source.duration <= 0) { throw new System.ArgumentException("The duration of the tween must be positive."); } source.autoRelease = false; source.paused = true; var state = new State() { operation = source }; return(TweenAction <State> .Prepare(state, new TweenOptions(float.MaxValue))); }
private static TweenOperation CompositeInternal(List <TweenOperation> operations) { var duration = 0f; for (var i = 0; i < operations.Count; i++) { var op = operations[i]; duration = Mathf.Max(duration, op.duration); op.paused = true; op.autoRelease = false; } var state = new State() { operations = operations }; var tweenOptions = new TweenOptions(duration); return(TweenAction <State> .Prepare(state, tweenOptions)); }
/// <summary> /// operations必须是从pool中取的 /// </summary> private static TweenOperation CompositeInternal(List <TweenOperation> operations) { var duration = 0f; for (var i = 0; i < operations.Count; i++) { var op = operations[i]; duration += op.duration; op.paused = true; op.autoRelease = false; } if (duration < 0) { throw new System.InvalidOperationException("duration of tweens out of bounds"); } var state = new State() { operations = operations, }; var tweenOptions = new TweenOptions(duration); return(TweenAction <State> .Prepare(state, tweenOptions)); }
private void FireOnComplete() { UnregisterTick(); try{ TweenAction <TState> .Complete(this._actionState, ref _userState); }catch (System.Exception e) { Debug.LogException(e); } try{ foreach (var continuation in _continuations) { try{ continuation(); }catch (System.Exception e) { Debug.LogException(e); } } }finally{ if (autoRelease) { this.ReturnToPool(); } } }
internal static TweenOperation DelayTween(float seconds) { var state = new DelayState(); return(TweenAction <DelayState> .Prepare(state, new TweenOptions(seconds))); }
static TweenDynamic() { TweenAction <State> .RegisterStart(OnStart); TweenAction <State> .RegisterUpdate(OnUpdate); }
static MoveExtensions() { TweenAction <State> .RegisterStart(OnStart); TweenAction <State> .RegisterUpdate(OnUpdate); }
static PropertyController() { TweenAction <State> .RegisterStart(OnStart); TweenAction <State> .RegisterUpdate(OnUpdate); }
private void ChangeStatusToRunning() { AssertStatus(TweenStatus.Prepared); _actionState.status = TweenStatus.Running; TweenAction <TState> .Start(ref _userState); }
static CallbacksFactory() { TweenAction <State> .RegisterStart(OnStart); }