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(EditorGUIExtension.Draw <int>(() => EditorGUI.Popup(area, name, index, current.ToArray(), style), 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); } EditorGUIExtension.Draw(() => EditorGUI.PropertyField(area, current, label, allowScene), indention); }
public static void DrawLabel(this UnityLabel current, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.label; if (indention) { EditorGUIExtension.Draw(() => EditorGUILayout.LabelField(current, style, style.CreateLayout()), indention); return; } EditorGUIExtension.Draw(() => GUILayout.Label(current, style), indention); }
public static float DrawSlider(this float current, Rect area, float min, float max, bool indention = true) { var value = EditorGUIExtension.Draw <float>(() => GUI.HorizontalSlider(area, current, min, max), indention); if (value != current) { GUI.FocusControl(""); } return(value); }
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, Class.CreateLayout()); EditorGUIExtension.Draw(action, indention); }
//public static void DrawLabel(this string current,GUIStyle style=null,bool indention=true){new UnityLabel(current).DrawLabel(style,indention);} //public static void DrawLabel(this GUIContent current,GUIStyle style=null,bool indention=true){new UnityLabel(current).DrawLabel(style,indention);} public static void DrawLabel(this UnityLabel current, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.label; if (indention) { var options = new List <GUILayoutOption>(); if (style.fixedWidth != 0) { options.Add(GUILayout.Width(style.fixedWidth)); } EditorGUIExtension.Draw(() => EditorGUILayout.LabelField(current, style, options.ToArray()), indention); return; } EditorGUIExtension.Draw(() => GUILayout.Label(current, style), indention); }
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; } EditorGUIExtension.Draw(() => EditorGUI.HelpBox(area, current, type), indention); }
public static bool DrawFoldout(this UnityLabel current, Rect area, object key, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.foldout; string name = key.IsNull() ? current + "Foldout" : key.GetHashCode().ToString(); if (key is string) { name = (string)key; } bool previous = EditorPrefs.GetBool(name); bool state = EditorGUIExtension.Draw <bool>(() => EditorGUI.Foldout(area, previous, current, style), indention); if (previous != state) { EditorPrefs.SetBool(name, state); } return(state); }
//public static void DrawLabel(this string current,Rect area,GUIStyle style=null,bool indention=true){new UnityLabel(current).DrawLabel(area,style,indention);} //public static void DrawLabel(this GUIContent current,Rect area,GUIStyle style=null,bool indention=true){new UnityLabel(current).DrawLabel(area,style,indention);} public static void DrawLabel(this UnityLabel current, Rect area, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.label; EditorGUIExtension.Draw(() => EditorGUI.LabelField(area, current, style), indention); }
public static Vector3 DrawVector3(this Vector3 current, Rect area, UnityLabel label = null, bool indention = true) { return(EditorGUIExtension.Draw <Vector3>(() => EditorGUI.Vector3Field(area, label, current), indention)); }
public static string Draw(this string current, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.textField; return(EditorGUIExtension.Draw <string>(() => EditorGUILayout.TextField(label, current, style, style.CreateLayout()), indention)); }
public static int DrawInt(this int current, Rect area, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.numberField; return(EditorGUIExtension.Draw <int>(() => EditorGUI.IntField(area, label, current, style), indention)); }
public static Type Draw <Type>(this UnityObject current, Rect area, UnityLabel label = null, bool allowScene = true, bool indention = true) where Type : UnityObject { return((Type)EditorGUIExtension.Draw <UnityObject>(() => EditorGUI.ObjectField(area, label, current, typeof(Type), allowScene), indention)); }
public static bool Draw(this bool current, Rect area, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.toggle; return(EditorGUIExtension.Draw <bool>(() => EditorGUI.Toggle(area, label, current, style), indention)); }
public static Type Draw <Type>(this UnityObject current, UnityLabel label = null, bool allowScene = true, bool indention = true) where Type : UnityObject { return((Type)EditorGUIExtension.Draw <UnityObject>(() => EditorGUILayout.ObjectField(label, current, typeof(Type), allowScene, Class.CreateLayout()), indention)); }
public static int Draw(this IEnumerable <string> current, int index, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.popup; return(EditorGUIExtension.Draw <int>(() => EditorGUILayout.Popup(label.ToString(), index, current.ToArray(), style), indention)); }
public static Vector3 DrawVector3(this Vector3 current, UnityLabel label = null, bool indention = true) { return(EditorGUIExtension.Draw <Vector3>(() => EditorGUILayout.Vector3Field(label, current, Class.CreateLayout()), indention)); }
public static Enum Draw(this Enum current, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.popup; return(EditorGUIExtension.Draw <Enum>(() => EditorGUILayout.EnumPopup(label, current, style, style.CreateLayout()), indention)); }
public static bool Draw(this bool current, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.toggle; return(EditorGUIExtension.Draw <bool>(() => EditorGUILayout.Toggle(label, current, style, style.CreateLayout()), indention)); }
public static float Draw(this float current, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.numberField; return(EditorGUIExtension.Draw <float>(() => EditorGUILayout.FloatField(label, current, style, style.CreateLayout()), indention)); }
public static string DrawTextArea(this string current, Rect area, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.textField; return(EditorGUIExtension.Draw <string>(() => EditorGUI.TextField(area, label, current, style), indention)); }
public static float DrawSlider(this float current, float min, float max, UnityLabel label = null, bool indention = true) { return(EditorGUIExtension.Draw <float>(() => EditorGUILayout.Slider(label, current, min, max, Class.CreateLayout()), indention)); }
//public static bool DrawButton(this string current,Rect area,GUIStyle style=null,bool indention=true){return new UnityLabel(current).DrawButton(area,style,indention);} //public static bool DrawButton(this GUIContent current,Rect area,GUIStyle style=null,bool indention=true){return new UnityLabel(current).DrawButton(area,style,indention);} public static bool DrawButton(this UnityLabel current, Rect area, GUIStyle style = null, bool indention = true) { style = style ?? GUI.skin.button; return(EditorGUIExtension.Draw <bool>(() => GUI.Button(area, current, style), indention)); }
public static Rect Draw(this Rect current, Rect area, UnityLabel label = null, bool indention = true) { return(EditorGUIExtension.Draw <Rect>(() => EditorGUI.RectField(area, label, current), indention)); }
public static bool DrawButton(this UnityLabel current, GUIStyle style = null, bool indention = true) { style = style ?? GUI.skin.button; return(EditorGUIExtension.Draw <bool>(() => GUILayout.Button(current, style, Class.CreateLayout()), indention)); }
public static AnimationCurve Draw(this AnimationCurve current, Rect area, UnityLabel label = null, bool indention = true) { return(EditorGUIExtension.Draw <AnimationCurve>(() => EditorGUI.CurveField(area, label, current), indention)); }
public static Enum DrawMaskField(this Enum current, Rect area, UnityLabel label = null, GUIStyle style = null, bool indention = true) { style = style ?? EditorStyles.popup; return(EditorGUIExtension.Draw <Enum>(() => EditorGUI.EnumMaskField(area, label, current, style), indention)); }
public static Color Draw(this Color current, Rect area, UnityLabel label = null, bool indention = true) { return(EditorGUIExtension.Draw <Color>(() => EditorGUI.ColorField(area, label, current), indention)); }
public static Vector4 DrawVector4(this Vector4 current, Rect area, UnityLabel label = null, bool indention = true) { string name = label.IsNull() ? null : label.ToString(); return(EditorGUIExtension.Draw <Vector3>(() => EditorGUI.Vector4Field(area, name, current), indention)); }
public static Vector4 DrawVector4(this Vector4 current, UnityLabel label = null, bool indention = true) { return(EditorGUIExtension.Draw <Vector4>(() => EditorGUILayout.Vector4Field(label.ToString(), current, Class.CreateLayout()), indention)); }