Esempio n. 1
0
        /// <summary>
        /// Dos the animation hide.
        /// </summary>
        /// <param name="ui">User interface.</param>
        void DoAnimHide(UIManBase ui)
        {
            ui.LockInput();
            if (ui.motionHide == UIMotion.CUSTOM_MECANIM_ANIMATION)               //Custom animation use animator
            {
                ui.animRoot.EnableAndPlay(UIManDefine.ANIM_HIDE);
            }
            else if (ui.motionHide == UIMotion.CUSTOM_SCRIPT_ANIMATION)                 //Custom animation use overrided function
            {
                ui.animRoot.Disable();
                StartCoroutine(DelayDequeueDialog(ui.AnimationHide(), ui, false));
            }
            else                 // Simple tween

            {
                ui.animRoot.Disable();
                Vector3 hidePos = GetTargetPosition(ui.motionHide, UIManDefine.ARR_HIDE_TARGET_POS);
                // Tween position
                if (ui.motionHide != UIMotion.NONE)
                {
                    UITweener.Move(ui.gameObject, ui.animTime, hidePos);
                }
                UITweener.Alpha(ui.gameObject, ui.animTime, 1f, 0f).SetOnComplete(() => {
                    ui.RectTrans.anchoredPosition3D = hidePos;
                    ui.OnHideComplete();
                    OnHideUIComplete(ui);
                    if (ui.GetUIBaseType() == UIBaseType.DIALOG)
                    {
                        IsInDialogTransition = false;
                        DequeueDialog();
                    }
                });
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Dos the animation hide.
        /// </summary>
        /// <param name="ui">User interface.</param>
        void DoAnimHide(UIManBase ui)
        {
            ui.LockInput();
            if (ui.motionHide == UIMotion.CUSTOM_MECANIM_ANIMATION)               //Custom animation use animator
            {
                ui.animRoot.EnableAndPlay(UIManDefine.ANIM_HIDE);
            }
            else if (ui.motionHide == UIMotion.CUSTOM_SCRIPT_ANIMATION)                 //Custom animation use overrided function
            {
                ui.animRoot.Disable();
                StartCoroutine(DelayDequeueDialog(ui.AnimationHide(), ui, false));
            }
            else                 // Simple tween

            {
                ui.animRoot.Disable();

                // Stop current tween if exist
                LeanTween.cancel(ui.gameObject);
                LeanTween.cancel(bgRectTrans.gameObject);

                Vector3 hidePos = GetTargetPosition(ui.motionHide, UIManDefine.ARR_HIDE_TARGET_POS);

                // Tween position
                if (ui.motionHide != UIMotion.NONE)
                {
                    LeanTween.move(ui.RectTrans, hidePos, ui.animTime).setEase(LeanTweenType.linear);
                }

                // Tween alpha
                LeanTween.value(ui.gameObject, ui.UpdateAlpha, 1.0f, 0.0f, ui.animTime)
                .setEase(LeanTweenType.linear)
                .setOnComplete(hide => {
                    ui.RectTrans.anchoredPosition3D = hidePos;
                    ui.OnHideComplete();
                    OnHideUIComplete(ui);
                    if (ui.GetUIBaseType() == UIBaseType.DIALOG)
                    {
                        IsInDialogTransition = false;
                        DequeueDialog();
                    }
                });

                LeanTween.alpha(bgRectTrans, 0, 0.25f).setEase(LeanTweenType.linear);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Dos the animation hide.
        /// </summary>
        /// <param name="ui">User interface.</param>
        private void DoAnimHide(UIManBase ui)
        {
            ui.LockInput();
            if (ui.motionHide == UIMotion.CustomMecanimAnimation)
            {
                // Custom animation use animator
                ui.animRoot.EnableAndPlay(UIManDefine.ANIM_HIDE);
            }
            else if (ui.motionHide == UIMotion.CustomScriptAnimation)
            {
                // Custom animation use overrided function
                ui.animRoot.Disable();
                StartCoroutine(DelayDequeueDialog(ui.AnimationHide(), ui, false));
            }
            else
            {
                // Simple tween
                ui.animRoot.Disable();
                Vector3 hidePos = GetTargetPosition(ui.motionHide, UIManDefine.ARR_HIDE_TARGET_POS);

                // Tween position
                if (ui.motionHide != UIMotion.None)
                {
                    UITweener.Move(ui.gameObject, ui.animTime, hidePos);
                }

                UITweener.Alpha(ui.gameObject, ui.animTime, 1f, 0f).SetOnComplete(() => {
                    ui.RectTransform.anchoredPosition3D = hidePos;
                    ui.OnHideComplete();
                    OnHideUIComplete(ui);

                    if (ui.GetUIBaseType() == UIBaseType.Dialog)
                    {
                        this.IsInDialogTransition = false;
                        DequeueDialog();
                    }
                });
            }
        }