Beispiel #1
0
        public void DestroyUI <T>()
        {
            Type uiType = typeof(T);
            var  dialog = uiType.BaseType == typeof(UIManDialog) ? true : false;

            UIManBase ui = null;

            if (dialog)
            {
                if (this.dialogDict.ContainsKey(uiType))
                {
                    ui = this.dialogDict[uiType];
                    this.dialogDict.Remove(uiType);
                }
            }
            else
            {
                if (this.screenDict.ContainsKey(uiType))
                {
                    ui = this.screenDict[uiType];
                    this.screenDict.Remove(uiType);
                }
            }

            if (ui != null)
            {
                Destroy(ui.gameObject);
            }
        }
Beispiel #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();
                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();
                    }
                });
            }
        }
Beispiel #3
0
        public void DestroyUI <T> (bool dialog)
        {
            Type      uiType = typeof(T);
            UIManBase ui     = null;

            if (dialog)
            {
                if (dialogDict.ContainsKey(uiType))
                {
                    ui = dialogDict [uiType];
                    dialogDict.Remove(uiType);
                }
            }
            else
            {
                if (screenDict.ContainsKey(uiType))
                {
                    ui = screenDict [uiType];
                    screenDict.Remove(uiType);
                }
            }

            if (ui != null)
            {
                Destroy(ui.gameObject);
            }
        }
Beispiel #4
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();
            }
        }
Beispiel #5
0
 /// <summary>
 /// Dos the animation idle.
 /// </summary>
 /// <param name="ui">User interface.</param>
 public void DoAnimIdle(UIManBase ui)
 {
     if (ui.motionIdle == UIMotion.CUSTOM_MECANIM_ANIMATION)               //Custom animation use animator
     {
         ui.animRoot.EnableAndPlay(UIManDefine.ANIM_IDLE);
     }
     else if (ui.motionHide == UIMotion.CUSTOM_SCRIPT_ANIMATION)                 //Custom animation use overrided function
     {
         StartCoroutine(DelayDequeueDialog(ui.AnimationIdle(), ui, false));
     }
     else                 // Simple tween
                          //UnuUnuLogger.Log("UIMan does not support simple tween animation for idle yet!");
     {
     }
 }
Beispiel #6
0
        public static string GetScriptPathByType(Type type)
        {
            var typeName    = type.Name;
            var assets      = AssetDatabase.FindAssets(typeName);
            var scriptPath  = "";
            var isViewModel = false;

            if (type == typeof(UIManBase))
            {
                isViewModel = true;
            }

            foreach (var asset in assets)
            {
                scriptPath = AssetDatabase.GUIDToAssetPath(asset);

                if (scriptPath.EndsWith(".cs", StringComparison.OrdinalIgnoreCase))
                {
                    if (isViewModel)
                    {
                        UIManBase viewModelAsset = AssetDatabase.LoadAssetAtPath <UIManBase>(scriptPath);

                        if (viewModelAsset)
                        {
                            break;
                        }
                    }
                    else
                    {
                        TextAsset script = AssetDatabase.LoadAssetAtPath <TextAsset>(scriptPath);

                        if (script && script.name.Equals(typeName))
                        {
                            break;
                        }
                    }
                }
            }

            TextAsset textAsset = AssetDatabase.LoadAssetAtPath <TextAsset>(scriptPath);

            if (textAsset)
            {
                return(scriptPath);
            }

            return(string.Empty);
        }
Beispiel #7
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);
            }
        }
Beispiel #8
0
        /// <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);
                });
            }
        }
Beispiel #9
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            UIManBase uiManBase = (UIManBase)target;

            if (uiManBase is UIManDialog)
            {
                UIManDialog dialog = (UIManDialog)uiManBase;
                dialog.useCover = EditorGUILayout.Toggle(cover, dialog.useCover);
                EditorUtility.SetDirty(target);
            }

            if (uiManBase.motionShow == UIMotion.CUSTOM_MECANIM_ANIMATION || uiManBase.motionHide == UIMotion.CUSTOM_MECANIM_ANIMATION)
            {
                if (uiManBase.gameObject != null)
                {
                    uiManBase.animRoot = uiManBase.gameObject.GetComponent <Animator> ();
                }

                uiManBase.animRoot = EditorGUILayout.ObjectField(animator, uiManBase.animRoot, typeof(Animator), true) as Animator;

                if (uiManBase.animRoot == null || uiManBase.animRoot.runtimeAnimatorController == null)
                {
                    if (GUILayout.Button("Generate Animator"))
                    {
                        AnimationEditorUtils.GenerateAnimator(uiManBase.gameObject, UIManDefine.ANIM_SHOW, UIManDefine.ANIM_HIDE, UIManDefine.ANIM_IDLE);
                    }
                }
            }

            uiManBase.motionShow   = (UIMotion)EditorGUILayout.EnumPopup(show, uiManBase.motionShow);
            uiManBase.motionHide   = (UIMotion)EditorGUILayout.EnumPopup(hide, uiManBase.motionHide);
            uiManBase.motionIdle   = (UIMotion)EditorGUILayout.EnumPopup(idle, uiManBase.motionIdle);
            uiManBase.animTime     = EditorGUILayout.FloatField(time, uiManBase.animTime);
            uiManBase.showPosition = EditorGUILayout.Vector3Field(position, uiManBase.showPosition);

            if (GUILayout.Button("Edit Logic"))
            {
                string handler = CodeGenerationHelper.GetScriptPathByType(target.GetType());
                handler = handler.Replace(".cs", ".Handler.cs");
                UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(handler, 1);
            }
        }
