Ejemplo n.º 1
0
        /// <summary>
        /// Tweenコルーチン.
        /// </summary>
        IEnumerator _CoScrollTweening(Tweening.TweenMethod tweenType, float time, float startValue, float endValue)
        {
            // Tween中はScrollRect自体の動作(inertia/movementType)を制限します.
            handler.scrollRect.velocity = Vector2.zero;
            _inertia      = handler.scrollRect.inertia;
            _movementType = handler.scrollRect.movementType;
            handler.scrollRect.inertia      = false;
            handler.scrollRect.movementType = ScrollRect.MovementType.Unrestricted;
            bool positive = 0 < (endValue - startValue);

            if (tweenType == Tweening.TweenMethod.immediate || time <= 0)
            {
                handler.OnChangeTweenPosition(endValue, positive);
                yield return(null);
            }
            else
            {
                // Tweenを実行します.
                float unscaleTimer = 0;
                while (unscaleTimer < time)
                {
                    handler.OnChangeTweenPosition(Tweening.GetTweenValue(tweenType, startValue, endValue, unscaleTimer / time), positive);
                    unscaleTimer += Time.unscaledDeltaTime;
                    yield return(null);
                }
            }

            // Tweenを停止します.
            handler.OnChangeTweenPosition(endValue, positive);
            _StopScrollTween();
            yield break;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Tweenを実行します.
 /// </summary>
 public void StartScrollTween(Tweening.TweenMethod tweenType, float time, float startValue, float endValue)
 {
     _StopScrollTween();
     _coTweening = handler.scrollRect.StartCoroutine(_CoScrollTweening(tweenType, time, startValue, endValue));
 }