/// <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(); } }); } }
/// <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); } }
/// <summary> /// Dos the animation show. /// </summary> /// <param name="ui">User interface.</param> private void DoAnimShow(UIManBase ui) { ui.LockInput(); if (ui.motionShow == UIMotion.CustomMecanimAnimation) { // Custom animation use animator ui.CanvasGroup.alpha = 1; ui.animRoot.EnableAndPlay(UIManDefine.ANIM_SHOW); } else if (ui.motionShow == UIMotion.CustomScriptAnimation) { // Custom animation use overrided function ui.animRoot.Disable(); StartCoroutine(DelayDequeueDialog(ui.AnimationShow(), ui, true)); } else { // Simple tween ui.animRoot.Disable(); Vector3 initPos = GetTargetPosition(ui.motionShow, UIManDefine.ARR_SHOW_TARGET_POS); ui.RectTransform.localPosition = initPos; ui.CanvasGroup.alpha = 0; // Tween position if (ui.motionShow != UIMotion.None) { UITweener.Move(ui.gameObject, ui.animTime, ui.showPosition); } UITweener.Alpha(ui.gameObject, ui.animTime, 0f, 1f).SetOnComplete(() => { ui.OnShowComplete(); OnShowUIComplete(ui); if (ui.GetUIBaseType() == UIBaseType.Dialog) { this.IsInDialogTransition = false; } ui.UnlockInput(); DoAnimIdle(ui); }); } }
/// <summary> /// Dos the animation show. /// </summary> /// <param name="ui">User interface.</param> void DoAnimShow(UIManBase ui) { ui.LockInput(); if (ui.motionShow == UIMotion.CUSTOM_MECANIM_ANIMATION) //Custom animation use animator { ui.animRoot.EnableAndPlay(UIManDefine.ANIM_SHOW); } else if (ui.motionShow == UIMotion.CUSTOM_SCRIPT_ANIMATION) //Custom animation use overrided function { ui.animRoot.Disable(); StartCoroutine(DelayDequeueDialog(ui.AnimationShow(), ui, true)); } else // Simple tween { ui.animRoot.Disable(); Vector3 initPos = GetTargetPosition(ui.motionShow, UIManDefine.ARR_SHOW_TARGET_POS); ui.RectTrans.localPosition = initPos; ui.GroupCanvas.alpha = 0; // Tween position if (ui.motionShow != UIMotion.NONE) { LeanTween.move(ui.RectTrans, ui.showPosition, ui.animTime) .setEase(LeanTweenType.linear); } // Tween alpha LeanTween.value(ui.gameObject, ui.UpdateAlpha, 0.0f, 1.0f, ui.animTime) .setEase(LeanTweenType.linear) .setOnComplete(show => { ui.OnShowComplete(); OnShowUIComplete(ui); if (ui.GetUIBaseType() == UIBaseType.DIALOG) { IsInDialogTransition = false; } ui.UnlockInput(); DoAnimIdle(ui); }); } }
/// <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(); } }); } }