Beispiel #1
0
 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);
 }
Beispiel #2
0
 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
 }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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
        }
Beispiel #5
0
        public static void DrawLabel(this UnityLabel current, GUIStyle style = null, bool indention = true)
        {
            style = style ?? EditorStyles.label;
            var layout = style.CreateLayout() ?? EditorUI.CreateLayout();

            if (indention)
            {
                EditorUI.Draw(() => EditorGUILayout.LabelField(current, style, layout), indention);
                return;
            }
            EditorUI.Draw(() => GUILayout.Label(current, style, layout), indention);
        }
Beispiel #6
0
 public static float DrawSlider(this float current, float min, float max, UnityLabel label = null, bool indention = true)
 {
     return(EditorUI.Draw(() => EditorGUILayout.Slider(label, current, min, max, EditorUI.CreateLayout()), indention));
 }
Beispiel #7
0
 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));
 }
Beispiel #8
0
        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));
        }
Beispiel #9
0
 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));
 }
Beispiel #10
0
 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));
 }
Beispiel #11
0
 public static Vector4 DrawVector4(this Vector4 current, UnityLabel label = null, bool indention = true)
 {
     return(EditorUI.Draw(() => EditorGUILayout.Vector4Field(label.ToString(), current, EditorUI.CreateLayout()), indention));
 }
Beispiel #12
0
 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));
 }
Beispiel #13
0
 public static void DrawPrefix(this UnityLabel current, GUIStyle style = null, GUIStyle followStyle = null, bool indention = true)
 {
     style       = style ?? EditorStyles.label;
     followStyle = followStyle ?? GUI.skin.button;
     EditorUI.Draw(() => EditorGUILayout.PrefixLabel(current, followStyle, style), indention);
 }
Beispiel #14
0
        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));
        }
Beispiel #15
0
 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));
 }
Beispiel #16
0
 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));
 }
Beispiel #17
0
 public static Color Draw(this Color current, UnityLabel label = null, bool indention = true)
 {
     return(EditorUI.Draw(() => EditorGUILayout.ColorField(label, current, EditorUI.CreateLayout()), indention));
 }
Beispiel #18
0
 public static AnimationCurve Draw(this AnimationCurve current, UnityLabel label = null, bool indention = true)
 {
     return(EditorUI.Draw(() => EditorGUILayout.CurveField(label, current, EditorUI.CreateLayout()), indention));
 }
Beispiel #19
0
 public static Type Draw <Type>(this UnityObject current, UnityLabel label = null, bool allowScene = true, bool indention = true) where Type : UnityObject
 {
     return((Type)EditorUI.Draw(() => EditorGUILayout.ObjectField(label, current, typeof(Type), allowScene, EditorUI.CreateLayout()), indention));
 }
Beispiel #20
0
 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));
 }
Beispiel #21
0
 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));
 }
Beispiel #22
0
 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));
 }
Beispiel #23
0
        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()));
        }
Beispiel #24
0
 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);
 }
Beispiel #25
0
 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));
 }