コード例 #1
0
ファイル: SingleTween.cs プロジェクト: tianz0607/IFramework
 private void OnLoopCompelete()
 {
     if (_tv != null)
     {
         _tv.Recyle();
         _tv = null;
     }
 }
コード例 #2
0
ファイル: SingleTween.cs プロジェクト: tianz0607/IFramework
        public override void Rewind(float duration, bool snap = false)
        {
            if (recyled)
            {
                return;
            }
            direction = TweenDirection.Forward;
            RecycleInner();
            _tv           = TweenValue.Get <T>(env.envType);
            _tv.converter = converter;
            var plugin = Allocate <RecyclablePlugin <T> >(env.envType);

            plugin.Config(current, start, duration, getter, (value) => { current = value; }, snap);
            _tv.Config(plugin, TryRecyleSelf);
            _tv.Run();
        }
コード例 #3
0
ファイル: Tween.cs プロジェクト: ly774508966/IFramework
 private void RecycleInner()
 {
     if (_tv != null && !_tv.recyled)
     {
         _tv.Recyle();
         _tv = null;
     }
     if (_seq != null && !_seq.recyled)
     {
         _seq.Recyle();
         _seq = null;
     }
     if (_repeat != null && !_repeat.recyled)
     {
         _repeat.Recyle();
         _repeat = null;
     }
 }
コード例 #4
0
ファイル: Tween.cs プロジェクト: ly774508966/IFramework
        public void Rewind(float dur)
        {
            if (recyled)
            {
                return;
            }
            _startToEnd = true;

            RecycleInner();

            _tv       = TweenValue.Get <T>(env.envType);
            _tv.curve = curve;
            _tv.Config(cur, start, dur, getter,
                       (value) => { cur = value; },
                       () => {
                TryRecyleSelf();
            });
            _tv.Run();
        }
コード例 #5
0
        private void OnLoopCompele()
        {
            switch (loopType)
            {
            case LoopType.ReStart:
                _index++;
                _index    = (_index) % (_array.Length - 1);
                direction = TweenDirection.Forward;
                break;

            case LoopType.PingPong:
                switch (direction)
                {
                case TweenDirection.Forward:
                    _index++;
                    if (_index >= _array.Length - 1)
                    {
                        direction = TweenDirection.Back;
                    }
                    break;

                case TweenDirection.Back:
                    _index--;
                    if (_index <= 0)
                    {
                        direction = TweenDirection.Forward;
                    }
                    break;

                default:
                    break;
                }
                break;

            default:
                break;
            }
            if (_tv != null)
            {
                _tv.Recyle();
                _tv = null;
            }
        }
コード例 #6
0
ファイル: SingleTween.cs プロジェクト: tianz0607/IFramework
        private void OnLoopBegin()
        {
            if (recyled)
            {
                return;
            }
            _tv           = TweenValue.Get <T>(env.envType);
            _tv.converter = converter;
            switch (loopType)
            {
            case LoopType.ReStart:
            {
                var plugin = Allocate <RecyclablePlugin <T> >(env.envType);
                plugin.Config(start, end, duration, getter, (value) => { current = value; }, snap);
                _tv.Config(plugin, null);
            }
            break;

            case LoopType.PingPong:
                if (direction == TweenDirection.Forward)
                {
                    var plugin = Allocate <RecyclablePlugin <T> >(env.envType);
                    plugin.Config(start, end, duration, getter, (value) => { current = value; }, snap);
                    _tv.Config(plugin, null);
                    direction = TweenDirection.Back;
                }
                else
                {
                    var plugin = Allocate <RecyclablePlugin <T> >(env.envType);
                    plugin.Config(end, start, duration, getter, (value) => { current = value; }, snap);
                    _tv.Config(plugin, null);
                    direction = TweenDirection.Forward;
                }
                break;

            default:
                break;
            }
            _tv.Run();
        }
コード例 #7
0
        private void OnLoopBegin()
        {
            if (recyled)
            {
                return;
            }
            _tv           = TweenValue.Get <T>(env.envType);
            _tv.converter = converter;
            switch (direction)
            {
            case TweenDirection.Forward:
            {
                T   _start = _array[_index];
                T   _end   = _array[_index + 1];
                var plugin = Allocate <RecyclablePlugin <T> >(env.envType);
                plugin.Config(_start, _end, duration / (_array.Length - 1), getter, (value) => { current = value; }, snap);
                _tv.Config(plugin, null);
            }
            break;

            case TweenDirection.Back:
            {
                T   _end   = _array[_index - 1];
                T   _start = _array[_index];
                var plugin = Allocate <RecyclablePlugin <T> >(env.envType);
                plugin.Config(_start, _end, duration / (_array.Length - 1), getter, (value) => { current = value; }, snap);

                _tv.Config(plugin, null);
            }
            break;

            default:
                break;
            }
            _tv.Run();
        }
コード例 #8
0
ファイル: Tween.cs プロジェクト: ly774508966/IFramework
        public void Run()
        {
            if (recyled)
            {
                return;
            }

            _seq = this.Sequence(env.envType)
                   .Repeat((r) =>
            {
                _repeat = r.Sequence((s) =>
                {
                    s.Until(() => {
                        if (recyled)
                        {
                            return(true);
                        }
                        return(_tv.compeleted);
                    })
                    .OnCompelete(() => {
                        if (_tv != null)
                        {
                            _tv.Recyle();
                            _tv = null;
                        }
                    })
                    .OnBegin(() => {
                        if (recyled)
                        {
                            return;
                        }

                        _tv       = TweenValue.Get <T>(env.envType);
                        _tv.curve = curve;
                        switch (loopType)
                        {
                        case LoopType.ReStart:
                            _tv.Config(start, end, dur, getter, (value) => { cur = value; }, null);
                            break;

                        case LoopType.PingPong:
                            if (_startToEnd)
                            {
                                _tv.Config(start, end, dur, getter, (value) => { cur = value; }, null);

                                _startToEnd = false;
                            }
                            else
                            {
                                _tv.Config(end, start, dur, getter, (value) => { cur = value; }, null);

                                _startToEnd = true;
                            }
                            //if (cur.Equals(start))

                            //else if(cur .Equals(end))
                            //    _tv.Config(end, start, dur, getter, (value) => { cur = value; }, null);
                            //else
                            //    _tv.Config(start, end, dur, getter, (value) => { cur = value; }, null);

                            break;

                        default:
                            break;
                        }
                        _tv.Run();
                    });
                });
            }, loop)
                   .OnCompelete(() =>
            {
                if (onCompelete != null)
                {
                    onCompelete();
                }
                TryRecyleSelf();
            })
                   .Run();
        }