Beispiel #10
0
        /// <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);
                });
            }
        }
Beispiel #11
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);
                }
            }
        }
Beispiel #12
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();
                    }
                });
            }
        }
Beispiel #13
0
        /// <summary>
        /// Preprocesses the UI.
        /// </summary>
        /// <param name="prefab">Prefab.</param>
        /// <param name="args">Arguments.</param>
        void PreprocessUI(GameObject prefab, object[] args)
        {
            Type uiType = (Type)args [0];

            if (prefab == null)
            {
                UnuLogger.LogFormatWarning("UI Error: cannot find {0}, make sure you have put UI prefab in Resources folder!", uiType.Name);
                return;
            }

            GameObject uiObj = Instantiate(prefab) as GameObject;

            uiObj.name = uiType.Name;

            UIManBase uiBase = uiObj.GetComponent <UIManBase> ();

            if (uiBase is UIManScreen)
            {
                uiBase.Trans.SetParent(screenRoot, false);
                uiBase.RectTrans.localScale = Vector3.one;
                if (!screenDict.ContainsKey(uiType))
                {
                    screenDict.Add(uiType, uiBase as UIManScreen);
                }
                bool     seal  = (bool)args [1];
                object[] param = (object[])args [2];
                ShowScreen(uiType, seal, param);
            }
            else if (uiBase is UIManDialog)
            {
                uiBase.Trans.SetParent(dialogRoot, false);
                uiBase.RectTrans.localScale = Vector3.one;
                dialogDict.Add(uiType, uiBase as UIManDialog);
                UICallback callbacks = (UICallback)args [1];
                object[]   param     = (object[])args [2];
                IsLoadingDialog = false;
                ShowDialog(uiType, callbacks, param);
            }
        }
Beispiel #14
0
        void PreprocessPreload(GameObject prefab, object[] args)
        {
            Type uiType = (Type)args [0];

            if (prefab == null)
            {
                UnuLogger.LogFormatWarning("UI Error: cannot find {0}, make sure you have put UI prefab in Resources folder!", uiType.Name);
                return;
            }

            GameObject uiObj = Instantiate(prefab) as GameObject;

            uiObj.name = uiType.Name;
            uiObj.GetComponent <CanvasGroup> ().alpha = 0;

            UIManBase uiBase = uiObj.GetComponent <UIManBase> ();

            if (uiBase is UIManScreen)
            {
                uiBase.Trans.SetParent(screenRoot, false);
                uiBase.RectTrans.localScale = Vector3.one;
                if (!screenDict.ContainsKey(uiType))
                {
                    screenDict.Add(uiType, uiBase as UIManScreen);
                }
            }
            else if (uiBase is UIManDialog)
            {
                uiBase.Trans.SetParent(dialogRoot, false);
                uiBase.RectTrans.localScale = Vector3.one;
                if (!dialogDict.ContainsKey(uiType))
                {
                    dialogDict.Add(uiType, uiBase as UIManDialog);
                }
            }
            uiBase.ForceState(UIState.HIDE);
        }
Beispiel #15
0
        public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            if (stateInfo.normalizedTime >= 1.0f)
            {
                if (this.cachedUI == null)
                {
                    this.cachedUI = animator.GetComponent <UIManBase>();
                }
                if (this.cachedUI.GetUIBaseType() == UIBaseType.Dialog)
                {
                    if (this.isResetDialogTransitionStatus)
                    {
                        UIMan.Instance.IsInDialogTransition = false;
                    }
                    if (this.isDequeueDialog)
                    {
                        UIMan.Instance.DequeueDialog();
                    }
                }

                if (this.type == UIAnimationType.Show)
                {//TODO: bug!?
                    this.cachedUI.UnlockInput();
                    this.cachedUI.OnShowComplete();
                }
                else if (this.type == UIAnimationType.Hide)
                {
                    this.cachedUI.OnHideComplete();
                }

                if (this.autoPlayIdle && this.cachedUI.motionIdle == UIMotion.CustomMecanimAnimation)
                {
                    UIMan.Instance.DoAnimIdle(this.cachedUI);
                }
            }
        }
