2022-01-12 10:06:03 +03:00
|
|
|
using UnityEngine.UI;
|
|
|
|
|
2022-01-12 10:39:15 +03:00
|
|
|
namespace UnityEditor.UI
|
2022-01-12 10:06:03 +03:00
|
|
|
{
|
2022-01-12 10:39:15 +03:00
|
|
|
[CustomEditor(typeof(Dropdown), true)]
|
2022-01-12 10:06:03 +03:00
|
|
|
[CanEditMultipleObjects]
|
2022-01-12 10:39:15 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Custom editor for the Dropdown component
|
|
|
|
/// Extend this class to write a custom editor for a component derived from Dropdown.
|
|
|
|
/// </summary>
|
2022-01-12 10:06:03 +03:00
|
|
|
public class DropdownEditor : SelectableEditor
|
|
|
|
{
|
|
|
|
SerializedProperty m_Template;
|
|
|
|
SerializedProperty m_CaptionText;
|
|
|
|
SerializedProperty m_CaptionImage;
|
|
|
|
SerializedProperty m_ItemText;
|
|
|
|
SerializedProperty m_ItemImage;
|
|
|
|
SerializedProperty m_OnSelectionChanged;
|
|
|
|
SerializedProperty m_Value;
|
|
|
|
SerializedProperty m_Options;
|
2022-01-12 10:39:15 +03:00
|
|
|
SerializedProperty m_AlphaFadeSpeed;
|
2022-01-12 10:06:03 +03:00
|
|
|
|
|
|
|
protected override void OnEnable()
|
|
|
|
{
|
|
|
|
base.OnEnable();
|
|
|
|
m_Template = serializedObject.FindProperty("m_Template");
|
|
|
|
m_CaptionText = serializedObject.FindProperty("m_CaptionText");
|
|
|
|
m_CaptionImage = serializedObject.FindProperty("m_CaptionImage");
|
|
|
|
m_ItemText = serializedObject.FindProperty("m_ItemText");
|
|
|
|
m_ItemImage = serializedObject.FindProperty("m_ItemImage");
|
|
|
|
m_OnSelectionChanged = serializedObject.FindProperty("m_OnValueChanged");
|
|
|
|
m_Value = serializedObject.FindProperty("m_Value");
|
|
|
|
m_Options = serializedObject.FindProperty("m_Options");
|
2022-01-12 10:39:15 +03:00
|
|
|
m_AlphaFadeSpeed = serializedObject.FindProperty("m_AlphaFadeSpeed");
|
2022-01-12 10:06:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnInspectorGUI()
|
|
|
|
{
|
|
|
|
base.OnInspectorGUI();
|
|
|
|
EditorGUILayout.Space();
|
|
|
|
|
|
|
|
serializedObject.Update();
|
|
|
|
EditorGUILayout.PropertyField(m_Template);
|
|
|
|
EditorGUILayout.PropertyField(m_CaptionText);
|
|
|
|
EditorGUILayout.PropertyField(m_CaptionImage);
|
|
|
|
EditorGUILayout.PropertyField(m_ItemText);
|
|
|
|
EditorGUILayout.PropertyField(m_ItemImage);
|
|
|
|
EditorGUILayout.PropertyField(m_Value);
|
|
|
|
EditorGUILayout.PropertyField(m_AlphaFadeSpeed);
|
|
|
|
EditorGUILayout.PropertyField(m_Options);
|
|
|
|
EditorGUILayout.PropertyField(m_OnSelectionChanged);
|
|
|
|
serializedObject.ApplyModifiedProperties();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|