diff options
author | chai <chaifix@163.com> | 2020-10-15 19:05:22 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-10-15 19:05:22 +0800 |
commit | f049177e20a276049c61edbad631c1b2bbdd5706 (patch) | |
tree | 7d1a1cd9b690a5d9a8b9a65554a191d6ec769601 /Assets/Plugins/Editor/AdvancedInspector/FieldEditors/StringEditor.cs | |
parent | 6990a0d1fbdcbbf404f40713363ac1a148c8840a (diff) |
-advanced inspector
+odin
Diffstat (limited to 'Assets/Plugins/Editor/AdvancedInspector/FieldEditors/StringEditor.cs')
-rw-r--r-- | Assets/Plugins/Editor/AdvancedInspector/FieldEditors/StringEditor.cs | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/StringEditor.cs b/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/StringEditor.cs deleted file mode 100644 index 573450d9..00000000 --- a/Assets/Plugins/Editor/AdvancedInspector/FieldEditors/StringEditor.cs +++ /dev/null @@ -1,89 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; - -namespace AdvancedInspector -{ - public class StringEditor : FieldEditor - { - public override Type[] EditedTypes - { - get { return new Type[] { typeof(string) }; } - } - - public override void Draw(InspectorField field, GUIStyle style) - { - GUILayout.BeginHorizontal(); - - float width = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 0; - - TextFieldAttribute text = field.GetAttribute<TextFieldAttribute>(); - MultilineAttribute multiline = field.GetAttribute<MultilineAttribute>(); - TextAreaAttribute area = field.GetAttribute<TextAreaAttribute>(); - - object value = GetValue(field); - - EditorGUI.BeginChangeCheck(); - GUIUtility.GetControlID(field.Path.GetHashCode(), FocusType.Passive); - - string result = ""; - if ((text == null && multiline == null && area == null) || (text != null && text.Type == TextFieldType.Standard)) - { - if (style != null) - result = EditorGUILayout.TextField((string)value, style); - else - result = EditorGUILayout.TextField((string)value); - } - else if (multiline != null || area != null || text.Type == TextFieldType.Area) - { - if (style != null) - result = EditorGUILayout.TextArea((string)value, style); - else - result = EditorGUILayout.TextArea((string)value); - } - else if (text.Type == TextFieldType.Password) - { - if (style != null) - result = EditorGUILayout.PasswordField((string)value, style); - else - result = EditorGUILayout.PasswordField((string)value); - } - else if (text.Type == TextFieldType.Tag) - { - if (style != null) - result = EditorGUILayout.TagField((string)value, style); - else - result = EditorGUILayout.TagField((string)value); - } - else if (text.Type == TextFieldType.File) - { - if (GUILayout.Button("...", GUILayout.Height(BUTTON_HEIGHT), GUILayout.Width(BUTTON_HEIGHT * 2))) - result = EditorUtility.OpenFilePanel(text.Title, text.Path, text.Extension); - - if (field.Mixed) - GUILayout.Label("---"); - else - GUILayout.Label((string)value); - } - else if (text.Type == TextFieldType.Folder) - { - if (GUILayout.Button("...", GUILayout.Height(BUTTON_HEIGHT), GUILayout.Width(BUTTON_HEIGHT * 2))) - result = EditorUtility.OpenFolderPanel(text.Title, "", ""); - - if (field.Mixed) - GUILayout.Label("---"); - else - GUILayout.Label((string)value); - } - - if (EditorGUI.EndChangeCheck()) - field.SetValue(result); - - EditorGUIUtility.labelWidth = width; - - GUILayout.EndHorizontal(); - } - } -}
\ No newline at end of file |