Beispiel #16
0
        /// <summary>
        /// Dos the animation idle.
        /// </summary>
        /// <param name="ui">User interface.</param>
        public void DoAnimIdle(UIManBase ui)
        {
            if (ui.motionIdle == UIMotion.CustomMecanimAnimation)
            {
                // Custom animation use animator
                ui.animRoot.EnableAndPlay(UIManDefine.ANIM_IDLE);
            }
            else if (ui.motionHide == UIMotion.CustomScriptAnimation)
            {
                // Custom animation use overrided function
                ui.animRoot.Disable();
                StartCoroutine(DelayDequeueDialog(ui.AnimationIdle(), ui, false));
            }
            else
            {
                // Simple tween
                ui.animRoot.Disable();

                if (ui.motionIdle != UIMotion.None && ui.motionIdle != UIMotion.Hidden)
                {
                    UnuLogger.LogWarning("UIMan does not support simple tween animation for idle yet!", this);
                }
            }
        }
Beispiel #17
0
 /// <summary>
 /// Raises the back event.
 /// </summary>
 /// <param name="before">Before.</param>
 /// <param name="after">After.</param>
 /// <param name="args">Arguments.</param>
 private void OnBack(UIManBase handlerBefore, UIManBase handlerAfter, params object[] args)
 {
     UIEventDispatcher.TriggerEvent(UIManEvents.UIMan.OnBack, handlerBefore, handlerAfter, args);
 }
Beispiel #18
0
 /// <summary>
 /// Raises the show UI event.
 /// </summary>
 /// <param name="dialog">Dialog.</param>
 /// <param name="args">Arguments.</param>
 void OnShowUI(UIManBase handler, params object[] args)
 {
     UIEventDispatcher.TriggerEvent <UIManBase, object[]> (UIManEvents.UIMan.OnShowUI, handler, args);
 }
Beispiel #19
0
 /// <summary>
 /// Raises the hide U event.
 /// </summary>
 /// <param name="ui">User interface.</param>
 void OnHideUI(UIManBase handler)
 {
     UIEventDispatcher.TriggerEvent <UIManBase> (UIManEvents.UIMan.OnHideUI, handler);
 }
Beispiel #20
0
 /// <summary>
 /// Raises the hide user interface complete event.
 /// </summary>
 /// <param name="ui">User interface.</param>
 private void OnHideUIComplete(UIManBase handler)
 {
     UIEventDispatcher.TriggerEvent(UIManEvents.UIMan.OnHideUIComplete, handler);
 }
Beispiel #21
0
 /// <summary>
 /// Raises the show user interface complete event.
 /// </summary>
 /// <param name="ui">User interface.</param>
 /// <param name="args">Arguments.</param>
 private void OnShowUIComplete(UIManBase handler, params object[] args)
 {
     UIEventDispatcher.TriggerEvent(UIManEvents.UIMan.OnShowUIComplete, handler, args);
 }
