예제 #1
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(EditorGUIExtension.Draw <int>(() => EditorGUI.Popup(area, name, index, current.ToArray(), style), indention));
        }
예제 #2
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);
     }
     EditorGUIExtension.Draw(() => EditorGUI.PropertyField(area, current, label, allowScene), indention);
 }
예제 #3
0
 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);
 }
예제 #4
0
        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);
        }
예제 #5
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, Class.CreateLayout());

            EditorGUIExtension.Draw(action, indention);
        }
예제 #6
0
 //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);
 }
예제 #7
0
        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);
        }
예제 #8
0
        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);
        }
예제 #9
0
 //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);
 }
예제 #10
0
 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));
 }
예제 #11
0
 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));
 }
예제 #12
0
 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));
 }
예제 #13
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)EditorGUIExtension.Draw <UnityObject>(() => EditorGUI.ObjectField(area, label, current, typeof(Type), allowScene), indention));
 }
예제 #14
0
 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));
 }
예제 #15
0
 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));
 }
예제 #16
0
 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));
 }
예제 #17
0
 public static Vector3 DrawVector3(this Vector3 current, UnityLabel label = null, bool indention = true)
 {
     return(EditorGUIExtension.Draw <Vector3>(() => EditorGUILayout.Vector3Field(label, current, Class.CreateLayout()), indention));
 }
예제 #18
0
 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));
 }
예제 #19
0
 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));
 }
예제 #20
0
 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));
 }
예제 #21
0
 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));
 }
예제 #22
0
 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));
 }
예제 #23
0
 //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));
 }
예제 #24
0
 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));
 }
예제 #25
0
 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));
 }
예제 #26
0
 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));
 }
예제 #27
0
 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));
 }
예제 #28
0
 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));
 }
예제 #29
0
        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));
        }
예제 #30
0
 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));
 }