コード例 #1
0
        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);
        }
コード例 #2
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() ?? EditorUI.CreateLayout();

            return(EditorUI.Draw(() => EditorGUILayout.EnumPopup(label, current, style, layout), indention));
        }
コード例 #3
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() ?? EditorUI.CreateLayout();

            return(EditorUI.Draw(() => EditorGUILayout.FloatField(label, current, style, layout), indention));
        }
コード例 #4
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() ?? EditorUI.CreateLayout();

            return(EditorUI.Draw(() => EditorGUILayout.Toggle(label, current, style, layout), indention));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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));
        }
コード例 #7
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()));
        }
コード例 #8
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
        }
コード例 #9
0
 public static Color Draw(this Color current, UnityLabel label = null, bool indention = true)
 {
     return(EditorUI.Draw(() => EditorGUILayout.ColorField(label, current, EditorUI.CreateLayout()), indention));
 }
コード例 #10
0
 public static AnimationCurve Draw(this AnimationCurve current, UnityLabel label = null, bool indention = true)
 {
     return(EditorUI.Draw(() => EditorGUILayout.CurveField(label, current, EditorUI.CreateLayout()), indention));
 }
コード例 #11
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);
        }
コード例 #12
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));
 }
コード例 #13
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));
 }
コード例 #14
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));
 }