Beispiel #22
0
        public override void OnInspectorGUI()
        {
            GUILayout.BeginHorizontal("Box");
            LabelHelper.HeaderLabel("UIMan View Model");
            GUILayout.EndHorizontal();
            LineHelper.Draw(Color.gray);

            UIManBase uiManBase = (UIManBase)target;

            EditorGUILayout.Space();
            LabelHelper.HeaderLabel("General");
            GUILayout.BeginVertical("Box");

            if (uiManBase is UIManDialog)
            {
                UIManDialog dialog = (UIManDialog)uiManBase;
                dialog.useCover = EditorGUILayout.Toggle(cover, dialog.useCover);
                EditorUtility.SetDirty(target);
            }
            else if (uiManBase is UIManBase)
            {
                UIManScreen screen = (UIManScreen)uiManBase;
                screen.useBackground = EditorGUILayout.Toggle(background, screen.useBackground);
                if (screen.useBackground)
                {
                    screen.backgroundType = EditorGUILayout.TextField(screen.backgroundType);
                }
                EditorUtility.SetDirty(target);
            }

            if (uiManBase.motionShow == UIMotion.CUSTOM_MECANIM_ANIMATION || uiManBase.motionHide == UIMotion.CUSTOM_MECANIM_ANIMATION)
            {
                if (uiManBase.gameObject != null)
                {
                    uiManBase.animRoot = uiManBase.gameObject.GetComponent <Animator> ();
                }

                uiManBase.animRoot = EditorGUILayout.ObjectField(animator, uiManBase.animRoot, typeof(Animator), true) as Animator;

                if (uiManBase.animRoot == null || uiManBase.animRoot.runtimeAnimatorController == null)
                {
                    if (GUILayout.Button("Generate Animator"))
                    {
                        AnimationEditorUtils.GenerateAnimator(uiManBase.gameObject, UIManDefine.ANIM_SHOW, UIManDefine.ANIM_HIDE, UIManDefine.ANIM_IDLE);
                    }
                }
            }

            uiManBase.motionShow = (UIMotion)EditorGUILayout.EnumPopup(show, uiManBase.motionShow);
            uiManBase.motionHide = (UIMotion)EditorGUILayout.EnumPopup(hide, uiManBase.motionHide);
            uiManBase.motionIdle = (UIMotion)EditorGUILayout.EnumPopup(idle, uiManBase.motionIdle);

            UIMotion[] motions = new UIMotion[3] {
                uiManBase.motionShow, uiManBase.motionHide, uiManBase.motionIdle
            };
            bool haveMecanimAnim = false;
            bool haveTweenAnim   = false;

            foreach (UIMotion m in motions)
            {
                if ((int)m == 7)
                {
                    haveMecanimAnim = true;
                }
                else
                {
                    haveTweenAnim = true;
                }
            }
            if (haveTweenAnim && haveMecanimAnim)
            {
                GUILayout.BeginHorizontal("Box");
                EditorGUILayout.LabelField("<color=red><b>Warning: </b>Your motion type is not match with each others so it maybe cause unexpected error!\nPlease select all motion type as Mecanim if you want to make you animation manually with Unity animation editor!</color>", EditorGUIHelper.RichText(true));
                GUILayout.EndHorizontal();
            }

            if (uiManBase.motionIdle != UIMotion.CUSTOM_MECANIM_ANIMATION && uiManBase.motionIdle != UIMotion.NONE)
            {
                GUILayout.BeginHorizontal("Box");
                EditorGUILayout.LabelField("<color=red><b>Warning: </b>Idle motion is now only support Mecanim animation!</color>", EditorGUIHelper.RichText(true));
                GUILayout.EndHorizontal();
            }

            uiManBase.animTime     = EditorGUILayout.FloatField(time, uiManBase.animTime);
            uiManBase.showPosition = EditorGUILayout.Vector3Field(position, uiManBase.showPosition);

            GUILayout.EndVertical();
            LineHelper.Draw(Color.gray);

            EditorGUILayout.Space();
            LabelHelper.HeaderLabel("Custom fields");
            GUILayout.BeginVertical("Box");
            DrawDefaultInspector();
            GUILayout.EndVertical();

            EditorGUILayout.Space();
            if (GUILayout.Button("Edit View (UI)", GUILayout.Height(25)))
            {
                GameObject         prefabInstance;
                UnityEngine.Object obj = FindObjectOfType(uiManBase.UIType);
                if (obj != null)
                {
                    prefabInstance = ((MonoBehaviour)obj).gameObject;
                }
                else
                {
                    bool isDialog = uiManBase.GetUIBaseType() == UIBaseType.DIALOG;
//					string prefabFolder = GetUIPrefabPath (selectedType, isDialog);
//					string prefabFile = selectedType.Name + PREFAB_EXT;
//					string prefabPath = Path.Combine (prefabFolder, prefabFile);
//					GameObject prefab = AssetDatabase.LoadAssetAtPath<GameObject> (prefabPath);
//					if (prefab == null) {
//						prefab = FindAssetObject<GameObject> (selectedType.Name, PREFAB_EXT);
//					}

                    prefabInstance = PrefabUtility.InstantiatePrefab(uiManBase.gameObject) as GameObject;
                    if (isDialog)
                    {
                        prefabInstance.transform.SetParent(UIMan.Instance.dialogRoot, false);
                    }
                    else
                    {
                        prefabInstance.transform.SetParent(UIMan.Instance.screenRoot, false);
                    }
                }
                Selection.activeGameObject = prefabInstance;
            }
            if (GUILayout.Button("Edit View Logic (Handler)", GUILayout.Height(25)))
            {
                string handler = CodeGenerationHelper.GetScriptPathByType(target.GetType());
                handler = handler.Replace(".cs", ".Handler.cs");
                UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(handler, 1);
            }
        }