Ejemplo n.º 1
0
        private void DrawSelectedTypeHeader()
        {
            // Title
            GUILayout.Space(2);
            LabelHelper.TitleLabel(_selectedType.Name);
            LineHelper.Draw(Color.gray);

            // Common
            GUILayout.Space(2);

            if (_selectedType.BaseType != typeof(ObservableModel))
            {
                DrawHeaderButtons();
            }

            // Base type
            GUILayout.Space(10);
            LabelHelper.HeaderLabel("Type");
            GUILayout.Space(2);
            this.baseTypePopup.Draw();

            GUILayout.Space(4);
            _selectedTypeIsSealed = EditorGUILayout.Toggle("Sealed", _selectedTypeIsSealed);

            // Namespace
            GUILayout.Space(10);
            LabelHelper.HeaderLabel("Namespace");
            GUILayout.Space(2);
            this.namespaceField.Draw(GUIContent.none, 0);

            if (this.baseTypePopup.SelectedItem != nameof(ObservableModel) &&
                !string.Equals(_selectedType.Namespace, this.namespaceField.Text))
            {
                EditorGUILayout.HelpBox($"Must manually change the namespace in {_selectedType.Name}.Handler.cs", MessageType.Warning);
            }

            // Properties
            GUILayout.Space(10);
            LabelHelper.HeaderLabel("Properties");
            GUILayout.Space(2);

            _propertiesScrollPos = EditorGUILayout.BeginScrollView(_propertiesScrollPos, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            if (_propertiesDrawerCache.ContainsKey(_selectedType))
            {
                EditablePropertyDrawer[] props = _propertiesDrawerCache[_selectedType];
                for (var i = 0; i < props.Length; i++)
                {
                    props[i].Draw(_propertiesAreaWidth);
                }
            }
            EditorGUILayout.EndScrollView();
        }
Ejemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            var uiManager = (UIMan)this.target;

            GUILayout.BeginHorizontal("Box");
            LabelHelper.HeaderLabel("UIMan Root");
            GUILayout.EndHorizontal();

            GUILayout.BeginVertical("Box");
            uiManager.uiRoot     = EditorGUILayout.ObjectField(this.uiRoot, uiManager.uiRoot, typeof(Transform), true) as Transform;
            uiManager.screenRoot = EditorGUILayout.ObjectField(this.screenRoot, uiManager.screenRoot, typeof(Transform), true) as Transform;
            uiManager.dialogRoot = EditorGUILayout.ObjectField(this.dialogRoot, uiManager.dialogRoot, typeof(Transform), true) as Transform;
            uiManager.background = EditorGUILayout.ObjectField(this.backgroundImg, uiManager.background, typeof(Image), true) as Image;
            uiManager.cover      = EditorGUILayout.ObjectField(this.coverTrans, uiManager.cover, typeof(RectTransform), true) as RectTransform;
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            var uiManBase = (UIManBase)this.target;

            this.orgBgColor = GUI.backgroundColor;

            GUI.backgroundColor = CommonColor.LightOrange;
            GUILayout.BeginHorizontal("Box");
            LabelHelper.HeaderLabel(string.Format("UIMan View Model ({0})", uiManBase.GetUIBaseType()));
            GUILayout.EndHorizontal();

            GUI.backgroundColor = this.orgBgColor;

            LineHelper.Draw(Color.gray);

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

            EditorGUI.BeginChangeCheck();

            if (uiManBase is UIManDialog dialog)
            {
                dialog.useCover = EditorGUILayout.Toggle(this.cover, dialog.useCover);
            }
            else if (uiManBase is UIManScreen screen)
            {
                screen.useBackground = EditorGUILayout.Toggle(this.background, screen.useBackground);
                if (screen.useBackground)
                {
                    screen.background = EditorGUILayout.TextField(screen.background);
                }
            }

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(this.target);
            }

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

                uiManBase.animRoot = EditorGUILayout.ObjectField(this.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(this.show, uiManBase.motionShow);
            uiManBase.motionHide = (UIMotion)EditorGUILayout.EnumPopup(this.hide, uiManBase.motionHide);
            uiManBase.motionIdle = (UIMotion)EditorGUILayout.EnumPopup(this.idle, uiManBase.motionIdle);

            var motions = new UIMotion[3] {
                uiManBase.motionShow, uiManBase.motionHide, uiManBase.motionIdle
            };
            var haveMecanimAnim = false;
            var 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.CustomMecanimAnimation && 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(this.time, uiManBase.animTime);
            uiManBase.showPosition = EditorGUILayout.Vector3Field(this.position, uiManBase.showPosition);

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

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

            EditorGUILayout.Space();
            if (ColorButton.Draw("Edit View (UI)", CommonColor.LightGreen, GUILayout.Height(25)))
            {
                GameObject prefabInstance;
                Object     obj = FindObjectOfType(uiManBase.UIType);
                if (obj != null)
                {
                    prefabInstance = ((MonoBehaviour)obj).gameObject;
                }
                else
                {
                    var isDialog = uiManBase.GetUIBaseType() == UIBaseType.Dialog;
                    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 (ColorButton.Draw("Edit View Logic (Handler)", CommonColor.LightGreen, GUILayout.Height(25)))
            {
                var handler = UIManCodeGenerator.GetScriptPathByType(this.target.GetType());
                handler = handler.Replace(".cs", ".Handler.cs");
                UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(handler, 1);
            }
        }
Ejemplo n.º 4
0
        public void Draw()
        {
            //List of items
            this._scrollPosition = GUILayout.BeginScrollView(this._scrollPosition, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            var defaultMenuColor   = this.menuItemStyle.normal.textColor;
            var defaultButtonColor = this.buttonStyle.normal.textColor;

            for (var i = 0; i < this._viewItems.Count; i++)
            {
                if (string.Equals(this._viewItems[i], Model))
                {
                    GUILayout.Space(i == 0 ? 4 : 10);
                    LabelHelper.SubTitleLabel(nameof(MVVM.ObservableModel));
                    GUILayout.Space(2);
                    continue;
                }

                if (string.Equals(this._viewItems[i], Dialog))
                {
                    GUILayout.Space(i == 0 ? 4 : 10);
                    LabelHelper.SubTitleLabel(nameof(UIManDialog));
                    GUILayout.Space(2);
                    continue;
                }

                if (string.Equals(this._viewItems[i], Screen))
                {
                    GUILayout.Space(i == 0 ? 4 : 10);
                    LabelHelper.SubTitleLabel(nameof(UIManScreen));
                    GUILayout.Space(2);
                    continue;
                }

                if (i == this._selected)
                {
                    this.menuItemStyle.normal.textColor = Color.blue;
                    this.buttonStyle.normal.textColor   = Color.blue;
                }
                else
                {
                    this.menuItemStyle.normal.textColor = defaultMenuColor;
                    this.buttonStyle.normal.textColor   = defaultButtonColor;
                }

                // Filter item by keyword
                if (!string.IsNullOrEmpty(this._filter))
                {
                    if (this._viewItems[i].ToLower().IndexOf(this._filter.ToLower(), StringComparison.Ordinal) < 0)
                    {
                        continue;
                    }
                }

                // Draw suitable items
                if (this._selectOnMouseHover)
                {
                    if (GUILayout.Button(this._viewItems[i], this.menuItemStyle))
                    {
                        DoSelect(i);
                    }
                }
                else
                {
                    var val    = i == this.selectedIndex ? true : false;
                    var newVal = GUILayout.Toggle(val, this._viewItems[i], this.buttonStyle);
                    if (val != newVal && newVal == true)
                    {
                        DoSelect(i);
                    }
                }

                // Update button's status (for hover event)
                if (this._selectOnMouseHover)
                {
                    this.Window.Repaint();
                }
            }

            GUILayout.EndScrollView();
        }
Ejemplo n.º 5
0
        void PropertiesWindow(int id = 2)
        {
            GUILayout.BeginVertical();

            if (listTypes != null && !string.IsNullOrEmpty(listTypes.SelectedItem))
            {
                if (selectedType != null)
                {
                    // Title
                    GUILayout.Space(2);
                    LabelHelper.TitleLabel(selectedType.Name);
                    LineHelper.Draw(Color.gray);

                    // Common
                    GUILayout.Space(2);
                    if (selectedType.BaseType != typeof(ObservableModel))
                    {
                        GUILayout.BeginHorizontal();
                        if (ColorButton.Draw("Edit View Logic (Handler)", CommonColor.LightBlue, GUILayout.Height(30)))
                        {
                            string handler = CodeGenerationHelper.GetScriptPathByType(selectedType);
                            handler = handler.Replace(".cs", ".Handler.cs");
                            UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(handler, 1);
                        }

                        if (ColorButton.Draw("Edit View (UI)", CommonColor.LightBlue, GUILayout.Height(30)))
                        {
                            GameObject         prefabInstance;
                            UnityEngine.Object obj = FindObjectOfType(selectedType);
                            if (obj != null)
                            {
                                prefabInstance = ((MonoBehaviour)obj).gameObject;
                            }
                            else
                            {
                                bool       isDialog     = selectedType.BaseType == typeof(UIManDialog);
                                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(prefab) as GameObject;
                                if (isDialog)
                                {
                                    prefabInstance.transform.SetParent(UIMan.Instance.dialogRoot, false);
                                }
                                else
                                {
                                    prefabInstance.transform.SetParent(UIMan.Instance.screenRoot, false);
                                }
                            }
                            Selection.activeGameObject = prefabInstance;
                        }

                        if (ColorButton.Draw("Delete", CommonColor.LightRed, GUILayout.Height(30)))
                        {
                            string cs      = CodeGenerationHelper.GetScriptPathByType(selectedType);
                            string handler = cs.Replace(".cs", ".Handler.cs");
                            AssetDatabase.DeleteAsset(cs);
                            AssetDatabase.DeleteAsset(handler);

                            bool   isDialog     = selectedType.BaseType == typeof(UIManDialog);
                            string prefabFolder = GetUIPrefabPath(selectedType, isDialog);
                            string prefabFile   = selectedType.Name + PREFAB_EXT;
                            string prefabPath   = UIManDefine.ASSETS_FOLDER + prefabFolder + prefabFile;
                            AssetDatabase.DeleteAsset(prefabPath);
                            AssetDatabase.Refresh();
                        }
                        GUILayout.EndHorizontal();
                        LineHelper.Draw(Color.gray);
                    }

                    // Base type
                    GUILayout.Space(10);
                    LabelHelper.HeaderLabel("Type");
                    LineHelper.Draw(Color.gray);
                    baseTypePopup.Draw();

                    if (baseTypePopup.SelectedItem != "ObservableModel")
                    {
                        if (!System.IO.File.Exists(handlerScriptPath))
                        {
                            if (GUILayout.Button("Generate Handler"))
                            {
                                string backupCode = CodeGenerationHelper.DeleteScript(handlerScriptPath);
                                GenerateViewModelHandler(backupCode, selectedType.BaseType.Name);
                            }
                        }
                    }

                    // Properties
                    GUILayout.Space(10);
                    LabelHelper.HeaderLabel("Properties");
                    LineHelper.Draw(Color.gray);

                    propertiesScrollPos = EditorGUILayout.BeginScrollView(propertiesScrollPos, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
                    if (propertiesDrawerCache.ContainsKey(selectedType))
                    {
                        EditablePropertyDrawer[] props = propertiesDrawerCache [selectedType];
                        for (int i = 0; i < props.Length; i++)
                        {
                            props [i].Draw(propertiesAreaWidth);
                        }
                    }
                    EditorGUILayout.EndScrollView();
                }

                GUILayout.Space(10);

                // Add property
                if (ColorButton.Draw("Add New Property", CommonColor.LightGreen, GUILayout.Height(30)))
                {
                    int    newIndex    = 0;
                    string strNewIndex = "";
                    for (int i = 0; i < selectedProperties.Length; i++)
                    {
                        if (selectedProperties [i].LastName.Contains("NewProperty"))
                        {
                            newIndex++;
                        }
                    }
                    if (newIndex > 0)
                    {
                        strNewIndex = newIndex.ToString();
                    }
                    CustomPropertyInfo newProperty = new CustomPropertyInfo("", typeof(string));
                    newProperty.LastName = "NewProperty" + strNewIndex;
                    ArrayUtility.Add <CustomPropertyInfo> (ref selectedProperties, newProperty);
                    CachePropertiesDrawer();
                }

                //Save all change
                CustomPropertyInfo[] changeList   = new CustomPropertyInfo[0];
                CustomPropertyInfo[] selectedList = new CustomPropertyInfo[0];
                for (int i = 0; i < selectedProperties.Length; i++)
                {
                    if (selectedProperties [i].HasChange)
                    {
                        ArrayUtility.Add(ref changeList, selectedProperties [i]);
                    }
                    if (selectedProperties [i].IsSelected)
                    {
                        ArrayUtility.Add(ref selectedList, selectedProperties [i]);
                    }
                }

                GUILayout.Space(10);
                LineHelper.Draw(Color.gray);
                GUILayout.Space(5);

                if (changeList.Length > 0)
                {
                    if (ColorButton.Draw("Save All Changes", CommonColor.LightGreen, GUILayout.Height(30)))
                    {
                        for (int i = 0; i < changeList.Length; i++)
                        {
                            changeList [i].CommitChange();
                        }
                        SaveCurrentType(true, baseTypePopup.SelectedItem);
                    }
                }

                if (selectedList.Length > 0)
                {
                    if (ColorButton.Draw("Delete Selected Properties", CommonColor.LightRed, GUILayout.Height(30)))
                    {
                        for (int i = 0; i < selectedList.Length; i++)
                        {
                            ArrayUtility.Remove(ref selectedProperties, selectedList [i]);
                        }
                        SaveCurrentType(true, baseTypePopup.SelectedItem);
                        CachePropertiesDrawer(true);
                    }
                }

                if (selectedProperties.Length > 0)
                {
                    if (ColorButton.Draw("Delete All Properties", CommonColor.LightRed, GUILayout.Height(30)))
                    {
                        while (selectedProperties.Length > 0)
                        {
                            ArrayUtility.Clear(ref selectedProperties);
                            SaveCurrentType();
                            CachePropertiesDrawer(true);
                        }
                    }
                }
            }
            else
            {
                GUILayout.Label("NO DATA FOR PREVIEW!");
            }


            GUILayout.EndVertical();
        }
Ejemplo n.º 6
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);
            }
        }
Ejemplo n.º 7
0
        private void OnGUI()
        {
            Initialize();

            GUILayout.Space(10);
            LabelHelper.HeaderLabel("Type");
            LineHelper.Draw(Color.gray);
            this.baseTypePopup.Draw();

            GUILayout.Space(10);
            LabelHelper.HeaderLabel("Namespace");
            LineHelper.Draw(Color.gray);
            this.namespaceField.Draw(GUIContent.none, 0);

            GUILayout.Space(10);

            if (ColorButton.Draw("Create", CommonColor.LightGreen, GUILayout.Height(30)))
            {
                var lastPath = "";
                var config   = EditorHelper.GetOrCreateScriptableObject <UIManConfig>(false);

                if (config != null)
                {
                    if (this.baseTypePopup.SelectedItem == this.arrSupportType[0])
                    {
                        lastPath      = config.modelScriptFolder;
                        this.typeName = "NewViewModel";
                    }
                    else if (this.baseTypePopup.SelectedItem == this.arrSupportType[1])
                    {
                        lastPath      = config.screenScriptFolder;
                        this.typeName = "UINewScreen";
                    }
                    else if (this.baseTypePopup.SelectedItem == this.arrSupportType[2])
                    {
                        lastPath      = config.dialogScriptFolder;
                        this.typeName = "UINewDialog";
                    }
                }

                lastPath = EditorUtility.SaveFilePanel("Save script", Application.dataPath + lastPath, this.typeName, "cs");

                if (!string.IsNullOrEmpty(lastPath))
                {
                    this.typeName = Path.GetFileNameWithoutExtension(lastPath);

                    lastPath = Path.GetDirectoryName(lastPath).Replace("\\", "/").Replace(Application.dataPath, "");

                    if (this.baseTypePopup.SelectedItem == this.arrSupportType[0])
                    {
                        config.modelScriptFolder      = lastPath;
                        config.generatingTypeIsDialog = false;
                    }
                    else if (this.baseTypePopup.SelectedItem == this.arrSupportType[1])
                    {
                        config.screenScriptFolder     = lastPath;
                        config.generatingTypeIsDialog = false;
                    }
                    else if (this.baseTypePopup.SelectedItem == this.arrSupportType[2])
                    {
                        config.dialogScriptFolder     = lastPath;
                        config.generatingTypeIsDialog = true;
                    }

                    EditorUtility.SetDirty(config);
                    GenerateType();
                }
            }
        }