summaryrefslogtreecommitdiff
path: root/Assets/uGUI-2017.1/Editor/UI/PropertyDrawers/AnimationTriggersDrawer.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-10-08 09:50:33 +0800
committerchai <chaifix@163.com>2020-10-08 09:50:33 +0800
commit00dae1bd426d892dff73a50f1c505afd1ac00a90 (patch)
tree5d75f8495406f5b8dd01595e3dd9216887996a34 /Assets/uGUI-2017.1/Editor/UI/PropertyDrawers/AnimationTriggersDrawer.cs
+init
Diffstat (limited to 'Assets/uGUI-2017.1/Editor/UI/PropertyDrawers/AnimationTriggersDrawer.cs')
-rw-r--r--Assets/uGUI-2017.1/Editor/UI/PropertyDrawers/AnimationTriggersDrawer.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/Assets/uGUI-2017.1/Editor/UI/PropertyDrawers/AnimationTriggersDrawer.cs b/Assets/uGUI-2017.1/Editor/UI/PropertyDrawers/AnimationTriggersDrawer.cs
new file mode 100644
index 0000000..67cab2e
--- /dev/null
+++ b/Assets/uGUI-2017.1/Editor/UI/PropertyDrawers/AnimationTriggersDrawer.cs
@@ -0,0 +1,33 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+namespace UnityEditor.UI
+{
+ [CustomPropertyDrawer(typeof(AnimationTriggers), true)]
+ public class AnimationTriggersDrawer : PropertyDrawer
+ {
+ public override void OnGUI(Rect rect, SerializedProperty prop, GUIContent label)
+ {
+ Rect drawRect = rect;
+ drawRect.height = EditorGUIUtility.singleLineHeight;
+
+ SerializedProperty normalTrigger = prop.FindPropertyRelative("m_NormalTrigger");
+ SerializedProperty higlightedTrigger = prop.FindPropertyRelative("m_HighlightedTrigger");
+ SerializedProperty pressedTrigger = prop.FindPropertyRelative("m_PressedTrigger");
+ SerializedProperty disabledTrigger = prop.FindPropertyRelative("m_DisabledTrigger");
+
+ EditorGUI.PropertyField(drawRect, normalTrigger);
+ drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
+ EditorGUI.PropertyField(drawRect, higlightedTrigger);
+ drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
+ EditorGUI.PropertyField(drawRect, pressedTrigger);
+ drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
+ EditorGUI.PropertyField(drawRect, disabledTrigger);
+ }
+
+ public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
+ {
+ return 4 * EditorGUIUtility.singleLineHeight + 3 * EditorGUIUtility.standardVerticalSpacing;
+ }
+ }
+}