LethalCompany/Lethal Company/ExportedProject/Assets/Scripts/Assembly-CSharp/PlayerActions.cs

482 lines
52 KiB
C#
Raw Normal View History

2023-12-22 22:51:17 +00:00
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
public class PlayerActions : IInputActionCollection2, IInputActionCollection, IEnumerable<InputAction>, IEnumerable, IDisposable
{
public struct MovementActions
{
private PlayerActions m_Wrapper;
public InputAction Look => m_Wrapper.m_Movement_Look;
public InputAction Move => m_Wrapper.m_Movement_Move;
public InputAction Jump => m_Wrapper.m_Movement_Jump;
public InputAction Sprint => m_Wrapper.m_Movement_Sprint;
public InputAction OpenMenu => m_Wrapper.m_Movement_OpenMenu;
public InputAction Interact => m_Wrapper.m_Movement_Interact;
public InputAction Crouch => m_Wrapper.m_Movement_Crouch;
public InputAction Use => m_Wrapper.m_Movement_Use;
public InputAction ActivateItem => m_Wrapper.m_Movement_ActivateItem;
public InputAction Discard => m_Wrapper.m_Movement_Discard;
public InputAction SwitchItem => m_Wrapper.m_Movement_SwitchItem;
public InputAction QEItemInteract => m_Wrapper.m_Movement_QEItemInteract;
public InputAction EnableChat => m_Wrapper.m_Movement_EnableChat;
public InputAction SubmitChat => m_Wrapper.m_Movement_SubmitChat;
public InputAction ReloadBatteries => m_Wrapper.m_Movement_ReloadBatteries;
public InputAction SetFreeCamera => m_Wrapper.m_Movement_SetFreeCamera;
public InputAction InspectItem => m_Wrapper.m_Movement_InspectItem;
public InputAction SpeedCheat => m_Wrapper.m_Movement_SpeedCheat;
public InputAction PingScan => m_Wrapper.m_Movement_PingScan;
public InputAction VoiceButton => m_Wrapper.m_Movement_VoiceButton;
public InputAction Emote1 => m_Wrapper.m_Movement_Emote1;
public InputAction Emote2 => m_Wrapper.m_Movement_Emote2;
public InputAction BuildMode => m_Wrapper.m_Movement_BuildMode;
public InputAction ConfirmBuildMode => m_Wrapper.m_Movement_ConfirmBuildMode;
public InputAction Delete => m_Wrapper.m_Movement_Delete;
public bool enabled => Get().enabled;
public MovementActions(PlayerActions wrapper)
{
m_Wrapper = wrapper;
}
public InputActionMap Get()
{
return m_Wrapper.m_Movement;
}
public void Enable()
{
Get().Enable();
}
public void Disable()
{
Get().Disable();
}
public static implicit operator InputActionMap(MovementActions set)
{
return set.Get();
}
public void AddCallbacks(IMovementActions instance)
{
if (instance != null && !m_Wrapper.m_MovementActionsCallbackInterfaces.Contains(instance))
{
m_Wrapper.m_MovementActionsCallbackInterfaces.Add(instance);
Look.started += instance.OnLook;
Look.performed += instance.OnLook;
Look.canceled += instance.OnLook;
Move.started += instance.OnMove;
Move.performed += instance.OnMove;
Move.canceled += instance.OnMove;
Jump.started += instance.OnJump;
Jump.performed += instance.OnJump;
Jump.canceled += instance.OnJump;
Sprint.started += instance.OnSprint;
Sprint.performed += instance.OnSprint;
Sprint.canceled += instance.OnSprint;
OpenMenu.started += instance.OnOpenMenu;
OpenMenu.performed += instance.OnOpenMenu;
OpenMenu.canceled += instance.OnOpenMenu;
Interact.started += instance.OnInteract;
Interact.performed += instance.OnInteract;
Interact.canceled += instance.OnInteract;
Crouch.started += instance.OnCrouch;
Crouch.performed += instance.OnCrouch;
Crouch.canceled += instance.OnCrouch;
Use.started += instance.OnUse;
Use.performed += instance.OnUse;
Use.canceled += instance.OnUse;
ActivateItem.started += instance.OnActivateItem;
ActivateItem.performed += instance.OnActivateItem;
ActivateItem.canceled += instance.OnActivateItem;
Discard.started += instance.OnDiscard;
Discard.performed += instance.OnDiscard;
Discard.canceled += instance.OnDiscard;
SwitchItem.started += instance.OnSwitchItem;
SwitchItem.performed += instance.OnSwitchItem;
SwitchItem.canceled += instance.OnSwitchItem;
QEItemInteract.started += instance.OnQEItemInteract;
QEItemInteract.performed += instance.OnQEItemInteract;
QEItemInteract.canceled += instance.OnQEItemInteract;
EnableChat.started += instance.OnEnableChat;
EnableChat.performed += instance.OnEnableChat;
EnableChat.canceled += instance.OnEnableChat;
SubmitChat.started += instance.OnSubmitChat;
SubmitChat.performed += instance.OnSubmitChat;
SubmitChat.canceled += instance.OnSubmitChat;
ReloadBatteries.started += instance.OnReloadBatteries;
ReloadBatteries.performed += instance.OnReloadBatteries;
ReloadBatteries.canceled += instance.OnReloadBatteries;
SetFreeCamera.started += instance.OnSetFreeCamera;
SetFreeCamera.performed += instance.OnSetFreeCamera;
SetFreeCamera.canceled += instance.OnSetFreeCamera;
InspectItem.started += instance.OnInspectItem;
InspectItem.performed += instance.OnInspectItem;
InspectItem.canceled += instance.OnInspectItem;
SpeedCheat.started += instance.OnSpeedCheat;
SpeedCheat.performed += instance.OnSpeedCheat;
SpeedCheat.canceled += instance.OnSpeedCheat;
PingScan.started += instance.OnPingScan;
PingScan.performed += instance.OnPingScan;
PingScan.canceled += instance.OnPingScan;
VoiceButton.started += instance.OnVoiceButton;
VoiceButton.performed += instance.OnVoiceButton;
VoiceButton.canceled += instance.OnVoiceButton;
Emote1.started += instance.OnEmote1;
Emote1.performed += instance.OnEmote1;
Emote1.canceled += instance.OnEmote1;
Emote2.started += instance.OnEmote2;
Emote2.performed += instance.OnEmote2;
Emote2.canceled += instance.OnEmote2;
BuildMode.started += instance.OnBuildMode;
BuildMode.performed += instance.OnBuildMode;
BuildMode.canceled += instance.OnBuildMode;
ConfirmBuildMode.started += instance.OnConfirmBuildMode;
ConfirmBuildMode.performed += instance.OnConfirmBuildMode;
ConfirmBuildMode.canceled += instance.OnConfirmBuildMode;
Delete.started += instance.OnDelete;
Delete.performed += instance.OnDelete;
Delete.canceled += instance.OnDelete;
}
}
private void UnregisterCallbacks(IMovementActions instance)
{
Look.started -= instance.OnLook;
Look.performed -= instance.OnLook;
Look.canceled -= instance.OnLook;
Move.started -= instance.OnMove;
Move.performed -= instance.OnMove;
Move.canceled -= instance.OnMove;
Jump.started -= instance.OnJump;
Jump.performed -= instance.OnJump;
Jump.canceled -= instance.OnJump;
Sprint.started -= instance.OnSprint;
Sprint.performed -= instance.OnSprint;
Sprint.canceled -= instance.OnSprint;
OpenMenu.started -= instance.OnOpenMenu;
OpenMenu.performed -= instance.OnOpenMenu;
OpenMenu.canceled -= instance.OnOpenMenu;
Interact.started -= instance.OnInteract;
Interact.performed -= instance.OnInteract;
Interact.canceled -= instance.OnInteract;
Crouch.started -= instance.OnCrouch;
Crouch.performed -= instance.OnCrouch;
Crouch.canceled -= instance.OnCrouch;
Use.started -= instance.OnUse;
Use.performed -= instance.OnUse;
Use.canceled -= instance.OnUse;
ActivateItem.started -= instance.OnActivateItem;
ActivateItem.performed -= instance.OnActivateItem;
ActivateItem.canceled -= instance.OnActivateItem;
Discard.started -= instance.OnDiscard;
Discard.performed -= instance.OnDiscard;
Discard.canceled -= instance.OnDiscard;
SwitchItem.started -= instance.OnSwitchItem;
SwitchItem.performed -= instance.OnSwitchItem;
SwitchItem.canceled -= instance.OnSwitchItem;
QEItemInteract.started -= instance.OnQEItemInteract;
QEItemInteract.performed -= instance.OnQEItemInteract;
QEItemInteract.canceled -= instance.OnQEItemInteract;
EnableChat.started -= instance.OnEnableChat;
EnableChat.performed -= instance.OnEnableChat;
EnableChat.canceled -= instance.OnEnableChat;
SubmitChat.started -= instance.OnSubmitChat;
SubmitChat.performed -= instance.OnSubmitChat;
SubmitChat.canceled -= instance.OnSubmitChat;
ReloadBatteries.started -= instance.OnReloadBatteries;
ReloadBatteries.performed -= instance.OnReloadBatteries;
ReloadBatteries.canceled -= instance.OnReloadBatteries;
SetFreeCamera.started -= instance.OnSetFreeCamera;
SetFreeCamera.performed -= instance.OnSetFreeCamera;
SetFreeCamera.canceled -= instance.OnSetFreeCamera;
InspectItem.started -= instance.OnInspectItem;
InspectItem.performed -= instance.OnInspectItem;
InspectItem.canceled -= instance.OnInspectItem;
SpeedCheat.started -= instance.OnSpeedCheat;
SpeedCheat.performed -= instance.OnSpeedCheat;
SpeedCheat.canceled -= instance.OnSpeedCheat;
PingScan.started -= instance.OnPingScan;
PingScan.performed -= instance.OnPingScan;
PingScan.canceled -= instance.OnPingScan;
VoiceButton.started -= instance.OnVoiceButton;
VoiceButton.performed -= instance.OnVoiceButton;
VoiceButton.canceled -= instance.OnVoiceButton;
Emote1.started -= instance.OnEmote1;
Emote1.performed -= instance.OnEmote1;
Emote1.canceled -= instance.OnEmote1;
Emote2.started -= instance.OnEmote2;
Emote2.performed -= instance.OnEmote2;
Emote2.canceled -= instance.OnEmote2;
BuildMode.started -= instance.OnBuildMode;
BuildMode.performed -= instance.OnBuildMode;
BuildMode.canceled -= instance.OnBuildMode;
ConfirmBuildMode.started -= instance.OnConfirmBuildMode;
ConfirmBuildMode.performed -= instance.OnConfirmBuildMode;
ConfirmBuildMode.canceled -= instance.OnConfirmBuildMode;
Delete.started -= instance.OnDelete;
Delete.performed -= instance.OnDelete;
Delete.canceled -= instance.OnDelete;
}
public void RemoveCallbacks(IMovementActions instance)
{
if (m_Wrapper.m_MovementActionsCallbackInterfaces.Remove(instance))
{
UnregisterCallbacks(instance);
}
}
public void SetCallbacks(IMovementActions instance)
{
foreach (IMovementActions movementActionsCallbackInterface in m_Wrapper.m_MovementActionsCallbackInterfaces)
{
UnregisterCallbacks(movementActionsCallbackInterface);
}
m_Wrapper.m_MovementActionsCallbackInterfaces.Clear();
AddCallbacks(instance);
}
}
public interface IMovementActions
{
void OnLook(InputAction.CallbackContext context);
void OnMove(InputAction.CallbackContext context);
void OnJump(InputAction.CallbackContext context);
void OnSprint(InputAction.CallbackContext context);
void OnOpenMenu(InputAction.CallbackContext context);
void OnInteract(InputAction.CallbackContext context);
void OnCrouch(InputAction.CallbackContext context);
void OnUse(InputAction.CallbackContext context);
void OnActivateItem(InputAction.CallbackContext context);
void OnDiscard(InputAction.CallbackContext context);
void OnSwitchItem(InputAction.CallbackContext context);
void OnQEItemInteract(InputAction.CallbackContext context);
void OnEnableChat(InputAction.CallbackContext context);
void OnSubmitChat(InputAction.CallbackContext context);
void OnReloadBatteries(InputAction.CallbackContext context);
void OnSetFreeCamera(InputAction.CallbackContext context);
void OnInspectItem(InputAction.CallbackContext context);
void OnSpeedCheat(InputAction.CallbackContext context);
void OnPingScan(InputAction.CallbackContext context);
void OnVoiceButton(InputAction.CallbackContext context);
void OnEmote1(InputAction.CallbackContext context);
void OnEmote2(InputAction.CallbackContext context);
void OnBuildMode(InputAction.CallbackContext context);
void OnConfirmBuildMode(InputAction.CallbackContext context);
void OnDelete(InputAction.CallbackContext context);
}
private readonly InputActionMap m_Movement;
private List<IMovementActions> m_MovementActionsCallbackInterfaces = new List<IMovementActions>();
private readonly InputAction m_Movement_Look;
private readonly InputAction m_Movement_Move;
private readonly InputAction m_Movement_Jump;
private readonly InputAction m_Movement_Sprint;
private readonly InputAction m_Movement_OpenMenu;
private readonly InputAction m_Movement_Interact;
private readonly InputAction m_Movement_Crouch;
private readonly InputAction m_Movement_Use;
private readonly InputAction m_Movement_ActivateItem;
private readonly InputAction m_Movement_Discard;
private readonly InputAction m_Movement_SwitchItem;
private readonly InputAction m_Movement_QEItemInteract;
private readonly InputAction m_Movement_EnableChat;
private readonly InputAction m_Movement_SubmitChat;
private readonly InputAction m_Movement_ReloadBatteries;
private readonly InputAction m_Movement_SetFreeCamera;
private readonly InputAction m_Movement_InspectItem;
private readonly InputAction m_Movement_SpeedCheat;
private readonly InputAction m_Movement_PingScan;
private readonly InputAction m_Movement_VoiceButton;
private readonly InputAction m_Movement_Emote1;
private readonly InputAction m_Movement_Emote2;
private readonly InputAction m_Movement_BuildMode;
private readonly InputAction m_Movement_ConfirmBuildMode;
private readonly InputAction m_Movement_Delete;
public InputActionAsset asset { get; }
public InputBinding? bindingMask
{
get
{
return asset.bindingMask;
}
set
{
asset.bindingMask = value;
}
}
public ReadOnlyArray<InputDevice>? devices
{
get
{
return asset.devices;
}
set
{
asset.devices = value;
}
}
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
public IEnumerable<InputBinding> bindings => asset.bindings;
public MovementActions Movement => new MovementActions(this);
public PlayerActions()
{
asset = InputActionAsset.FromJson("{\n \"name\": \"PlayerActions\",\n \"maps\": [\n {\n \"name\": \"Movement\",\n \"id\": \"1560e87b-23aa-4005-bf8b-264f6a3c3736\",\n \"actions\": [\n {\n \"name\": \"Look\",\n \"type\": \"Value\",\n \"id\": \"c63a6ade-6c5a-4659-9aa5-e336e7b9970f\",\n \"expectedControlType\": \"Vector2\",\n \"processors\": \"AxisDeadzone(max=1)\",\n \"interactions\": \"\",\n \"initialStateCheck\": true\n },\n {\n \"name\": \"Move\",\n \"type\": \"Value\",\n \"id\": \"1af759ec-380d-4f9b-9108-c4e024e17c3e\",\n \"expectedControlType\": \"Vector2\",\n \"processors\": \"AxisDeadzone(min=0.3,max=1)\",\n \"interactions\": \"\",\n \"initialStateCheck\": true\n },\n {\n \"name\": \"Jump\",\n \"type\": \"Button\",\n \"id\": \"29820219-83ac-41cb-9f43-9ba2bcb7882c\",\n \"expectedControlType\": \"Button\",\n \"processors\": \"\",\n \"interactions\": \"\",\n \"initialStateCheck\": false\n },\n {\n \"name\": \"Sprint\",\n \"type\": \"Value\",\n \"id\": \"38a90280-ca06-4012-853a-06cd9bf6cda3\",\n \"expectedControlType\": \"Button\",\n \"processors\": \"\",\n \"interactions\": \"\",\n \"initialStateCheck\": true\n },\n {\n \"name\": \"OpenMenu\",\n \"type\": \"Button\",\n \"id\": \"61f99167-dec0-46cb-a700-a21e900ddbe6\",\n \"expectedControlType\": \"Button\",\n \"processors\": \"\",\n \"interactions\": \"\",\n \"initialStateCheck\": false\n },\n {\n \"name\": \"Interact\",\n \"type\": \"Value\",\n \"id\": \"7dc7e4c4-a4eb-449d-a885-cf7ad4b8faaa\",\n \"expectedControlType\": \"\",\n \"processors\": \"\",\n \"interactions\": \"\",\n \"initialStateCheck\": true\n },\n {\n \"name\": \"Crouch\",\n \"type\": \"Button\",\n \"id\": \"a5e81f24-9799-4b3e-b009-386c60e18cc1\",\n \"expectedControlType\": \"Button\",\n \"processors\": \"\",\n \"interactions\": \"\",\n \"initialStateCheck\": false\n },\n {\n \"name\": \"Use\",\n \"type\": \"Button\",\n \"id\": \"afa10779-50c6-45ee-828e-2c782fd48921\",\n \"expectedControlType\": \"Button\",\n \"processors\": \"\",\n \"interactions\": \"\",\n \"initialStateCheck\": true\n },\n {\n \"name\": \"ActivateItem\",\n \"type\": \"Button\",\n \"id\": \"990dbbff-3266-4890-8b7d-da5d76679e09\",\n \"expectedControlType\": \"Button\",\n \"processors\": \"\",\n \"interactions\": \"\",\n \"initialStateCheck\": true\n },\n {\n \"name\": \"Discard\",\n \"type\": \"Button\",\n \"id\": \"a4608dd4-03c1-4f59-94e2-84a333a9981b\",\n \"expectedControlType\": \"Button\",\n \"processors\": \"\",\n \"inte
m_Movement = asset.FindActionMap("Movement", throwIfNotFound: true);
m_Movement_Look = m_Movement.FindAction("Look", throwIfNotFound: true);
m_Movement_Move = m_Movement.FindAction("Move", throwIfNotFound: true);
m_Movement_Jump = m_Movement.FindAction("Jump", throwIfNotFound: true);
m_Movement_Sprint = m_Movement.FindAction("Sprint", throwIfNotFound: true);
m_Movement_OpenMenu = m_Movement.FindAction("OpenMenu", throwIfNotFound: true);
m_Movement_Interact = m_Movement.FindAction("Interact", throwIfNotFound: true);
m_Movement_Crouch = m_Movement.FindAction("Crouch", throwIfNotFound: true);
m_Movement_Use = m_Movement.FindAction("Use", throwIfNotFound: true);
m_Movement_ActivateItem = m_Movement.FindAction("ActivateItem", throwIfNotFound: true);
m_Movement_Discard = m_Movement.FindAction("Discard", throwIfNotFound: true);
m_Movement_SwitchItem = m_Movement.FindAction("SwitchItem", throwIfNotFound: true);
m_Movement_QEItemInteract = m_Movement.FindAction("QEItemInteract", throwIfNotFound: true);
m_Movement_EnableChat = m_Movement.FindAction("EnableChat", throwIfNotFound: true);
m_Movement_SubmitChat = m_Movement.FindAction("SubmitChat", throwIfNotFound: true);
m_Movement_ReloadBatteries = m_Movement.FindAction("ReloadBatteries", throwIfNotFound: true);
m_Movement_SetFreeCamera = m_Movement.FindAction("SetFreeCamera", throwIfNotFound: true);
m_Movement_InspectItem = m_Movement.FindAction("InspectItem", throwIfNotFound: true);
m_Movement_SpeedCheat = m_Movement.FindAction("SpeedCheat", throwIfNotFound: true);
m_Movement_PingScan = m_Movement.FindAction("PingScan", throwIfNotFound: true);
m_Movement_VoiceButton = m_Movement.FindAction("VoiceButton", throwIfNotFound: true);
m_Movement_Emote1 = m_Movement.FindAction("Emote1", throwIfNotFound: true);
m_Movement_Emote2 = m_Movement.FindAction("Emote2", throwIfNotFound: true);
m_Movement_BuildMode = m_Movement.FindAction("BuildMode", throwIfNotFound: true);
m_Movement_ConfirmBuildMode = m_Movement.FindAction("ConfirmBuildMode", throwIfNotFound: true);
m_Movement_Delete = m_Movement.FindAction("Delete", throwIfNotFound: true);
}
public void Dispose()
{
UnityEngine.Object.Destroy(asset);
}
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 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);
}
}