示例#1
0
        public static TweenOperation Create(Action callback)
        {
            var state = new State()
            {
                callback = callback,
            };

            return(TweenAction <State> .Prepare(state, new TweenOptions(0)));
        }
示例#2
0
        public static TweenOperation Create(TweenFunction function, float duration)
        {
            var state = new State()
            {
                function = function
            };

            return(TweenAction <State> .Prepare(state, new TweenOptions(duration)));
        }
示例#3
0
        static TweenParallel()
        {
            TweenAction <State> .RegisterStart(OnStart);

            TweenAction <State> .RegisterUpdate(OnUpdate);

            TweenAction <State> .RegisterComplete(OnComplete);

            TweenAction <State> .RegisterPreRelease(OnPreRelease);
        }
示例#4
0
        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));
        }
示例#6
0
            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));
            }
示例#7
0
        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)));
        }
示例#8
0
        public void RanToEnd()
        {
            if (this.status == TweenStatus.Prepared)
            {
                ChangeStatusToRunning();
            }
            AssertStatus(TweenStatus.Running);
            _actionState.elapsedTime = _actionState.duration;
            TweenAction <TState> .Update(_actionState, ref _userState);

            this.SucceedToEnd();
        }
示例#9
0
        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);
        }
示例#10
0
        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)));
        }
示例#11
0
        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));
        }
示例#12
0
        /// <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));
        }
示例#13
0
 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();
         }
     }
 }
示例#14
0
        internal static TweenOperation DelayTween(float seconds)
        {
            var state = new DelayState();

            return(TweenAction <DelayState> .Prepare(state, new TweenOptions(seconds)));
        }
示例#15
0
        static TweenDynamic()
        {
            TweenAction <State> .RegisterStart(OnStart);

            TweenAction <State> .RegisterUpdate(OnUpdate);
        }
        static MoveExtensions()
        {
            TweenAction <State> .RegisterStart(OnStart);

            TweenAction <State> .RegisterUpdate(OnUpdate);
        }
示例#17
0
            static PropertyController()
            {
                TweenAction <State> .RegisterStart(OnStart);

                TweenAction <State> .RegisterUpdate(OnUpdate);
            }
示例#18
0
 private void ChangeStatusToRunning()
 {
     AssertStatus(TweenStatus.Prepared);
     _actionState.status = TweenStatus.Running;
     TweenAction <TState> .Start(ref _userState);
 }
示例#19
0
 static CallbacksFactory()
 {
     TweenAction <State> .RegisterStart(OnStart);
 }