summaryrefslogtreecommitdiff
path: root/Assets/uGUI-2017.1/Editor/UI/PropertyDrawers/SpriteStateDrawer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/uGUI-2017.1/Editor/UI/PropertyDrawers/SpriteStateDrawer.cs')
-rw-r--r--Assets/uGUI-2017.1/Editor/UI/PropertyDrawers/SpriteStateDrawer.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/Assets/uGUI-2017.1/Editor/UI/PropertyDrawers/SpriteStateDrawer.cs b/Assets/uGUI-2017.1/Editor/UI/PropertyDrawers/SpriteStateDrawer.cs
new file mode 100644
index 0000000..510db1a
--- /dev/null
+++ b/Assets/uGUI-2017.1/Editor/UI/PropertyDrawers/SpriteStateDrawer.cs
@@ -0,0 +1,30 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+namespace UnityEditor.UI
+{
+ [CustomPropertyDrawer(typeof(SpriteState), true)]
+ public class SpriteStateDrawer : PropertyDrawer
+ {
+ public override void OnGUI(Rect rect, SerializedProperty prop, GUIContent label)
+ {
+ Rect drawRect = rect;
+ drawRect.height = EditorGUIUtility.singleLineHeight;
+ SerializedProperty highlightedSprite = prop.FindPropertyRelative("m_HighlightedSprite");
+ SerializedProperty pressedSprite = prop.FindPropertyRelative("m_PressedSprite");
+ SerializedProperty disabledSprite = prop.FindPropertyRelative("m_DisabledSprite");
+
+ EditorGUI.PropertyField(drawRect, highlightedSprite);
+ drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
+ EditorGUI.PropertyField(drawRect, pressedSprite);
+ drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
+ EditorGUI.PropertyField(drawRect, disabledSprite);
+ drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
+ }
+
+ public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
+ {
+ return 3 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
+ }
+ }
+}