public static void Box(this HUMEditor.Data.Vertical vertical, Color backgroundColor, Color borderColor, int border = 1, Action action = null, bool stretchHorizontal = false, bool stretchVertical = false, params GUILayoutOption[] options) { var style = new GUIStyle(GUI.skin.box); style.normal.background = HUMColor.CacheTexture(backgroundColor); style.stretchWidth = stretchHorizontal; style.stretchHeight = stretchVertical; style.margin = new RectOffset(); EditorGUILayout.BeginVertical(style, options); action?.Invoke(); EditorGUILayout.EndVertical(); }
public static void Box(this HUMEditor.Data.Vertical vertical, Color background, int padding = 0, Action action = null, params GUILayoutOption[] options) { var style = new GUIStyle(GUI.skin.box); style.padding = new RectOffset(padding, padding, padding, padding); var old = GUI.color; GUI.color = background; EditorGUILayout.BeginVertical(style, options); GUI.color = old; action?.Invoke(); GUI.color = background; EditorGUILayout.EndVertical(); GUI.color = old; }
public static void Box(this HUMEditor.Data.Vertical vertical, Color backgroundColor, Color borderColor, RectOffset padding, RectOffset border, Action contents = null, params GUILayoutOption[] options) { var style = new GUIStyle(); var borderStyle = new GUIStyle(); style.normal.background = HUMTexture.Create(1, 1).Color(backgroundColor); borderStyle.normal.background = HUMTexture.Create(1, 1).Color(borderColor); borderStyle.padding = border; style.padding = padding; HUMEditor.Vertical(borderStyle, () => { HUMEditor.Vertical(style, () => { contents?.Invoke(); }); }, options); }
public static void Box(this HUMEditor.Data.Vertical vertical, Color backgroundColor, Color borderColor, RectOffset padding, TextAnchor contentAlignment, int border = 1, Action contents = null, params GUILayoutOption[] options) { var style = new GUIStyle(); var borderStyle = new GUIStyle(); style.normal.background = HUMColor.CacheTexture(backgroundColor); borderStyle.normal.background = HUMColor.CacheTexture(borderColor); borderStyle.padding = new RectOffset(border, border, border, border); style.padding = padding; style.alignment = contentAlignment; HUMEditor.Vertical(borderStyle, () => { HUMEditor.Vertical(style, () => { contents?.Invoke(); }); }, options); }
public static void Box(this HUMEditor.Data.Vertical vertical, Color backgroundColor, Color borderColor, RectOffset padding, RectOffset border, Action contents = null, bool stretchVertical = false, bool stretchHorizontal = false, params GUILayoutOption[] options) { var style = new GUIStyle(); var borderStyle = new GUIStyle(); style.normal.background = HUMColor.CacheTexture(backgroundColor); borderStyle.normal.background = HUMColor.CacheTexture(borderColor); borderStyle.padding = border; borderStyle.stretchHeight = stretchVertical; borderStyle.stretchWidth = stretchHorizontal; style.padding = padding; style.stretchHeight = stretchVertical; style.stretchWidth = stretchHorizontal; HUMEditor.Vertical(borderStyle, () => { HUMEditor.Vertical(style, () => { contents?.Invoke(); }); }, options); }