Example #1
0
        public static string Draw(this string current, UnityLabel label = null, GUIStyle style = null, bool indention = true)
        {
            style = style ?? EditorStyles.textField;
            var layout = style.CreateLayout() ?? Class.CreateLayout();

            return(EditorUI.Draw <string>(() => EditorGUILayout.TextField(label, current, style, layout), indention));
        }
Example #2
0
        public static bool Draw(this bool current, UnityLabel label = null, GUIStyle style = null, bool indention = true)
        {
            style = style ?? EditorStyles.toggle;
            var layout = style.CreateLayout() ?? Class.CreateLayout();

            return(EditorUI.Draw <bool>(() => EditorGUILayout.Toggle(label, current, style, layout), indention));
        }
Example #3
0
        public static bool DrawButton(this UnityLabel current, GUIStyle style = null, bool indention = true)
        {
            style = style ?? GUI.skin.button;
            var layout = style.CreateLayout() ?? Class.CreateLayout();

            return(EditorUI.Draw <bool>(() => GUILayout.Button(current, style, layout), indention));
        }
Example #4
0
        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 <int>(() => EditorGUILayout.Popup(labelValue, index, current.ToArray(), style), indention));
        }
Example #5
0
        public static float Draw(this float current, UnityLabel label = null, GUIStyle style = null, bool indention = true)
        {
            style = style ?? EditorStyles.numberField;
            var layout = style.CreateLayout() ?? Class.CreateLayout();

            return(EditorUI.Draw <float>(() => EditorGUILayout.FloatField(label, current, style, layout), indention));
        }
Example #6
0
        public static Enum Draw(this Enum current, UnityLabel label = null, GUIStyle style = null, bool indention = true)
        {
            style = style ?? EditorStyles.popup;
            var layout = style.CreateLayout() ?? Class.CreateLayout();

            return(EditorUI.Draw <Enum>(() => EditorGUILayout.EnumPopup(label, current, style, layout), indention));
        }
Example #7
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);
        }
Example #8
0
        public static void DrawLabel(this UnityLabel current, GUIStyle style = null, bool indention = true)
        {
            style = style ?? EditorStyles.label;
            var layout = style.CreateLayout() ?? Class.CreateLayout();

            if (indention)
            {
                EditorUI.Draw(() => EditorGUILayout.LabelField(current, style, layout), indention);
                return;
            }
            EditorUI.Draw(() => GUILayout.Label(current, style, layout), indention);
        }
Example #9
0
        public static void DrawHelp(this string current, string textType = "Info", 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(() => EditorGUILayout.HelpBox(current, type), indention);
        }
Example #10
0
 public static Color Draw(this Color current, UnityLabel label = null, bool indention = true)
 {
     return(EditorUI.Draw <Color>(() => EditorGUILayout.ColorField(label, current, EditorUI.CreateLayout()), indention));
 }
Example #11
0
 public static AnimationCurve Draw(this AnimationCurve current, UnityLabel label = null, bool indention = true)
 {
     return(EditorUI.Draw <AnimationCurve>(() => EditorGUILayout.CurveField(label, current, EditorUI.CreateLayout()), indention));
 }
Example #12
0
 public static Rect Draw(this Rect current, UnityLabel label = null, bool indention = true)
 {
     return(EditorUI.Draw <Rect>(() => EditorGUILayout.RectField(label, current, EditorUI.CreateLayout()), indention));
 }
Example #13
0
 public static int DrawSlider(this int current, int min, int max, UnityLabel label = null, bool indention = true)
 {
     return(EditorUI.Draw <int>(() => EditorGUILayout.IntSlider(label, current, min, max, EditorUI.CreateLayout()), indention));
 }
Example #14
0
 public static Vector4 DrawVector4(this Vector4 current, UnityLabel label = null, bool indention = true)
 {
     return(EditorUI.Draw <Vector4>(() => EditorGUILayout.Vector4Field(label.ToString(), current, EditorUI.CreateLayout()), indention));
 }
Example #15
0
 public static Vector3 DrawVector3(this Vector3 current, UnityLabel label = null, bool indention = true)
 {
     return(EditorUI.Draw <Vector3>(() => EditorGUILayout.Vector3Field(label, current, EditorUI.CreateLayout()), indention));
 }
Example #16
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 <UnityObject>(() => EditorGUILayout.ObjectField(label, current, typeof(Type), allowScene, EditorUI.CreateLayout()), indention));
 }
Example #17
0
 public static float DrawSlider(this float current, float min, float max, UnityLabel label = null, bool indention = true)
 {
     return(EditorUI.Draw <float>(() => EditorGUILayout.Slider(label, current, min, max, EditorUI.CreateLayout()), indention));
 }