Beispiel #1
0
        /// <summary>
        /// Starts the fade screen transition animation
        /// </summary>
        private void StartFadeAnimation(TransitionInfo transitionInfo, bool show, float duration)
        {
            float fromAlpha = show ? 0f : 1f;
            float toAlpha   = show ? 1f : 0f;

            UIAnimation anim = UIAnimation.Alpha(gameObject, fromAlpha, toAlpha, duration);

            anim.style             = transitionInfo.animationStyle;
            anim.animationCurve    = transitionInfo.animationCurve;
            anim.startOnFirstFrame = true;

            if (!show)
            {
                anim.OnAnimationFinished = (GameObject obj) =>
                {
                    SetVisibility(false);
                };
            }
            else
            {
                anim.OnAnimationFinished = null;
            }

            anim.Play();
        }
Beispiel #2
0
        public void Hide(bool cancelled, object[] outData)
        {
            if (!isShowing)
            {
                return;
            }

            isShowing = false;

            if (callback != null)
            {
                callback(cancelled, outData);
            }

            // Start the popup hide animations
            UIAnimation anim = null;

            anim                   = UIAnimation.Alpha(gameObject, 1f, 0f, animDuration);
            anim.style             = UIAnimation.Style.EaseOut;
            anim.startOnFirstFrame = true;

            anim.OnAnimationFinished += (GameObject target) =>
            {
                gameObject.SetActive(false);
            };

            anim.Play();

            OnHiding();
        }
Beispiel #3
0
        private void DoFadeAnim()
        {
            // Start the popup show animations
            UIAnimation anim = null;

            anim = UIAnimation.Alpha(gameObject, 0f, 1f, animDuration);
            anim.startOnFirstFrame   = true;
            anim.OnAnimationFinished = null;
            anim.Play();
        }
Beispiel #4
0
 private void OnSwitchingScreens(string fromScreenId, string toScreenId)
 {
     if (toScreenId == ScreenManager.Instance.HomeScreenId)
     {
         // Fade out the back button
         PlayAnimation(UIAnimation.Alpha(gameObject, 1f, 0f, fadeDuration));
         Button.interactable = false;
     }
     else if (fromScreenId == ScreenManager.Instance.HomeScreenId)
     {
         // Fade in the back button
         PlayAnimation(UIAnimation.Alpha(gameObject, 0f, 1f, fadeDuration));
         Button.interactable = true;
     }
 }
Beispiel #5
0
        private void DoZoomAnim()
        {
            // Start the popup show animations
            UIAnimation anim = null;

            anim                     = UIAnimation.Alpha(gameObject, 0f, 1f, animDuration);
            anim.style               = UIAnimation.Style.EaseOut;
            anim.startOnFirstFrame   = true;
            anim.OnAnimationFinished = null;
            anim.Play();

            anim                   = UIAnimation.ScaleX(animContainer, 0f, 1f, animDuration);
            anim.style             = UIAnimation.Style.Custom;
            anim.animationCurve    = animCurve;
            anim.startOnFirstFrame = true;
            anim.Play();

            anim                   = UIAnimation.ScaleY(animContainer, 0f, 1f, animDuration);
            anim.style             = UIAnimation.Style.Custom;
            anim.animationCurve    = animCurve;
            anim.startOnFirstFrame = true;
            anim.Play();
        }