#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS using System; using System.Collections.Generic; using System.Linq; using UnityEditor; using UnityEditor.UIElements; using UnityEngine.UIElements; namespace UnityEngine.InputSystem.Editor { internal class ActionPropertiesView : ViewBase<(SerializedInputAction?, List)> { private readonly Foldout m_ParentFoldout; private readonly int m_DropdownLabelWidth = 90; public ActionPropertiesView(VisualElement root, Foldout foldout, StateContainer stateContainer) : base(root, stateContainer) { m_ParentFoldout = foldout; // TODO: Consider IEquatable and how to compare selector data CreateSelector(Selectors.GetSelectedAction, (inputAction, _) => { if (!inputAction.HasValue) return (null, new List()); return (inputAction.Value, Selectors.BuildControlTypeList(inputAction.Value.type).ToList()); }); } public override void RedrawUI((SerializedInputAction ? , List) viewState) { if (!viewState.Item1.HasValue) return; m_ParentFoldout.text = "Action"; var inputAction = viewState.Item1.Value; rootElement.Clear(); var actionType = new EnumField("Action Type", inputAction.type) { tooltip = inputAction.actionTypeTooltip }; // Tighten up the gap between the label and dropdown so the latter is more readable when the parent pane is at min width. var actionLabel = actionType.Q