// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) VRMADA, All rights reserved.
//
// --------------------------------------------------------------------------------------------------------------------
using UltimateXR.UI.UnityInputModule.Controls;
using UnityEditor;
using UnityEditor.EventSystems;
namespace UltimateXR.Editor.UI.UnityInputModule.Controls
{
///
/// Custom inspector for . Needs to inherit from
/// because is an EventTrigger-derived component.
///
[CustomEditor(typeof(UxrControlInput))]
[CanEditMultipleObjects]
public class UxrControlInputEditor : EventTriggerEditor
{
#region Unity
///
/// Caches the serialized properties.
///
protected override void OnEnable()
{
_propertyPressAndHoldDuration = serializedObject.FindProperty("_pressAndHoldDuration");
_propertyFeedbackOnDown = serializedObject.FindProperty("_feedbackOnPress");
_propertyFeedbackOnUp = serializedObject.FindProperty("_feedbackOnRelease");
_propertyFeedbackOnClick = serializedObject.FindProperty("_feedbackOnClick");
}
///
/// Draws the custom inspector, including the one implemented in child classes.
///
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(_propertyPressAndHoldDuration);
EditorGUILayout.PropertyField(_propertyFeedbackOnDown, true);
EditorGUILayout.PropertyField(_propertyFeedbackOnUp, true);
EditorGUILayout.PropertyField(_propertyFeedbackOnClick, true);
// Child properties
OnControlInputInspectorGUI();
serializedObject.ApplyModifiedProperties();
}
#endregion
#region Event Trigger Methods
///
/// Overridable method to draw child properties.
///
protected virtual void OnControlInputInspectorGUI()
{
}
#endregion
#region Private Types & Data
private SerializedProperty _propertyPressAndHoldDuration;
private SerializedProperty _propertyFeedbackOnDown;
private SerializedProperty _propertyFeedbackOnUp;
private SerializedProperty _propertyFeedbackOnClick;
#endregion
}
}