public static bool DrawButton(this UnityLabel current, GUIStyle style = null, bool indention = true) { style = style ?? GUI.skin.button; var layout = style.CreateLayout() ?? EditorUI.CreateLayout(); return(EditorUI.Draw(() => GUILayout.Button(current, style, layout), indention)); }
public static Enum Draw(this Enum current, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.popup; var layout = style.CreateLayout() ?? EditorUI.CreateLayout(); return(EditorUI.Draw(() => EditorGUILayout.EnumPopup(label, current, style, layout), indention)); }
public static int Draw(this IEnumerable <string> current, int index, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.popup; var labelValue = label.IsNull() ? null : label.ToString(); return(EditorUI.Draw(() => EditorGUILayout.Popup(labelValue, index, current.ToArray(), style), indention)); }
public static float Draw(this float current, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.numberField; var layout = style.CreateLayout() ?? EditorUI.CreateLayout(); return(EditorUI.Draw(() => EditorGUILayout.FloatField(label, current, style, layout), indention)); }
public static bool Draw(this bool current, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.toggle; var layout = style.CreateLayout() ?? EditorUI.CreateLayout(); return(EditorUI.Draw(() => EditorGUILayout.Toggle(label, current, style, layout), indention)); }
public static int Draw(this IEnumerable <string> current, Rect area, int index, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.popup; string name = label.IsNull() ? "" : label.ToString(); return(EditorUI.Draw <int>(() => EditorGUI.Popup(area, name, index, current.ToArray(), style), indention, area)); }
public static void DrawLabel(this UnityLabel current, UnityLabel label, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.label; var layout = style.CreateLayout() ?? EditorUI.CreateLayout(); EditorUI.Draw(() => EditorGUILayout.LabelField(label, current, style, layout), indention); }
public static string DrawTextArea(this string current, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.textField; var layout = style.CreateLayout() ?? EditorUI.CreateLayout(); return(EditorUI.Draw(() => EditorGUILayout.TextField(label, current, style, layout), indention)); }
public static void Draw(this SerializedProperty current, Rect area, UnityLabel label = null, bool allowScene = true, bool indention = true) { if (label != null && label.value.text.IsEmpty()) { label = new GUIContent(current.displayName); } EditorUI.Draw(() => EditorGUI.PropertyField(area, current, label, allowScene), indention, area); }
public static IEnumerable <bool> DrawFlags(this IEnumerable <string> current, IEnumerable <bool> active, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.popup; var layout = style.CreateLayout() ?? EditorUI.CreateLayout(); var mask = EditorUI.Draw(() => EditorGUILayout.MaskField(label, active.ToBitFlags(), current.ToArray(), style, layout), indention); return(mask.ToFlags(active.Count())); }
public static Enum DrawMaskField(this Enum current, Rect area, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.popup; #if UNITY_2017_3_OR_NEWER return(EditorUI.Draw <Enum>(() => EditorGUI.EnumFlagsField(area, label, current, style), indention, area)); #else return(EditorUI.Draw <Enum>(() => EditorGUI.EnumMaskField(area, label, current, style), indention, area)); #endif }
public static void Draw(this SerializedProperty current, UnityLabel label = null, bool allowScene = true, bool indention = true) { if (label != null && label.value.text.IsEmpty()) { label = new GUIContent(current.displayName); } Action action = () => EditorGUILayout.PropertyField(current, label, allowScene, EditorUI.CreateLayout()); EditorUI.Draw(action, indention); }
public static float DrawSlider(this float current, Rect area, float min, float max, bool indention = true) { var value = EditorUI.Draw <float>(() => GUI.HorizontalSlider(area, current, min, max), indention, area); if (value != current) { GUI.FocusControl(""); } return(value); }
public static Enum DrawFlags(this Enum current, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.popup; var layout = style.CreateLayout() ?? EditorUI.CreateLayout(); #if UNITY_2017_3_OR_NEWER return(EditorUI.Draw(() => EditorGUILayout.EnumFlagsField(label, current, style, layout), indention)); #else return(EditorUI.Draw(() => EditorGUILayout.EnumMaskField(label, current, style, layout), indention)); #endif }
public static void DrawHelp(this string current, Rect area, string textType, bool indention = true) { MessageType type = MessageType.None; if (textType.Contains("Info", true)) { type = MessageType.Info; } if (textType.Contains("Error", true)) { type = MessageType.Error; } if (textType.Contains("Warning", true)) { type = MessageType.Warning; } EditorUI.Draw(() => EditorGUI.HelpBox(area, current, type), indention, area); }
public static Rect Draw(this Rect current, Rect area, UnityLabel label = null, bool indention = true) { return(EditorUI.Draw <Rect>(() => EditorGUI.RectField(area, label, current), indention, area)); }
public static Vector4 DrawVector4(this Vector4 current, UnityLabel label = null, bool indention = true) { return(EditorUI.Draw(() => EditorGUILayout.Vector4Field(label.ToString(), current, EditorUI.CreateLayout()), indention)); }
public static Enum Draw(this Enum current, Rect area, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.popup; return(EditorUI.Draw <Enum>(() => EditorGUI.EnumPopup(area, label, current, style), indention, area)); }
public static bool Draw(this bool current, Rect area, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.toggle; return(EditorUI.Draw <bool>(() => EditorGUI.Toggle(area, label, current, style), indention, area)); }
public static AnimationCurve Draw(this AnimationCurve current, UnityLabel label = null, bool indention = true) { return(EditorUI.Draw(() => EditorGUILayout.CurveField(label, current, EditorUI.CreateLayout()), indention)); }
public static void DrawLabel(this UnityLabel current, Rect area, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.label; EditorUI.Draw(() => EditorGUI.LabelField(area, current, style), indention, area); }
public static Type Draw <Type>(this UnityObject current, Rect area, UnityLabel label = null, bool allowScene = true, bool indention = true) where Type : UnityObject { return((Type)EditorUI.Draw <UnityObject>(() => EditorGUI.ObjectField(area, label, current, typeof(Type), allowScene), indention, area)); }
public static Vector4 DrawVector4(this Vector4 current, Rect area, UnityLabel label = null, bool indention = true) { string name = label.IsNull() ? null : label.ToString(); return(EditorUI.Draw <Vector3>(() => EditorGUI.Vector4Field(area, name, current), indention, area)); }
public static Vector3 DrawVector3(this Vector3 current, Rect area, UnityLabel label = null, bool indention = true) { return(EditorUI.Draw <Vector3>(() => EditorGUI.Vector3Field(area, label, current), indention, area)); }
public static bool DrawButton(this UnityLabel current, Rect area, GUIStyle style = null, bool indention = true) { style = style ?? GUI.skin.button; return(EditorUI.Draw <bool>(() => GUI.Button(area, current, style), indention, area)); }
public static AnimationCurve Draw(this AnimationCurve current, Rect area, UnityLabel label = null, bool indention = true) { return(EditorUI.Draw <AnimationCurve>(() => EditorGUI.CurveField(area, label, current), indention, area)); }
public static Color Draw(this Color current, Rect area, UnityLabel label = null, bool indention = true) { return(EditorUI.Draw <Color>(() => EditorGUI.ColorField(area, label, current), indention, area)); }
public static string Draw(this string current, Rect area, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.textField; return(EditorUI.Draw <string>(() => EditorGUI.TextField(area, label, current, style), indention, area)); }
public static float Draw(this float current, Rect area, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.numberField; return(EditorUI.Draw <float>(() => EditorGUI.FloatField(area, label, current, style), indention, area)); }
public static Color Draw(this Color current, UnityLabel label = null, bool indention = true) { return(EditorUI.Draw(() => EditorGUILayout.ColorField(label, current, EditorUI.CreateLayout()), indention)); }