示例#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();
                    }
                });
            }
        }
示例#2
0
        /// <summary>
        /// Delaies the dequeue dialog.
        /// </summary>
        /// <returns>The dequeue dialog.</returns>
        /// <param name="coroutine">Coroutine.</param>
        /// <param name="ui">User interface.</param>
        /// <param name="resetDialogTransitionStatus">If set to <c>true</c> reset dialog transition status.</param>
        IEnumerator DelayDequeueDialog(IEnumerator coroutine, UIManBase ui, bool resetDialogTransitionStatus)
        {
            yield return(StartCoroutine(coroutine));

            IsInDialogTransition = false;
            ui.UnlockInput();
            ui.OnHideComplete();
            if (ui.GetUIBaseType() == UIBaseType.DIALOG && !resetDialogTransitionStatus)
            {
                DequeueDialog();
            }
        }
示例#3
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);
            }
        }
示例#4
0
        public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            if (stateInfo.normalizedTime >= 1.0f)
            {
                if (cachedUI == null)
                {
                    cachedUI = animator.GetComponent <UIManBase> ();
                }

                if (cachedUI.GetUIBaseType() == UIBaseType.DIALOG)
                {
                    if (isResetDialogTransitionStatus)
                    {
                        UIMan.Instance.IsInDialogTransition = false;
                    }
                    if (isDequeueDialog)
                    {
                        UIMan.Instance.DequeueDialog();
                    }
                }

                animator.enabled = false;

                if (type == UIAnimationType.SHOW)
                {
                    cachedUI.UnlockInput();
                }

                if (type == UIAnimationType.SHOW)
                {
                    cachedUI.OnShowComplete();
                }
                else if (type == UIAnimationType.HIDE)
                {
                    cachedUI.OnHideComplete();
                }

                if (autoPlayIdle)
                {
                    UIMan.Instance.DoAnimIdle(cachedUI);
                }
            }
        }
示例#5
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();
                    }
                });
            }
        }