UnityGame/Library/PackageCache/com.unity.inputsystem/Samples~/SimpleDemo/SimpleControls.cs

299 lines
11 KiB
C#
Raw Normal View History

2024-10-27 10:53:47 +03:00
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.11.1
// from Assets/Samples/SimpleDemo/SimpleControls.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;
public partial class @SimpleControls: IInputActionCollection2, IDisposable
{
public InputActionAsset asset { get; }
public @SimpleControls()
{
asset = InputActionAsset.FromJson(@"{
""name"": ""SimpleControls"",
""maps"": [
{
""name"": ""gameplay"",
""id"": ""265c38f5-dd18-4d34-b198-aec58e1627ff"",
""actions"": [
{
""name"": ""fire"",
""type"": ""Button"",
""id"": ""1077f913-a9f9-41b1-acb3-b9ee0adbc744"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": ""Tap,SlowTap"",
""initialStateCheck"": false
},
{
""name"": ""move"",
""type"": ""Value"",
""id"": ""50fd2809-3aa3-4a90-988e-1facf6773553"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
},
{
""name"": ""look"",
""type"": ""Value"",
""id"": ""c60e0974-d140-4597-a40e-9862193067e9"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
}
],
""bindings"": [
{
""name"": """",
""id"": ""abb776f3-f329-4f7b-bbf8-b577d13be018"",
""path"": ""*/{PrimaryAction}"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""fire"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""e1b8c4dd-7b3a-4db6-a93a-0889b59b1afc"",
""path"": ""<Gamepad>/leftStick"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""move"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": ""Dpad"",
""id"": ""cefc16fc-557a-44b0-939f-2ad792876b07"",
""path"": ""Dpad"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""move"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""up"",
""id"": ""07244659-79df-461d-b329-defbe2fbc5f6"",
""path"": ""<Keyboard>/w"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""down"",
""id"": ""f0ec75cb-f02c-40d2-a33f-1fd6eab2ae0b"",
""path"": ""<Keyboard>/s"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""left"",
""id"": ""21fe6bfe-4721-4483-9f4a-a0031ade105c"",
""path"": ""<Keyboard>/a"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""right"",
""id"": ""2dd39746-c75c-4a11-838a-e59eacaf4e0b"",
""path"": ""<Keyboard>/d"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""c106d6e6-2780-47ff-b318-396171bd54cc"",
""path"": ""<Gamepad>/rightStick"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""look"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""578caa03-6827-4797-adfc-a59770c437fe"",
""path"": ""<Pointer>/delta"",
""interactions"": """",
""processors"": ""ScaleVector2(x=2,y=2)"",
""groups"": """",
""action"": ""look"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
],
""controlSchemes"": []
}");
// gameplay
m_gameplay = asset.FindActionMap("gameplay", throwIfNotFound: true);
m_gameplay_fire = m_gameplay.FindAction("fire", throwIfNotFound: true);
m_gameplay_move = m_gameplay.FindAction("move", throwIfNotFound: true);
m_gameplay_look = m_gameplay.FindAction("look", throwIfNotFound: true);
}
~@SimpleControls()
{
UnityEngine.Debug.Assert(!m_gameplay.enabled, "This will cause a leak and performance issues, SimpleControls.gameplay.Disable() has not been called.");
}
public void Dispose()
{
UnityEngine.Object.Destroy(asset);
}
public InputBinding? bindingMask
{
get => asset.bindingMask;
set => asset.bindingMask = value;
}
public ReadOnlyArray<InputDevice>? devices
{
get => asset.devices;
set => asset.devices = value;
}
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
public bool Contains(InputAction action)
{
return asset.Contains(action);
}
public IEnumerator<InputAction> GetEnumerator()
{
return asset.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public void Enable()
{
asset.Enable();
}
public void Disable()
{
asset.Disable();
}
public IEnumerable<InputBinding> bindings => asset.bindings;
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
{
return asset.FindAction(actionNameOrId, throwIfNotFound);
}
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_fire;
private readonly InputAction m_gameplay_move;
private readonly InputAction m_gameplay_look;
public struct GameplayActions
{
private @SimpleControls m_Wrapper;
public GameplayActions(@SimpleControls wrapper) { m_Wrapper = wrapper; }
public InputAction @fire => m_Wrapper.m_gameplay_fire;
public InputAction @move => m_Wrapper.m_gameplay_move;
public InputAction @look => m_Wrapper.m_gameplay_look;
public InputActionMap Get() { return m_Wrapper.m_gameplay; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
public bool enabled => Get().enabled;
public static implicit operator InputActionMap(GameplayActions set) { return set.Get(); }
public void AddCallbacks(IGameplayActions instance)
{
if (instance == null || m_Wrapper.m_GameplayActionsCallbackInterfaces.Contains(instance)) return;
m_Wrapper.m_GameplayActionsCallbackInterfaces.Add(instance);
@fire.started += instance.OnFire;
@fire.performed += instance.OnFire;
@fire.canceled += instance.OnFire;
@move.started += instance.OnMove;
@move.performed += instance.OnMove;
@move.canceled += instance.OnMove;
@look.started += instance.OnLook;
@look.performed += instance.OnLook;
@look.canceled += instance.OnLook;
}
private void UnregisterCallbacks(IGameplayActions instance)
{
@fire.started -= instance.OnFire;
@fire.performed -= instance.OnFire;
@fire.canceled -= instance.OnFire;
@move.started -= instance.OnMove;
@move.performed -= instance.OnMove;
@move.canceled -= instance.OnMove;
@look.started -= instance.OnLook;
@look.performed -= instance.OnLook;
@look.canceled -= instance.OnLook;
}
public void RemoveCallbacks(IGameplayActions instance)
{
if (m_Wrapper.m_GameplayActionsCallbackInterfaces.Remove(instance))
UnregisterCallbacks(instance);
}
public void SetCallbacks(IGameplayActions instance)
{
foreach (var item in m_Wrapper.m_GameplayActionsCallbackInterfaces)
UnregisterCallbacks(item);
m_Wrapper.m_GameplayActionsCallbackInterfaces.Clear();
AddCallbacks(instance);
}
}
public GameplayActions @gameplay => new GameplayActions(this);
public interface IGameplayActions
{
void OnFire(InputAction.CallbackContext context);
void OnMove(InputAction.CallbackContext context);
void OnLook(InputAction.CallbackContext context);
}
}