new input system working
This commit is contained in:
@@ -211,6 +211,34 @@ public partial class @InputMaster: IInputActionCollection2, IDisposable
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
""name"": ""Quit"",
|
||||
""id"": ""438f3b6d-0c7f-4b9a-8ad9-e9f579d301c1"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""Quit"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""70626aec-c0b2-4b69-8178-0cf47115bc24"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""a9d6f446-7259-4075-aa28-d6c782ee269a"",
|
||||
""path"": ""<Keyboard>/escape"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Quit"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
""controlSchemes"": [
|
||||
@@ -248,6 +276,9 @@ public partial class @InputMaster: IInputActionCollection2, IDisposable
|
||||
m_Car_Movement = m_Car.FindAction("Movement", throwIfNotFound: true);
|
||||
m_Car_Turn = m_Car.FindAction("Turn", throwIfNotFound: true);
|
||||
m_Car_Brake = m_Car.FindAction("Brake", throwIfNotFound: true);
|
||||
// Quit
|
||||
m_Quit = asset.FindActionMap("Quit", throwIfNotFound: true);
|
||||
m_Quit_Quit = m_Quit.FindAction("Quit", throwIfNotFound: true);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@@ -367,6 +398,52 @@ public partial class @InputMaster: IInputActionCollection2, IDisposable
|
||||
}
|
||||
}
|
||||
public CarActions @Car => new CarActions(this);
|
||||
|
||||
// Quit
|
||||
private readonly InputActionMap m_Quit;
|
||||
private List<IQuitActions> m_QuitActionsCallbackInterfaces = new List<IQuitActions>();
|
||||
private readonly InputAction m_Quit_Quit;
|
||||
public struct QuitActions
|
||||
{
|
||||
private @InputMaster m_Wrapper;
|
||||
public QuitActions(@InputMaster wrapper) { m_Wrapper = wrapper; }
|
||||
public InputAction @Quit => m_Wrapper.m_Quit_Quit;
|
||||
public InputActionMap Get() { return m_Wrapper.m_Quit; }
|
||||
public void Enable() { Get().Enable(); }
|
||||
public void Disable() { Get().Disable(); }
|
||||
public bool enabled => Get().enabled;
|
||||
public static implicit operator InputActionMap(QuitActions set) { return set.Get(); }
|
||||
public void AddCallbacks(IQuitActions instance)
|
||||
{
|
||||
if (instance == null || m_Wrapper.m_QuitActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_QuitActionsCallbackInterfaces.Add(instance);
|
||||
@Quit.started += instance.OnQuit;
|
||||
@Quit.performed += instance.OnQuit;
|
||||
@Quit.canceled += instance.OnQuit;
|
||||
}
|
||||
|
||||
private void UnregisterCallbacks(IQuitActions instance)
|
||||
{
|
||||
@Quit.started -= instance.OnQuit;
|
||||
@Quit.performed -= instance.OnQuit;
|
||||
@Quit.canceled -= instance.OnQuit;
|
||||
}
|
||||
|
||||
public void RemoveCallbacks(IQuitActions instance)
|
||||
{
|
||||
if (m_Wrapper.m_QuitActionsCallbackInterfaces.Remove(instance))
|
||||
UnregisterCallbacks(instance);
|
||||
}
|
||||
|
||||
public void SetCallbacks(IQuitActions instance)
|
||||
{
|
||||
foreach (var item in m_Wrapper.m_QuitActionsCallbackInterfaces)
|
||||
UnregisterCallbacks(item);
|
||||
m_Wrapper.m_QuitActionsCallbackInterfaces.Clear();
|
||||
AddCallbacks(instance);
|
||||
}
|
||||
}
|
||||
public QuitActions @Quit => new QuitActions(this);
|
||||
private int m_GamepadSchemeIndex = -1;
|
||||
public InputControlScheme GamepadScheme
|
||||
{
|
||||
@@ -391,4 +468,8 @@ public partial class @InputMaster: IInputActionCollection2, IDisposable
|
||||
void OnTurn(InputAction.CallbackContext context);
|
||||
void OnBrake(InputAction.CallbackContext context);
|
||||
}
|
||||
public interface IQuitActions
|
||||
{
|
||||
void OnQuit(InputAction.CallbackContext context);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user