diff options
author | chai <chaifix@163.com> | 2021-05-08 23:15:13 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-05-08 23:15:13 +0800 |
commit | d07e14add74e017b52ab2371efeea1aa4ea10ced (patch) | |
tree | efd07869326e4c428f5bfe43fad0c2583d32a401 /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.cs | 33 |
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; + } + } +} |