Example #1
0
        public virtual void SlideIn(float duration, SlideTo to, TweenCallback onComplete=null)
        {
            if (isTransitionComplete == false)
                return;
            isTransitionComplete = false;

            switch (to)
            {
            case SlideTo.Up:
                rectTransform.localPosition = _defaultLocalPosition + new Vector3 (0.0f, -rectTransform.sizeDelta.y);
                break;
            case SlideTo.Down:
                rectTransform.localPosition = _defaultLocalPosition + new Vector3 (0.0f, rectTransform.sizeDelta.y);
                break;
            case SlideTo.Left:
                rectTransform.localPosition = _defaultLocalPosition + new Vector3 (rectTransform.sizeDelta.x, 0.0f);
                break;
            case SlideTo.Right:
                rectTransform.localPosition = _defaultLocalPosition + new Vector3 (-rectTransform.sizeDelta.x, 0.0f);
                break;
            default:
                Debug.LogErrorFormat ("{0} NotFoend {1}", typeof (SlideTo).Name, to);
                break;
            }

            Sequence tween = DOTween.Sequence ().Append (rectTransform
                .DOLocalMoveX (0.0f, duration)
                .OnComplete (OnCompleteTransition));

            if (onComplete != null)
                tween.OnComplete (onComplete);
            tween.Play ();
        }
Example #2
0
        public virtual void SlideOut(float duration, SlideTo to, TweenCallback onComplete=null)
        {
            if (isTransitionComplete == false)
                return;
            isTransitionComplete = false;

            rectTransform.localPosition = _defaultLocalPosition;
            Sequence tween = DOTween.Sequence ();
            switch (to)
            {
            case SlideTo.Up:
                tween.Append (rectTransform
                    .DOLocalMoveY (_defaultLocalPosition.y + rectTransform.sizeDelta.y, duration)
                    .OnComplete (OnCompleteTransition));
                break;
            case SlideTo.Down:
                tween.Append (rectTransform
                    .DOLocalMoveY (_defaultLocalPosition.y - rectTransform.sizeDelta.y, duration)
                    .OnComplete (OnCompleteTransition));
                break;
            case SlideTo.Left:
                tween.Append (rectTransform
                    .DOLocalMoveX (_defaultLocalPosition.x - rectTransform.sizeDelta.x, duration)
                    .OnComplete (OnCompleteTransition));
                break;
            case SlideTo.Right:
                tween.Append (rectTransform
                    .DOLocalMoveX (_defaultLocalPosition.x + rectTransform.sizeDelta.x, duration)
                    .OnComplete (OnCompleteTransition));
                break;
            default:
                Debug.LogErrorFormat ("{0} NotFoend {1}", typeof (SlideTo).Name, to);
                break;
            }
            if (onComplete != null)
                tween.OnComplete (onComplete);
            tween.Play ();
        }
Example #3
0
        public override void SlideOut(float duration, SlideTo to, TweenCallback onComplete=null)
        {
            if (isTransitionComplete == false)
                return;

            foreach (RectTransform trans in rectTransform)
            {
                UICanvasPanel panel = trans.GetComponent<UICanvasPanel> ();
                if (panel != null)
                    panel.SlideOut (duration, to, onComplete);
            }
        }