radial menu work as expected

This commit is contained in:
2024-11-21 19:19:44 +02:00
parent 35837405a5
commit 992f31ad85
14 changed files with 762 additions and 222 deletions
@@ -29,18 +29,18 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
""actions"": [
{
""name"": ""PointClick"",
""type"": ""Button"",
""type"": ""PassThrough"",
""id"": ""fb720cef-8db9-45ea-94b8-34ee20907014"",
""expectedControlType"": """",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
""initialStateCheck"": true
},
{
""name"": ""CancelClick"",
""type"": ""Button"",
""id"": ""a045f2ab-c0ec-42fc-9343-39839caf2ba4"",
""expectedControlType"": ""Button"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
@@ -354,11 +354,20 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
""actions"": [
{
""name"": ""Click"",
""type"": ""Button"",
""type"": ""PassThrough"",
""id"": ""cddc5ce5-b808-4da9-b23b-f24a5126f838"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
},
{
""name"": ""Point"",
""type"": ""PassThrough"",
""id"": ""8fe62ab9-ffe9-4edc-8a1a-e66417e475c8"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
@@ -373,6 +382,17 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
""action"": ""Click"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""6013fd8b-2f52-4b27-8549-249c73d113b2"",
""path"": ""<Mouse>/{Point}"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Point"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
@@ -391,6 +411,7 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
// UI
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
m_UI_Click = m_UI.FindAction("Click", throwIfNotFound: true);
m_UI_Point = m_UI.FindAction("Point", throwIfNotFound: true);
}
~@InputActions()
@@ -576,11 +597,13 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
private readonly InputActionMap m_UI;
private List<IUIActions> m_UIActionsCallbackInterfaces = new List<IUIActions>();
private readonly InputAction m_UI_Click;
private readonly InputAction m_UI_Point;
public struct UIActions
{
private @InputActions m_Wrapper;
public UIActions(@InputActions wrapper) { m_Wrapper = wrapper; }
public InputAction @Click => m_Wrapper.m_UI_Click;
public InputAction @Point => m_Wrapper.m_UI_Point;
public InputActionMap Get() { return m_Wrapper.m_UI; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
@@ -593,6 +616,9 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
@Click.started += instance.OnClick;
@Click.performed += instance.OnClick;
@Click.canceled += instance.OnClick;
@Point.started += instance.OnPoint;
@Point.performed += instance.OnPoint;
@Point.canceled += instance.OnPoint;
}
private void UnregisterCallbacks(IUIActions instance)
@@ -600,6 +626,9 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
@Click.started -= instance.OnClick;
@Click.performed -= instance.OnClick;
@Click.canceled -= instance.OnClick;
@Point.started -= instance.OnPoint;
@Point.performed -= instance.OnPoint;
@Point.canceled -= instance.OnPoint;
}
public void RemoveCallbacks(IUIActions instance)
@@ -631,5 +660,6 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
public interface IUIActions
{
void OnClick(InputAction.CallbackContext context);
void OnPoint(InputAction.CallbackContext context);
}
}