AlicizaX/Client/Assets/Scripts/Hotfix/GameLogic/GameInput.cs

1049 lines
48 KiB
C#
Raw Normal View History

2025-09-02 16:30:55 +08:00
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.13.1
// from Assets/Art/GameInputSO.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/Art/GameInputSO.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&lt;Vector2&gt;()}");
/// }
///
/// // Invoked when "Attack" action is either started, performed or canceled.
/// public void OnAttack(InputAction.CallbackContext context)
/// {
/// Debug.Log($"OnAttack: {context.ReadValue&lt;float&gt;()}");
/// }
///
/// #endregion
/// }
/// </code>
/// </example>
public partial class @GameInput: IInputActionCollection2, IDisposable
{
/// <summary>
/// Provides access to the underlying asset instance.
/// </summary>
public InputActionAsset asset { get; }
/// <summary>
/// Constructs a new instance.
/// </summary>
public @GameInput()
{
asset = InputActionAsset.FromJson(@"{
""name"": ""GameInputSO"",
""maps"": [
{
""name"": ""Player"",
""id"": ""f62a4b92-ef5e-4175-8f4c-c9075429d32c"",
""actions"": [
{
""name"": ""Move"",
""type"": ""Value"",
""id"": ""6bc1aaf4-b110-4ff7-891e-5b9fe6f32c4d"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
},
{
""name"": ""Look"",
""type"": ""Value"",
""id"": ""2690c379-f54d-45be-a724-414123833eb4"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
},
{
""name"": ""Jump"",
""type"": ""Button"",
""id"": ""8c4abdf8-4099-493a-aa1a-129acec7c3df"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Sprint"",
""type"": ""Value"",
""id"": ""980e881e-182c-404c-8cbf-3d09fdb48fef"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
},
{
""name"": ""Escape"",
""type"": ""Button"",
""id"": ""d0bfd212-2876-4c8e-b35e-cfb618a9dc0b"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""InteractPrimary"",
""type"": ""Button"",
""id"": ""66b26e9d-c51a-4fb2-a4cc-3f44bdff3355"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""InteractSecondary"",
""type"": ""Button"",
""id"": ""5cc4edbd-955c-4718-8bce-ce78d07abf3f"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Zoom"",
""type"": ""PassThrough"",
""id"": ""702f73cf-2f96-4624-871e-f1263393b8f5"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Toggle Walking"",
""type"": ""Button"",
""id"": ""4a6790ad-d534-44f4-bfde-3a550760bd39"",
""expectedControlType"": """",
""processors"": """",
""interactions"": ""Press(behavior=1)"",
""initialStateCheck"": false
}
],
""bindings"": [
{
""name"": ""WASD"",
""id"": ""b7594ddb-26c9-4ba2-bd5a-901468929edc"",
""path"": ""2DVector(mode=1)"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Move"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""up"",
""id"": ""2063a8b5-6a45-43de-851b-65f3d46e7b58"",
""path"": ""<Keyboard>/w"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardMouse"",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""down"",
""id"": ""64e4d037-32e1-4fb9-80e4-fc7330404dfe"",
""path"": ""<Keyboard>/s"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardMouse"",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""left"",
""id"": ""0fce8b11-5eab-4e4e-a741-b732e7b20873"",
""path"": ""<Keyboard>/a"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardMouse"",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""right"",
""id"": ""7bdda0d6-57a8-47c8-8238-8aecf3110e47"",
""path"": ""<Keyboard>/d"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardMouse"",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""up"",
""id"": ""bb94b405-58d3-4998-8535-d705c1218a98"",
""path"": ""<Keyboard>/upArrow"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardMouse"",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""down"",
""id"": ""929d9071-7dd0-4368-9743-6793bb98087e"",
""path"": ""<Keyboard>/downArrow"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardMouse"",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""left"",
""id"": ""28abadba-06ff-4d37-bb70-af2f1e35a3b9"",
""path"": ""<Keyboard>/leftArrow"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardMouse"",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""right"",
""id"": ""45f115b6-9b4f-4ba8-b500-b94c93bf7d7e"",
""path"": ""<Keyboard>/rightArrow"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardMouse"",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""e2f9aa65-db06-4c5b-a2e9-41bc8acb9517"",
""path"": ""<Gamepad>/leftStick"",
""interactions"": """",
""processors"": ""StickDeadzone"",
""groups"": ""Gamepad"",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""ed66cbff-2900-4a62-8896-696503cfcd31"",
""path"": ""<Pointer>/delta"",
""interactions"": """",
""processors"": ""InvertVector2(invertX=false),ScaleVector2(x=0.05,y=0.05)"",
""groups"": ""KeyboardMouse"",
""action"": ""Look"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""d1d171b6-19d8-47a6-ba3a-71b6a8e7b3c0"",
""path"": ""<Gamepad>/rightStick"",
""interactions"": """",
""processors"": ""InvertVector2(invertX=false),StickDeadzone,ScaleVector2(x=300,y=300)"",
""groups"": ""Gamepad"",
""action"": ""Look"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""1bd55a0b-761e-4ae4-89ae-8ec127e08a29"",
""path"": ""<Keyboard>/space"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardMouse"",
""action"": ""Jump"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""9f973413-5e27-4239-acee-38c4a63feeba"",
""path"": ""<Gamepad>/buttonSouth"",
""interactions"": """",
""processors"": """",
""groups"": ""Gamepad"",
""action"": ""Jump"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""dc65b89f-9bd3-43fb-92af-d0d87ba5faa4"",
""path"": ""<Keyboard>/leftShift"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardMouse"",
""action"": ""Sprint"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""c8fcd86e-dcfd-4f88-8e93-b638cdbf3320"",
""path"": ""<Gamepad>/leftTrigger"",
""interactions"": """",
""processors"": """",
""groups"": ""Gamepad"",
""action"": ""Sprint"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""2253ad85-a0da-43df-ac0e-ee4d9e37f9fa"",
""path"": ""<Keyboard>/escape"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardMouse"",
""action"": ""Escape"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""ec4c5980-4d30-41c4-b1b4-658d52b3a103"",
""path"": ""<Mouse>/leftButton"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardMouse"",
""action"": ""InteractPrimary"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""adcb95fb-24a3-4c13-a238-588970915d06"",
""path"": ""<Mouse>/rightButton"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyboardMouse"",
""action"": ""InteractSecondary"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""18772126-eab8-4125-b643-22aa0566bc51"",
""path"": ""<Mouse>/scroll/y"",
""interactions"": """",
""processors"": ""Clamp(min=-0.1,max=0.1)"",
""groups"": """",
""action"": ""Zoom"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""fcac67ce-ed18-4457-b978-8eff197ccf91"",
""path"": ""<Gamepad>/dpad/y"",
""interactions"": """",
""processors"": ""Clamp(min=-0.01,max=0.01)"",
""groups"": """",
""action"": ""Zoom"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""5edc2393-2264-49df-8e82-18f9cfa4e062"",
""path"": ""<Keyboard>/leftCtrl"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Toggle Walking"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
},
{
""name"": ""UI"",
""id"": ""ebfdbacf-7468-4988-9497-b726572473ea"",
""actions"": [
{
""name"": ""Cancel"",
""type"": ""Button"",
""id"": ""1c614fd1-b2d4-4a37-8a58-480ab69e09a5"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Submit"",
""type"": ""Button"",
""id"": ""8a983366-d7b9-4953-89d1-7f6e4392ecc6"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
{
""name"": """",
""id"": ""55447a8c-bc61-4ae9-98e4-ccdcdb2bd538"",
""path"": ""*/{Cancel}"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Cancel"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""9783ec4c-2684-44b8-b4dc-ca554c527049"",
""path"": ""*/{Submit}"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Submit"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
],
""controlSchemes"": [
{
""name"": ""KeyboardMouse"",
""bindingGroup"": ""KeyboardMouse"",
""devices"": [
{
""devicePath"": ""<Keyboard>"",
""isOptional"": false,
""isOR"": false
},
{
""devicePath"": ""<Mouse>"",
""isOptional"": false,
""isOR"": false
}
]
},
{
""name"": ""Gamepad"",
""bindingGroup"": ""Gamepad"",
""devices"": [
{
""devicePath"": ""<Gamepad>"",
""isOptional"": true,
""isOR"": false
},
{
""devicePath"": ""<XInputController>"",
""isOptional"": true,
""isOR"": false
},
{
""devicePath"": ""<DualShockGamepad>"",
""isOptional"": true,
""isOR"": false
}
]
},
{
""name"": ""Xbox Controller"",
""bindingGroup"": ""Xbox Controller"",
""devices"": []
},
{
""name"": ""PS4 Controller"",
""bindingGroup"": ""PS4 Controller"",
""devices"": []
}
]
}");
// Player
m_Player = asset.FindActionMap("Player", throwIfNotFound: true);
m_Player_Move = m_Player.FindAction("Move", throwIfNotFound: true);
m_Player_Look = m_Player.FindAction("Look", throwIfNotFound: true);
m_Player_Jump = m_Player.FindAction("Jump", throwIfNotFound: true);
m_Player_Sprint = m_Player.FindAction("Sprint", throwIfNotFound: true);
m_Player_Escape = m_Player.FindAction("Escape", throwIfNotFound: true);
m_Player_InteractPrimary = m_Player.FindAction("InteractPrimary", throwIfNotFound: true);
m_Player_InteractSecondary = m_Player.FindAction("InteractSecondary", throwIfNotFound: true);
m_Player_Zoom = m_Player.FindAction("Zoom", throwIfNotFound: true);
m_Player_ToggleWalking = m_Player.FindAction("Toggle Walking", throwIfNotFound: true);
// UI
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
m_UI_Cancel = m_UI.FindAction("Cancel", throwIfNotFound: true);
m_UI_Submit = m_UI.FindAction("Submit", throwIfNotFound: true);
}
~@GameInput()
{
UnityEngine.Debug.Assert(!m_Player.enabled, "This will cause a leak and performance issues, GameInput.Player.Disable() has not been called.");
UnityEngine.Debug.Assert(!m_UI.enabled, "This will cause a leak and performance issues, GameInput.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);
}
// Player
private readonly InputActionMap m_Player;
private List<IPlayerActions> m_PlayerActionsCallbackInterfaces = new List<IPlayerActions>();
private readonly InputAction m_Player_Move;
private readonly InputAction m_Player_Look;
private readonly InputAction m_Player_Jump;
private readonly InputAction m_Player_Sprint;
private readonly InputAction m_Player_Escape;
private readonly InputAction m_Player_InteractPrimary;
private readonly InputAction m_Player_InteractSecondary;
private readonly InputAction m_Player_Zoom;
private readonly InputAction m_Player_ToggleWalking;
/// <summary>
/// Provides access to input actions defined in input action map "Player".
/// </summary>
public struct PlayerActions
{
private @GameInput m_Wrapper;
/// <summary>
/// Construct a new instance of the input action map wrapper class.
/// </summary>
public PlayerActions(@GameInput wrapper) { m_Wrapper = wrapper; }
/// <summary>
/// Provides access to the underlying input action "Player/Move".
/// </summary>
public InputAction @Move => m_Wrapper.m_Player_Move;
/// <summary>
/// Provides access to the underlying input action "Player/Look".
/// </summary>
public InputAction @Look => m_Wrapper.m_Player_Look;
/// <summary>
/// Provides access to the underlying input action "Player/Jump".
/// </summary>
public InputAction @Jump => m_Wrapper.m_Player_Jump;
/// <summary>
/// Provides access to the underlying input action "Player/Sprint".
/// </summary>
public InputAction @Sprint => m_Wrapper.m_Player_Sprint;
/// <summary>
/// Provides access to the underlying input action "Player/Escape".
/// </summary>
public InputAction @Escape => m_Wrapper.m_Player_Escape;
/// <summary>
/// Provides access to the underlying input action "Player/InteractPrimary".
/// </summary>
public InputAction @InteractPrimary => m_Wrapper.m_Player_InteractPrimary;
/// <summary>
/// Provides access to the underlying input action "Player/InteractSecondary".
/// </summary>
public InputAction @InteractSecondary => m_Wrapper.m_Player_InteractSecondary;
/// <summary>
/// Provides access to the underlying input action "Player/Zoom".
/// </summary>
public InputAction @Zoom => m_Wrapper.m_Player_Zoom;
/// <summary>
/// Provides access to the underlying input action "Player/ToggleWalking".
/// </summary>
public InputAction @ToggleWalking => m_Wrapper.m_Player_ToggleWalking;
/// <summary>
/// Provides access to the underlying input action map instance.
/// </summary>
public InputActionMap Get() { return m_Wrapper.m_Player; }
/// <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="PlayerActions" /> to an <see ref="InputActionMap" /> instance.
/// </summary>
public static implicit operator InputActionMap(PlayerActions 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="PlayerActions" />
public void AddCallbacks(IPlayerActions instance)
{
if (instance == null || m_Wrapper.m_PlayerActionsCallbackInterfaces.Contains(instance)) return;
m_Wrapper.m_PlayerActionsCallbackInterfaces.Add(instance);
@Move.started += instance.OnMove;
@Move.performed += instance.OnMove;
@Move.canceled += instance.OnMove;
@Look.started += instance.OnLook;
@Look.performed += instance.OnLook;
@Look.canceled += instance.OnLook;
@Jump.started += instance.OnJump;
@Jump.performed += instance.OnJump;
@Jump.canceled += instance.OnJump;
@Sprint.started += instance.OnSprint;
@Sprint.performed += instance.OnSprint;
@Sprint.canceled += instance.OnSprint;
@Escape.started += instance.OnEscape;
@Escape.performed += instance.OnEscape;
@Escape.canceled += instance.OnEscape;
@InteractPrimary.started += instance.OnInteractPrimary;
@InteractPrimary.performed += instance.OnInteractPrimary;
@InteractPrimary.canceled += instance.OnInteractPrimary;
@InteractSecondary.started += instance.OnInteractSecondary;
@InteractSecondary.performed += instance.OnInteractSecondary;
@InteractSecondary.canceled += instance.OnInteractSecondary;
@Zoom.started += instance.OnZoom;
@Zoom.performed += instance.OnZoom;
@Zoom.canceled += instance.OnZoom;
@ToggleWalking.started += instance.OnToggleWalking;
@ToggleWalking.performed += instance.OnToggleWalking;
@ToggleWalking.canceled += instance.OnToggleWalking;
}
/// <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="PlayerActions" />
private void UnregisterCallbacks(IPlayerActions instance)
{
@Move.started -= instance.OnMove;
@Move.performed -= instance.OnMove;
@Move.canceled -= instance.OnMove;
@Look.started -= instance.OnLook;
@Look.performed -= instance.OnLook;
@Look.canceled -= instance.OnLook;
@Jump.started -= instance.OnJump;
@Jump.performed -= instance.OnJump;
@Jump.canceled -= instance.OnJump;
@Sprint.started -= instance.OnSprint;
@Sprint.performed -= instance.OnSprint;
@Sprint.canceled -= instance.OnSprint;
@Escape.started -= instance.OnEscape;
@Escape.performed -= instance.OnEscape;
@Escape.canceled -= instance.OnEscape;
@InteractPrimary.started -= instance.OnInteractPrimary;
@InteractPrimary.performed -= instance.OnInteractPrimary;
@InteractPrimary.canceled -= instance.OnInteractPrimary;
@InteractSecondary.started -= instance.OnInteractSecondary;
@InteractSecondary.performed -= instance.OnInteractSecondary;
@InteractSecondary.canceled -= instance.OnInteractSecondary;
@Zoom.started -= instance.OnZoom;
@Zoom.performed -= instance.OnZoom;
@Zoom.canceled -= instance.OnZoom;
@ToggleWalking.started -= instance.OnToggleWalking;
@ToggleWalking.performed -= instance.OnToggleWalking;
@ToggleWalking.canceled -= instance.OnToggleWalking;
}
/// <summary>
/// Unregisters <param cref="instance" /> and unregisters all input action callbacks via <see cref="PlayerActions.UnregisterCallbacks(IPlayerActions)" />.
/// </summary>
/// <seealso cref="PlayerActions.UnregisterCallbacks(IPlayerActions)" />
public void RemoveCallbacks(IPlayerActions instance)
{
if (m_Wrapper.m_PlayerActionsCallbackInterfaces.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="PlayerActions.AddCallbacks(IPlayerActions)" />
/// <seealso cref="PlayerActions.RemoveCallbacks(IPlayerActions)" />
/// <seealso cref="PlayerActions.UnregisterCallbacks(IPlayerActions)" />
public void SetCallbacks(IPlayerActions instance)
{
foreach (var item in m_Wrapper.m_PlayerActionsCallbackInterfaces)
UnregisterCallbacks(item);
m_Wrapper.m_PlayerActionsCallbackInterfaces.Clear();
AddCallbacks(instance);
}
}
/// <summary>
/// Provides a new <see cref="PlayerActions" /> instance referencing this action map.
/// </summary>
public PlayerActions @Player => new PlayerActions(this);
// UI
private readonly InputActionMap m_UI;
private List<IUIActions> m_UIActionsCallbackInterfaces = new List<IUIActions>();
private readonly InputAction m_UI_Cancel;
private readonly InputAction m_UI_Submit;
/// <summary>
/// Provides access to input actions defined in input action map "UI".
/// </summary>
public struct UIActions
{
private @GameInput m_Wrapper;
/// <summary>
/// Construct a new instance of the input action map wrapper class.
/// </summary>
public UIActions(@GameInput wrapper) { m_Wrapper = wrapper; }
/// <summary>
/// Provides access to the underlying input action "UI/Cancel".
/// </summary>
public InputAction @Cancel => m_Wrapper.m_UI_Cancel;
/// <summary>
/// Provides access to the underlying input action "UI/Submit".
/// </summary>
public InputAction @Submit => m_Wrapper.m_UI_Submit;
/// <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);
@Cancel.started += instance.OnCancel;
@Cancel.performed += instance.OnCancel;
@Cancel.canceled += instance.OnCancel;
@Submit.started += instance.OnSubmit;
@Submit.performed += instance.OnSubmit;
@Submit.canceled += instance.OnSubmit;
}
/// <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)
{
@Cancel.started -= instance.OnCancel;
@Cancel.performed -= instance.OnCancel;
@Cancel.canceled -= instance.OnCancel;
@Submit.started -= instance.OnSubmit;
@Submit.performed -= instance.OnSubmit;
@Submit.canceled -= instance.OnSubmit;
}
/// <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);
private int m_KeyboardMouseSchemeIndex = -1;
/// <summary>
/// Provides access to the input control scheme.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputControlScheme" />
public InputControlScheme KeyboardMouseScheme
{
get
{
if (m_KeyboardMouseSchemeIndex == -1) m_KeyboardMouseSchemeIndex = asset.FindControlSchemeIndex("KeyboardMouse");
return asset.controlSchemes[m_KeyboardMouseSchemeIndex];
}
}
private int m_GamepadSchemeIndex = -1;
/// <summary>
/// Provides access to the input control scheme.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputControlScheme" />
public InputControlScheme GamepadScheme
{
get
{
if (m_GamepadSchemeIndex == -1) m_GamepadSchemeIndex = asset.FindControlSchemeIndex("Gamepad");
return asset.controlSchemes[m_GamepadSchemeIndex];
}
}
private int m_XboxControllerSchemeIndex = -1;
/// <summary>
/// Provides access to the input control scheme.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputControlScheme" />
public InputControlScheme XboxControllerScheme
{
get
{
if (m_XboxControllerSchemeIndex == -1) m_XboxControllerSchemeIndex = asset.FindControlSchemeIndex("Xbox Controller");
return asset.controlSchemes[m_XboxControllerSchemeIndex];
}
}
private int m_PS4ControllerSchemeIndex = -1;
/// <summary>
/// Provides access to the input control scheme.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputControlScheme" />
public InputControlScheme PS4ControllerScheme
{
get
{
if (m_PS4ControllerSchemeIndex == -1) m_PS4ControllerSchemeIndex = asset.FindControlSchemeIndex("PS4 Controller");
return asset.controlSchemes[m_PS4ControllerSchemeIndex];
}
}
/// <summary>
/// Interface to implement callback methods for all input action callbacks associated with input actions defined by "Player" which allows adding and removing callbacks.
/// </summary>
/// <seealso cref="PlayerActions.AddCallbacks(IPlayerActions)" />
/// <seealso cref="PlayerActions.RemoveCallbacks(IPlayerActions)" />
public interface IPlayerActions
{
/// <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 "Look" 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 OnLook(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Jump" 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 OnJump(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Sprint" 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 OnSprint(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Escape" 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 OnEscape(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "InteractPrimary" 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 OnInteractPrimary(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "InteractSecondary" 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 OnInteractSecondary(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 "Toggle Walking" 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 OnToggleWalking(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 "Cancel" 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 OnCancel(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Submit" 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 OnSubmit(InputAction.CallbackContext context);
}
}