UnityGame/Library/PackageCache/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPicker.cs
2024-10-27 10:53:47 +03:00

42 lines
1.0 KiB
C#

#if UNITY_EDITOR || PACKAGE_DOCS_GENERATION
using System;
////REVIEW: should this be a PopupWindowContent?
namespace UnityEngine.InputSystem.Editor
{
/// <summary>
/// A popup that allows picking input controls graphically.
/// </summary>
public sealed class InputControlPicker : IDisposable
{
public InputControlPicker(Mode mode, Action<string> onPick, InputControlPickerState state)
{
m_State = state ?? new InputControlPickerState();
m_Dropdown = new InputControlPickerDropdown(state, onPick, mode: mode);
}
public void Show(Rect rect)
{
m_Dropdown.Show(rect);
}
public void Dispose()
{
m_Dropdown?.Dispose();
}
public InputControlPickerState state => m_State;
private readonly InputControlPickerDropdown m_Dropdown;
private readonly InputControlPickerState m_State;
public enum Mode
{
PickControl,
PickDevice,
}
}
}
#endif // UNITY_EDITOR