1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| public static void StartHorizontalMargin(float space, bool beginVertical) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(space); if (beginVertical) EditorGUILayout.BeginVertical(); } public static void EndHorizontalMargin(float space, bool endVertical) { if (endVertical) EditorGUILayout.EndVertical(); GUILayout.Space(space); EditorGUILayout.EndHorizontal(); }
public static Sprite DrawIconField(Sprite icon, float iconSize) { return (Sprite)EditorGUILayout.ObjectField(icon, typeof(Sprite), false, GUILayout.Width(iconSize), GUILayout.Height(iconSize)); } public static void DrawIDField(float smallFieldHeight, float fieldWidth, int id,EditorDataObj editorDataObj) { fieldWidth *= 2; EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(true); EditorGUILayout.LabelField("ID:", GUILayout.Width(editorDataObj.labelFieldWidth), GUILayout.Height(smallFieldHeight)); EditorGUILayout.IntField(id, GUILayout.Height(smallFieldHeight)); EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); }
public static string DrawHorizontalTextField(string labelName, string tooltip, float smallFieldHeight, string content, EditorDataObj editorDataObj) { GUILayout.BeginHorizontal(); if (!string.IsNullOrEmpty(labelName)) EditorGUILayout.LabelField(new GUIContent(labelName, tooltip), GUILayout.Width(editorDataObj.labelFieldWidth), GUILayout.Height(smallFieldHeight)); content = EditorGUILayout.TextField(content, GUILayout.Height(smallFieldHeight)); GUILayout.EndHorizontal(); return content; } public static int DrawHorizontalTextField(string labelName, string tooltip, float smallFieldHeight, int content, EditorDataObj editorDataObj) { GUILayout.BeginHorizontal(); if (!string.IsNullOrEmpty(labelName)) EditorGUILayout.LabelField(new GUIContent(labelName, tooltip), GUILayout.Width(editorDataObj.labelFieldWidth), GUILayout.Height(smallFieldHeight)); content = EditorGUILayout.IntField(content, GUILayout.Height(smallFieldHeight)); GUILayout.EndHorizontal(); return content; } public static float DrawHorizontalTextField(string labelName, string tooltip, float smallFieldHeight, float content, EditorDataObj editorDataObj) { GUILayout.BeginHorizontal(); if (!string.IsNullOrEmpty(labelName)) EditorGUILayout.LabelField(new GUIContent(labelName, tooltip), GUILayout.Width(editorDataObj.labelFieldWidth), GUILayout.Height(smallFieldHeight)); content = EditorGUILayout.FloatField(content, GUILayout.Height(smallFieldHeight)); GUILayout.EndHorizontal(); return content; } public static bool DrawHorizontalToggle(string labelName, string tooltip, float smallFieldHeight, bool toggle, EditorDataObj editorDataObj) { GUILayout.BeginHorizontal(); if (!string.IsNullOrEmpty(labelName)) EditorGUILayout.LabelField(new GUIContent(labelName, tooltip), GUILayout.Width(editorDataObj.labelFieldWidth), GUILayout.Height(smallFieldHeight)); toggle = EditorGUILayout.Toggle(toggle, GUILayout.Height(smallFieldHeight)); GUILayout.EndHorizontal(); return toggle; } public static string DrawFileNameField(string labelName, string tooltip, float smallFieldHeight, string content, EditorDataObj editorDataObj) { EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(true); if (!string.IsNullOrEmpty(labelName)) EditorGUILayout.LabelField(new GUIContent(labelName, tooltip), GUILayout.Width(editorDataObj.labelFieldWidth), GUILayout.Height(smallFieldHeight)); content = EditorGUILayout.TextField(content, GUILayout.Height(smallFieldHeight)); EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); return content; }
public static string DrawHorizontalTextField(string labelName, string tooltip, float smallFieldHeight, float width, string content, EditorDataObj editorDataObj) { GUILayout.BeginHorizontal(); if (!string.IsNullOrEmpty(labelName)) EditorGUILayout.LabelField(new GUIContent(labelName, tooltip), GUILayout.Width(width), GUILayout.Height(smallFieldHeight)); content = EditorGUILayout.TextField(content, GUILayout.Height(smallFieldHeight)); GUILayout.EndHorizontal(); return content; }
|