704 lines
31 KiB
C#
704 lines
31 KiB
C#
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
|
|
// version 1.14.0
|
|
// from Assets/Games/PublicRes/Actions/CameraInput.inputactions
|
|
//
|
|
// Changes to this file may cause incorrect behavior and will be lost if
|
|
// the code is regenerated.
|
|
// </auto-generated>
|
|
//------------------------------------------------------------------------------
|
|
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine.InputSystem;
|
|
using UnityEngine.InputSystem.Utilities;
|
|
|
|
/// <summary>
|
|
/// Provides programmatic access to <see cref="InputActionAsset" />, <see cref="InputActionMap" />, <see cref="InputAction" /> and <see cref="InputControlScheme" /> instances defined in asset "Assets/Games/PublicRes/Actions/CameraInput.inputactions".
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This class is source generated and any manual edits will be discarded if the associated asset is reimported or modified.
|
|
/// </remarks>
|
|
/// <example>
|
|
/// <code>
|
|
/// using namespace UnityEngine;
|
|
/// using UnityEngine.InputSystem;
|
|
///
|
|
/// // Example of using an InputActionMap named "Player" from a UnityEngine.MonoBehaviour implementing callback interface.
|
|
/// public class Example : MonoBehaviour, MyActions.IPlayerActions
|
|
/// {
|
|
/// private MyActions_Actions m_Actions; // Source code representation of asset.
|
|
/// private MyActions_Actions.PlayerActions m_Player; // Source code representation of action map.
|
|
///
|
|
/// void Awake()
|
|
/// {
|
|
/// m_Actions = new MyActions_Actions(); // Create asset object.
|
|
/// m_Player = m_Actions.Player; // Extract action map object.
|
|
/// m_Player.AddCallbacks(this); // Register callback interface IPlayerActions.
|
|
/// }
|
|
///
|
|
/// void OnDestroy()
|
|
/// {
|
|
/// m_Actions.Dispose(); // Destroy asset object.
|
|
/// }
|
|
///
|
|
/// void OnEnable()
|
|
/// {
|
|
/// m_Player.Enable(); // Enable all actions within map.
|
|
/// }
|
|
///
|
|
/// void OnDisable()
|
|
/// {
|
|
/// m_Player.Disable(); // Disable all actions within map.
|
|
/// }
|
|
///
|
|
/// #region Interface implementation of MyActions.IPlayerActions
|
|
///
|
|
/// // Invoked when "Move" action is either started, performed or canceled.
|
|
/// public void OnMove(InputAction.CallbackContext context)
|
|
/// {
|
|
/// Debug.Log($"OnMove: {context.ReadValue<Vector2>()}");
|
|
/// }
|
|
///
|
|
/// // Invoked when "Attack" action is either started, performed or canceled.
|
|
/// public void OnAttack(InputAction.CallbackContext context)
|
|
/// {
|
|
/// Debug.Log($"OnAttack: {context.ReadValue<float>()}");
|
|
/// }
|
|
///
|
|
/// #endregion
|
|
/// }
|
|
/// </code>
|
|
/// </example>
|
|
public partial class @CameraInput: IInputActionCollection2, IDisposable
|
|
{
|
|
/// <summary>
|
|
/// Provides access to the underlying asset instance.
|
|
/// </summary>
|
|
public InputActionAsset asset { get; }
|
|
|
|
/// <summary>
|
|
/// Constructs a new instance.
|
|
/// </summary>
|
|
public @CameraInput()
|
|
{
|
|
asset = InputActionAsset.FromJson(@"{
|
|
""name"": ""CameraInput"",
|
|
""maps"": [
|
|
{
|
|
""name"": ""Gameplay"",
|
|
""id"": ""c2cdfc44-3b8a-492d-aa84-54d18c119216"",
|
|
""actions"": [
|
|
{
|
|
""name"": ""Move"",
|
|
""type"": ""Value"",
|
|
""id"": ""ce4c0dfa-ae16-40ec-8a2c-bec126f5fda2"",
|
|
""expectedControlType"": ""Vector2"",
|
|
""processors"": """",
|
|
""interactions"": """",
|
|
""initialStateCheck"": true
|
|
},
|
|
{
|
|
""name"": ""Zoom"",
|
|
""type"": ""Value"",
|
|
""id"": ""4f0d0acf-e3b8-4c89-9491-8ab731cdd999"",
|
|
""expectedControlType"": ""Vector2"",
|
|
""processors"": """",
|
|
""interactions"": """",
|
|
""initialStateCheck"": true
|
|
},
|
|
{
|
|
""name"": ""Rotate"",
|
|
""type"": ""Value"",
|
|
""id"": ""4ff55b4b-d4dd-4e10-a1c7-f502baa8e9a6"",
|
|
""expectedControlType"": ""Vector2"",
|
|
""processors"": ""ScaleVector2(x=0),ScaleVector2(x=2,y=2)"",
|
|
""interactions"": """",
|
|
""initialStateCheck"": true
|
|
},
|
|
{
|
|
""name"": ""Press"",
|
|
""type"": ""Value"",
|
|
""id"": ""d18307cd-ccc2-4853-8739-1cb11d53b7fd"",
|
|
""expectedControlType"": ""Vector2"",
|
|
""processors"": """",
|
|
""interactions"": """",
|
|
""initialStateCheck"": true
|
|
}
|
|
],
|
|
""bindings"": [
|
|
{
|
|
""name"": """",
|
|
""id"": ""f1e5dde9-5307-4b0b-bd56-8b96f18280cb"",
|
|
""path"": ""<Mouse>/position"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Move"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""16b56c2b-5844-4261-82d4-3716a3321155"",
|
|
""path"": ""<Gamepad>/rightStick"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Move"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""3af712f3-0ce3-4fb5-b94a-0d75e3696f78"",
|
|
""path"": ""<Touchscreen>/touch0/position"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Move"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""c039d5c5-bdbf-4b95-8219-b1afa256b199"",
|
|
""path"": ""<Mouse>/scroll"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Zoom"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""DeltaMiddleButton"",
|
|
""id"": ""bf5eeb96-3cd8-4ca1-aa40-4ed1c0b9ed63"",
|
|
""path"": ""OneModifier"",
|
|
""interactions"": ""Press"",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Zoom"",
|
|
""isComposite"": true,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""modifier"",
|
|
""id"": ""0a1eabe5-df18-4694-8be7-8f33799b1203"",
|
|
""path"": ""<Mouse>/middleButton"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Zoom"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""binding"",
|
|
""id"": ""e441cfba-d19c-4b10-a0b8-3565f39568a2"",
|
|
""path"": ""<Mouse>/delta"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Zoom"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""f02f2256-bad6-4444-b20c-be6d43a1c648"",
|
|
""path"": ""<Touchscreen>/touch1/position"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Zoom"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""One Modifier"",
|
|
""id"": ""431b9eea-80f6-4ba4-b8ab-61b9641f65a2"",
|
|
""path"": ""OneModifier"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Rotate"",
|
|
""isComposite"": true,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""binding"",
|
|
""id"": ""5659b6f7-34e5-47b4-b2a2-270ee338c3d2"",
|
|
""path"": ""<Keyboard>/q"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Rotate"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""One Modifier"",
|
|
""id"": ""9351eca2-6c7e-4d5d-b1bb-fe1fee143e7e"",
|
|
""path"": ""OneModifier"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Rotate"",
|
|
""isComposite"": true,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""binding"",
|
|
""id"": ""c233a125-2ee8-4354-99e2-cec0afd891b9"",
|
|
""path"": ""<Keyboard>/e"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Rotate"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": ""One Modifier"",
|
|
""id"": ""415545f3-f152-45df-a6eb-565849363f9d"",
|
|
""path"": ""OneModifier"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Rotate"",
|
|
""isComposite"": true,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": ""binding"",
|
|
""id"": ""5c61f34f-3ffa-4c76-832b-266259fcbf44"",
|
|
""path"": ""<Gamepad>/rightStick/y"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Rotate"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": true
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""814e2c1c-4de9-468e-ac3a-10dc69a3f3d5"",
|
|
""path"": ""<Mouse>/leftButton"",
|
|
""interactions"": ""Press"",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Press"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
},
|
|
{
|
|
""name"": """",
|
|
""id"": ""7eb7e82f-cf9d-40c0-b3b8-6d3ea4a4b72b"",
|
|
""path"": ""<Touchscreen>/Press"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Press"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
""name"": ""UI"",
|
|
""id"": ""c280e802-84cf-4d2f-85b1-16465bde41b1"",
|
|
""actions"": [
|
|
{
|
|
""name"": ""Pointer"",
|
|
""type"": ""PassThrough"",
|
|
""id"": ""d8768973-f6c9-4f3b-9cde-08e9fa684744"",
|
|
""expectedControlType"": ""Vector2"",
|
|
""processors"": """",
|
|
""interactions"": """",
|
|
""initialStateCheck"": false
|
|
}
|
|
],
|
|
""bindings"": [
|
|
{
|
|
""name"": """",
|
|
""id"": ""31271302-1db4-4da3-a6e2-aa1d4dfdf2e8"",
|
|
""path"": ""<Pointer>/position"",
|
|
""interactions"": """",
|
|
""processors"": """",
|
|
""groups"": """",
|
|
""action"": ""Pointer"",
|
|
""isComposite"": false,
|
|
""isPartOfComposite"": false
|
|
}
|
|
]
|
|
}
|
|
],
|
|
""controlSchemes"": []
|
|
}");
|
|
// Gameplay
|
|
m_Gameplay = asset.FindActionMap("Gameplay", throwIfNotFound: true);
|
|
m_Gameplay_Move = m_Gameplay.FindAction("Move", throwIfNotFound: true);
|
|
m_Gameplay_Zoom = m_Gameplay.FindAction("Zoom", throwIfNotFound: true);
|
|
m_Gameplay_Rotate = m_Gameplay.FindAction("Rotate", throwIfNotFound: true);
|
|
m_Gameplay_Press = m_Gameplay.FindAction("Press", throwIfNotFound: true);
|
|
// UI
|
|
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
|
|
m_UI_Pointer = m_UI.FindAction("Pointer", throwIfNotFound: true);
|
|
}
|
|
|
|
~@CameraInput()
|
|
{
|
|
UnityEngine.Debug.Assert(!m_Gameplay.enabled, "This will cause a leak and performance issues, CameraInput.Gameplay.Disable() has not been called.");
|
|
UnityEngine.Debug.Assert(!m_UI.enabled, "This will cause a leak and performance issues, CameraInput.UI.Disable() has not been called.");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Destroys this asset and all associated <see cref="InputAction"/> instances.
|
|
/// </summary>
|
|
public void Dispose()
|
|
{
|
|
UnityEngine.Object.Destroy(asset);
|
|
}
|
|
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.bindingMask" />
|
|
public InputBinding? bindingMask
|
|
{
|
|
get => asset.bindingMask;
|
|
set => asset.bindingMask = value;
|
|
}
|
|
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.devices" />
|
|
public ReadOnlyArray<InputDevice>? devices
|
|
{
|
|
get => asset.devices;
|
|
set => asset.devices = value;
|
|
}
|
|
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.controlSchemes" />
|
|
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
|
|
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Contains(InputAction)" />
|
|
public bool Contains(InputAction action)
|
|
{
|
|
return asset.Contains(action);
|
|
}
|
|
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.GetEnumerator()" />
|
|
public IEnumerator<InputAction> GetEnumerator()
|
|
{
|
|
return asset.GetEnumerator();
|
|
}
|
|
|
|
/// <inheritdoc cref="IEnumerable.GetEnumerator()" />
|
|
IEnumerator IEnumerable.GetEnumerator()
|
|
{
|
|
return GetEnumerator();
|
|
}
|
|
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Enable()" />
|
|
public void Enable()
|
|
{
|
|
asset.Enable();
|
|
}
|
|
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Disable()" />
|
|
public void Disable()
|
|
{
|
|
asset.Disable();
|
|
}
|
|
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.bindings" />
|
|
public IEnumerable<InputBinding> bindings => asset.bindings;
|
|
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.FindAction(string, bool)" />
|
|
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
|
|
{
|
|
return asset.FindAction(actionNameOrId, throwIfNotFound);
|
|
}
|
|
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.FindBinding(InputBinding, out InputAction)" />
|
|
public int FindBinding(InputBinding bindingMask, out InputAction action)
|
|
{
|
|
return asset.FindBinding(bindingMask, out action);
|
|
}
|
|
|
|
// Gameplay
|
|
private readonly InputActionMap m_Gameplay;
|
|
private List<IGameplayActions> m_GameplayActionsCallbackInterfaces = new List<IGameplayActions>();
|
|
private readonly InputAction m_Gameplay_Move;
|
|
private readonly InputAction m_Gameplay_Zoom;
|
|
private readonly InputAction m_Gameplay_Rotate;
|
|
private readonly InputAction m_Gameplay_Press;
|
|
/// <summary>
|
|
/// Provides access to input actions defined in input action map "Gameplay".
|
|
/// </summary>
|
|
public struct GameplayActions
|
|
{
|
|
private @CameraInput m_Wrapper;
|
|
|
|
/// <summary>
|
|
/// Construct a new instance of the input action map wrapper class.
|
|
/// </summary>
|
|
public GameplayActions(@CameraInput wrapper) { m_Wrapper = wrapper; }
|
|
/// <summary>
|
|
/// Provides access to the underlying input action "Gameplay/Move".
|
|
/// </summary>
|
|
public InputAction @Move => m_Wrapper.m_Gameplay_Move;
|
|
/// <summary>
|
|
/// Provides access to the underlying input action "Gameplay/Zoom".
|
|
/// </summary>
|
|
public InputAction @Zoom => m_Wrapper.m_Gameplay_Zoom;
|
|
/// <summary>
|
|
/// Provides access to the underlying input action "Gameplay/Rotate".
|
|
/// </summary>
|
|
public InputAction @Rotate => m_Wrapper.m_Gameplay_Rotate;
|
|
/// <summary>
|
|
/// Provides access to the underlying input action "Gameplay/Press".
|
|
/// </summary>
|
|
public InputAction @Press => m_Wrapper.m_Gameplay_Press;
|
|
/// <summary>
|
|
/// Provides access to the underlying input action map instance.
|
|
/// </summary>
|
|
public InputActionMap Get() { return m_Wrapper.m_Gameplay; }
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Enable()" />
|
|
public void Enable() { Get().Enable(); }
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Disable()" />
|
|
public void Disable() { Get().Disable(); }
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.enabled" />
|
|
public bool enabled => Get().enabled;
|
|
/// <summary>
|
|
/// Implicitly converts an <see ref="GameplayActions" /> to an <see ref="InputActionMap" /> instance.
|
|
/// </summary>
|
|
public static implicit operator InputActionMap(GameplayActions set) { return set.Get(); }
|
|
/// <summary>
|
|
/// Adds <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
|
|
/// </summary>
|
|
/// <param name="instance">Callback instance.</param>
|
|
/// <remarks>
|
|
/// If <paramref name="instance" /> is <c>null</c> or <paramref name="instance"/> have already been added this method does nothing.
|
|
/// </remarks>
|
|
/// <seealso cref="GameplayActions" />
|
|
public void AddCallbacks(IGameplayActions instance)
|
|
{
|
|
if (instance == null || m_Wrapper.m_GameplayActionsCallbackInterfaces.Contains(instance)) return;
|
|
m_Wrapper.m_GameplayActionsCallbackInterfaces.Add(instance);
|
|
@Move.started += instance.OnMove;
|
|
@Move.performed += instance.OnMove;
|
|
@Move.canceled += instance.OnMove;
|
|
@Zoom.started += instance.OnZoom;
|
|
@Zoom.performed += instance.OnZoom;
|
|
@Zoom.canceled += instance.OnZoom;
|
|
@Rotate.started += instance.OnRotate;
|
|
@Rotate.performed += instance.OnRotate;
|
|
@Rotate.canceled += instance.OnRotate;
|
|
@Press.started += instance.OnPress;
|
|
@Press.performed += instance.OnPress;
|
|
@Press.canceled += instance.OnPress;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Removes <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Calling this method when <paramref name="instance" /> have not previously been registered has no side-effects.
|
|
/// </remarks>
|
|
/// <seealso cref="GameplayActions" />
|
|
private void UnregisterCallbacks(IGameplayActions instance)
|
|
{
|
|
@Move.started -= instance.OnMove;
|
|
@Move.performed -= instance.OnMove;
|
|
@Move.canceled -= instance.OnMove;
|
|
@Zoom.started -= instance.OnZoom;
|
|
@Zoom.performed -= instance.OnZoom;
|
|
@Zoom.canceled -= instance.OnZoom;
|
|
@Rotate.started -= instance.OnRotate;
|
|
@Rotate.performed -= instance.OnRotate;
|
|
@Rotate.canceled -= instance.OnRotate;
|
|
@Press.started -= instance.OnPress;
|
|
@Press.performed -= instance.OnPress;
|
|
@Press.canceled -= instance.OnPress;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Unregisters <param cref="instance" /> and unregisters all input action callbacks via <see cref="GameplayActions.UnregisterCallbacks(IGameplayActions)" />.
|
|
/// </summary>
|
|
/// <seealso cref="GameplayActions.UnregisterCallbacks(IGameplayActions)" />
|
|
public void RemoveCallbacks(IGameplayActions instance)
|
|
{
|
|
if (m_Wrapper.m_GameplayActionsCallbackInterfaces.Remove(instance))
|
|
UnregisterCallbacks(instance);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Replaces all existing callback instances and previously registered input action callbacks associated with them with callbacks provided via <param cref="instance" />.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// If <paramref name="instance" /> is <c>null</c>, calling this method will only unregister all existing callbacks but not register any new callbacks.
|
|
/// </remarks>
|
|
/// <seealso cref="GameplayActions.AddCallbacks(IGameplayActions)" />
|
|
/// <seealso cref="GameplayActions.RemoveCallbacks(IGameplayActions)" />
|
|
/// <seealso cref="GameplayActions.UnregisterCallbacks(IGameplayActions)" />
|
|
public void SetCallbacks(IGameplayActions instance)
|
|
{
|
|
foreach (var item in m_Wrapper.m_GameplayActionsCallbackInterfaces)
|
|
UnregisterCallbacks(item);
|
|
m_Wrapper.m_GameplayActionsCallbackInterfaces.Clear();
|
|
AddCallbacks(instance);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Provides a new <see cref="GameplayActions" /> instance referencing this action map.
|
|
/// </summary>
|
|
public GameplayActions @Gameplay => new GameplayActions(this);
|
|
|
|
// UI
|
|
private readonly InputActionMap m_UI;
|
|
private List<IUIActions> m_UIActionsCallbackInterfaces = new List<IUIActions>();
|
|
private readonly InputAction m_UI_Pointer;
|
|
/// <summary>
|
|
/// Provides access to input actions defined in input action map "UI".
|
|
/// </summary>
|
|
public struct UIActions
|
|
{
|
|
private @CameraInput m_Wrapper;
|
|
|
|
/// <summary>
|
|
/// Construct a new instance of the input action map wrapper class.
|
|
/// </summary>
|
|
public UIActions(@CameraInput wrapper) { m_Wrapper = wrapper; }
|
|
/// <summary>
|
|
/// Provides access to the underlying input action "UI/Pointer".
|
|
/// </summary>
|
|
public InputAction @Pointer => m_Wrapper.m_UI_Pointer;
|
|
/// <summary>
|
|
/// Provides access to the underlying input action map instance.
|
|
/// </summary>
|
|
public InputActionMap Get() { return m_Wrapper.m_UI; }
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Enable()" />
|
|
public void Enable() { Get().Enable(); }
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Disable()" />
|
|
public void Disable() { Get().Disable(); }
|
|
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.enabled" />
|
|
public bool enabled => Get().enabled;
|
|
/// <summary>
|
|
/// Implicitly converts an <see ref="UIActions" /> to an <see ref="InputActionMap" /> instance.
|
|
/// </summary>
|
|
public static implicit operator InputActionMap(UIActions set) { return set.Get(); }
|
|
/// <summary>
|
|
/// Adds <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
|
|
/// </summary>
|
|
/// <param name="instance">Callback instance.</param>
|
|
/// <remarks>
|
|
/// If <paramref name="instance" /> is <c>null</c> or <paramref name="instance"/> have already been added this method does nothing.
|
|
/// </remarks>
|
|
/// <seealso cref="UIActions" />
|
|
public void AddCallbacks(IUIActions instance)
|
|
{
|
|
if (instance == null || m_Wrapper.m_UIActionsCallbackInterfaces.Contains(instance)) return;
|
|
m_Wrapper.m_UIActionsCallbackInterfaces.Add(instance);
|
|
@Pointer.started += instance.OnPointer;
|
|
@Pointer.performed += instance.OnPointer;
|
|
@Pointer.canceled += instance.OnPointer;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Removes <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Calling this method when <paramref name="instance" /> have not previously been registered has no side-effects.
|
|
/// </remarks>
|
|
/// <seealso cref="UIActions" />
|
|
private void UnregisterCallbacks(IUIActions instance)
|
|
{
|
|
@Pointer.started -= instance.OnPointer;
|
|
@Pointer.performed -= instance.OnPointer;
|
|
@Pointer.canceled -= instance.OnPointer;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Unregisters <param cref="instance" /> and unregisters all input action callbacks via <see cref="UIActions.UnregisterCallbacks(IUIActions)" />.
|
|
/// </summary>
|
|
/// <seealso cref="UIActions.UnregisterCallbacks(IUIActions)" />
|
|
public void RemoveCallbacks(IUIActions instance)
|
|
{
|
|
if (m_Wrapper.m_UIActionsCallbackInterfaces.Remove(instance))
|
|
UnregisterCallbacks(instance);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Replaces all existing callback instances and previously registered input action callbacks associated with them with callbacks provided via <param cref="instance" />.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// If <paramref name="instance" /> is <c>null</c>, calling this method will only unregister all existing callbacks but not register any new callbacks.
|
|
/// </remarks>
|
|
/// <seealso cref="UIActions.AddCallbacks(IUIActions)" />
|
|
/// <seealso cref="UIActions.RemoveCallbacks(IUIActions)" />
|
|
/// <seealso cref="UIActions.UnregisterCallbacks(IUIActions)" />
|
|
public void SetCallbacks(IUIActions instance)
|
|
{
|
|
foreach (var item in m_Wrapper.m_UIActionsCallbackInterfaces)
|
|
UnregisterCallbacks(item);
|
|
m_Wrapper.m_UIActionsCallbackInterfaces.Clear();
|
|
AddCallbacks(instance);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Provides a new <see cref="UIActions" /> instance referencing this action map.
|
|
/// </summary>
|
|
public UIActions @UI => new UIActions(this);
|
|
/// <summary>
|
|
/// Interface to implement callback methods for all input action callbacks associated with input actions defined by "Gameplay" which allows adding and removing callbacks.
|
|
/// </summary>
|
|
/// <seealso cref="GameplayActions.AddCallbacks(IGameplayActions)" />
|
|
/// <seealso cref="GameplayActions.RemoveCallbacks(IGameplayActions)" />
|
|
public interface IGameplayActions
|
|
{
|
|
/// <summary>
|
|
/// Method invoked when associated input action "Move" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
|
/// </summary>
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
|
void OnMove(InputAction.CallbackContext context);
|
|
/// <summary>
|
|
/// Method invoked when associated input action "Zoom" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
|
/// </summary>
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
|
void OnZoom(InputAction.CallbackContext context);
|
|
/// <summary>
|
|
/// Method invoked when associated input action "Rotate" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
|
/// </summary>
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
|
void OnRotate(InputAction.CallbackContext context);
|
|
/// <summary>
|
|
/// Method invoked when associated input action "Press" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
|
/// </summary>
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
|
void OnPress(InputAction.CallbackContext context);
|
|
}
|
|
/// <summary>
|
|
/// Interface to implement callback methods for all input action callbacks associated with input actions defined by "UI" which allows adding and removing callbacks.
|
|
/// </summary>
|
|
/// <seealso cref="UIActions.AddCallbacks(IUIActions)" />
|
|
/// <seealso cref="UIActions.RemoveCallbacks(IUIActions)" />
|
|
public interface IUIActions
|
|
{
|
|
/// <summary>
|
|
/// Method invoked when associated input action "Pointer" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
|
/// </summary>
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
|
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
|
void OnPointer(InputAction.CallbackContext context);
|
|
}
|
|
}
|