This commit is contained in:
2026-07-09 21:33:33 +02:00
commit 84a2a365f3
2364 changed files with 950134 additions and 0 deletions
@@ -0,0 +1,96 @@
using UnityEngine;
using UnityEngine.InputSystem;
namespace VOID.Generic.Player.Input
{
[DefaultExecutionOrder(1)]
public class CameraInputManager : MonoBehaviour
{
public static CameraInputManager current {get; private set;}
private Inputs _inputs;
// Input actions for camera controlling
public InputAction movement {get; private set;}
public InputAction movementFaster {get; private set;}
public InputAction rotatingAndTiltingStart {get; private set;}
public InputAction rotatingAndTilting {get; private set;}
public InputAction zooming {get; private set;}
// States
public bool isMoving {get; private set;}
public bool isMovingFaster {get; private set;}
public bool isRotatingAndTilting {get; private set;}
public bool isZooming {get; private set;}
// Deltas
public Vector2 movementDelta { get; private set; }
public Vector2 rotateAndTiltDelta { get; private set; }
public float zoomDelta { get; private set; }
private void Awake()
{
current = this;
_inputs = new Inputs();
// CameraMovement
movement = _inputs.CameraControls.Movement;
movement.started += _ => isMoving = true;
movement.performed += _ => OnCameraMovement();
movement.canceled += _ => isMoving = false;
// CameraMovementFaster
movementFaster = _inputs.CameraControls.MovementFaster;
movementFaster.started += _ => isMovingFaster = true;
movementFaster.canceled += _ => isMovingFaster = false;
// CameraRotatingAndTiltingStart
rotatingAndTiltingStart = _inputs.CameraControls.RotatingAndTiltingStart;
rotatingAndTiltingStart.started += _ => isRotatingAndTilting = true;
rotatingAndTiltingStart.canceled += _ => isRotatingAndTilting = false;
// CameraRotatingAndTilting
rotatingAndTilting = _inputs.CameraControls.RotatingAndTilting;
rotatingAndTilting.performed += _ => OnCameraRotateAndTilt();
// CameraZooming
zooming = _inputs.CameraControls.Zooming;
zooming.performed += _ => OnCameraZoom();
zooming.performed += _ => isZooming = true;
}
private void OnEnable()
{
movement.Enable();
movementFaster.Enable();
rotatingAndTiltingStart.Enable();
rotatingAndTilting.Enable();
zooming.Enable();
}
private void OnDisable()
{
movement.Disable();
movementFaster.Disable();
rotatingAndTiltingStart.Disable();
rotatingAndTilting.Disable();
zooming.Disable();
}
private void FixedUpdate()
{
// Reset delta after all ->FixedUpdate()
isZooming = false;
if (!isMoving) movementDelta = Vector2.zero;
rotateAndTiltDelta = Vector2.zero;
zoomDelta = 0f;
}
private void OnCameraMovement() => movementDelta = movement.ReadValue<Vector2>();
private void OnCameraRotateAndTilt() => rotateAndTiltDelta += rotatingAndTilting.ReadValue<Vector2>();
private void OnCameraZoom() => zoomDelta += zooming.ReadValue<Vector2>().y;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 63e6969e576443818d870e9cc367f015
timeCreated: 1687555087
@@ -0,0 +1,44 @@
using UnityEngine;
using UnityEngine.InputSystem;
namespace VOID.Generic.Player.Input
{
[DefaultExecutionOrder(1)]
public class CastingInputManager : MonoBehaviour
{
public static CastingInputManager current {get; private set;}
private Inputs _inputs;
// Input actions for player controlling
public InputAction confirm {get; private set;}
public InputAction cancel {get; private set;}
private void Awake()
{
current = this;
_inputs = new Inputs();
// PlayerDefaultUse
confirm = _inputs.CastingControls.Confirm;
cancel = _inputs.CastingControls.Cancel;
}
private void Start()
{
enabled = false;
}
private void OnEnable()
{
confirm.Enable();
cancel.Enable();
}
private void OnDisable()
{
confirm.Disable();
cancel.Disable();
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1386fc5960bb4b0ebdc9d5ac0de3cdfb
timeCreated: 1687556100
@@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Interactions;
using UnityEngine.UIElements;
using VOID.UserInterface;
namespace VOID.Generic.Player.Input
{
[DefaultExecutionOrder(1)]
public class PlayerInputManager : MonoBehaviour
{
public static PlayerInputManager current { get; private set; }
private Inputs _inputs;
// Input actions for player controlling
private InputAction _defaultUse;
private InputAction _contextUse;
private InputAction _defaultUseOnUI;
private InputAction _forceAttack;
private InputAction _forceMove;
private InputAction _dragging;
private InputAction _highlight;
// Events
public event Action OnDefaultUse;
public event Action OnContextUse;
public event Action<Vector2, List<VisualElement>> OnDefaultUseUI;
public event Action<Vector2, List<VisualElement>> OnDefaultAlternateUseUI;
public event Action OnForceAttackStart;
public event Action OnForceAttackEnd;
public event Action OnForceMoveStart;
public event Action OnForceMoveEnd;
public event Action OnDraggingPrepare;
public event Action OnDraggingStart;
public event Action OnDraggingEnd;
public event Action OnHighlightStart;
public event Action OnHighlightEnd;
// States
public bool isForceAttack { get; private set; }
public bool isForceMove { get; private set; }
public bool isDragging { get; private set; }
public bool isHighlight { get; private set; }
// Cache - position and VisualElement when clicking on UI started
private Vector2 _cursorPositionOnUI;
private List<VisualElement> _elementsUnderCursor;
private void Awake()
{
current = this;
_inputs = new Inputs();
// Default on SCENE
_defaultUse = _inputs.PlayerControls.DefaultUse;
_defaultUse.performed += _ => OnDefaultUse?.Invoke();
// Context on SCENE
_contextUse = _inputs.PlayerControls.ContextUse;
_contextUse.performed += _ => OnContextUse?.Invoke();
// Default on UI (or alternate default)
_defaultUseOnUI = _inputs.PlayerControls.DefaultUseOnUI;
_defaultUseOnUI.started += callback =>
{
if (callback.interaction is not MultiTapInteraction) return;
_cursorPositionOnUI = default;
_elementsUnderCursor = default;
if (GameUI.current.isCursorOverUI == false) return;
_cursorPositionOnUI = GameUI.current.cursorPositionOnUI;
_elementsUnderCursor = GameUI.current.elementsUnderCursor.ToList();
};
_defaultUseOnUI.performed += callback =>
{
if (_cursorPositionOnUI == default) return;
if (callback.interaction is MultiTapInteraction) OnDefaultUseUI?.Invoke(_cursorPositionOnUI, _elementsUnderCursor);
else OnDefaultAlternateUseUI?.Invoke(_cursorPositionOnUI, _elementsUnderCursor);
};
// PlayerForceAttack
_forceAttack = _inputs.PlayerControls.ForceAttack;
_forceAttack.started += _ => isForceAttack = true;
_forceAttack.started += _ => OnForceAttackStart?.Invoke();
_forceAttack.canceled += _ => isForceAttack = false;
_forceAttack.canceled += _ => OnForceAttackEnd?.Invoke();
// PlayerForceMove
_forceMove = _inputs.PlayerControls.ForceMove;
_forceMove.started += _ => isForceMove = true;
_forceMove.started += _ => OnForceMoveStart?.Invoke();
_forceMove.canceled += _ => isForceMove = false;
_forceMove.canceled += _ => OnForceMoveEnd?.Invoke();
// PlayerDragging
_dragging = _inputs.PlayerControls.Dragging;
_dragging.started += _ => isDragging = true;
_dragging.started += _ => OnDraggingPrepare?.Invoke();
_dragging.performed += _ => OnDraggingStart?.Invoke();
_dragging.canceled += _ => isDragging = false;
_dragging.canceled += _ => OnDraggingEnd?.Invoke();
// Highlight
_highlight = _inputs.PlayerControls.Highlight;
_highlight.started += _ => isHighlight = true;
_highlight.started += _ => OnHighlightStart?.Invoke();
_highlight.canceled += _ => isHighlight = false;
_highlight.canceled += _ => OnHighlightEnd?.Invoke();
}
private void OnEnable()
{
_defaultUse.Enable();
_defaultUseOnUI.Enable();
_contextUse.Enable();
_forceAttack.Enable();
_forceMove.Enable();
_dragging.Enable();
_highlight.Enable();
}
private void OnDisable()
{
_defaultUse.Disable();
_defaultUseOnUI.Disable();
_contextUse.Disable();
_forceAttack.Disable();
_forceMove.Disable();
_dragging.Disable();
_highlight.Disable();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3950a7fded2c3564ca37845076f8c112
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,161 @@
using UnityEngine;
using UnityEngine.InputSystem;
namespace VOID.Generic.Player.Input
{
[DefaultExecutionOrder(1)]
public class ShortcutsInputManager : MonoBehaviour
{
public static ShortcutsInputManager current {get; private set;}
private Inputs _inputs;
public InputAction menu {get; private set;}
public InputAction inventory {get; private set;}
public InputAction equipment {get; private set;}
public InputAction abilityBook {get; private set;}
public InputAction logBook {get; private set;}
public InputAction map {get; private set;}
public InputAction actionBarNext {get; private set;}
public InputAction actionBarPrevious {get; private set;}
public InputAction actionBarSlot1 {get; private set;}
public InputAction actionBarSlot2 {get; private set;}
public InputAction actionBarSlot3 {get; private set;}
public InputAction actionBarSlot4 {get; private set;}
public InputAction actionBarSlot5 {get; private set;}
public InputAction actionBarSlot6 {get; private set;}
public InputAction actionBarSlot7 {get; private set;}
public InputAction actionBarSlot8 {get; private set;}
public InputAction actionBarSlot9 {get; private set;}
public InputAction actionBarSlot10 {get; private set;}
public InputAction actionBarSlot11 {get; private set;}
public InputAction actionBarSlot12 {get; private set;}
public InputAction actionBarSlot13 {get; private set;}
public InputAction actionBarSlot14 {get; private set;}
public InputAction actionBarSlot15 {get; private set;}
public InputAction actionBarSlot16 {get; private set;}
public InputAction actionBarSlot17 {get; private set;}
public InputAction actionBarSlot18 {get; private set;}
public InputAction actionBarSlot19 {get; private set;}
public InputAction actionBarSlot20 {get; private set;}
public InputAction actionBarSlot21 {get; private set;}
public InputAction actionBarSlot22 {get; private set;}
public InputAction actionBarSlot23 {get; private set;}
public InputAction actionBarSlot24 {get; private set;}
public InputAction actionBarSlot25 {get; private set;}
private void Awake()
{
current = this;
_inputs = new Inputs();
menu = _inputs.ShortcutsControls.Menu;
inventory = _inputs.ShortcutsControls.Inventory;
equipment = _inputs.ShortcutsControls.Equipment;
abilityBook = _inputs.ShortcutsControls.AbilityBook;
logBook = _inputs.ShortcutsControls.LogBook;
map = _inputs.ShortcutsControls.Map;
actionBarNext = _inputs.ShortcutsControls.ActionBarNext;
actionBarPrevious = _inputs.ShortcutsControls.ActionBarPrevious;
actionBarSlot1 = _inputs.ShortcutsControls.ActionBarSlot1;
actionBarSlot2 = _inputs.ShortcutsControls.ActionBarSlot2;
actionBarSlot3 = _inputs.ShortcutsControls.ActionBarSlot3;
actionBarSlot4 = _inputs.ShortcutsControls.ActionBarSlot4;
actionBarSlot5 = _inputs.ShortcutsControls.ActionBarSlot5;
actionBarSlot6 = _inputs.ShortcutsControls.ActionBarSlot6;
actionBarSlot7 = _inputs.ShortcutsControls.ActionBarSlot7;
actionBarSlot8 = _inputs.ShortcutsControls.ActionBarSlot8;
actionBarSlot9 = _inputs.ShortcutsControls.ActionBarSlot9;
actionBarSlot10 = _inputs.ShortcutsControls.ActionBarSlot10;
actionBarSlot11 = _inputs.ShortcutsControls.ActionBarSlot11;
actionBarSlot12 = _inputs.ShortcutsControls.ActionBarSlot12;
actionBarSlot13 = _inputs.ShortcutsControls.ActionBarSlot13;
actionBarSlot14 = _inputs.ShortcutsControls.ActionBarSlot14;
actionBarSlot15 = _inputs.ShortcutsControls.ActionBarSlot15;
actionBarSlot16 = _inputs.ShortcutsControls.ActionBarSlot16;
actionBarSlot17 = _inputs.ShortcutsControls.ActionBarSlot17;
actionBarSlot18 = _inputs.ShortcutsControls.ActionBarSlot18;
actionBarSlot19 = _inputs.ShortcutsControls.ActionBarSlot19;
actionBarSlot20 = _inputs.ShortcutsControls.ActionBarSlot20;
actionBarSlot21 = _inputs.ShortcutsControls.ActionBarSlot21;
actionBarSlot22 = _inputs.ShortcutsControls.ActionBarSlot22;
actionBarSlot23 = _inputs.ShortcutsControls.ActionBarSlot23;
actionBarSlot24 = _inputs.ShortcutsControls.ActionBarSlot24;
actionBarSlot25 = _inputs.ShortcutsControls.ActionBarSlot25;
}
private void OnEnable()
{
menu.Enable();
inventory.Enable();
equipment.Enable();
abilityBook.Enable();
logBook.Enable();
map.Enable();
actionBarNext.Enable();
actionBarPrevious.Enable();
actionBarSlot1.Enable();
actionBarSlot2.Enable();
actionBarSlot3.Enable();
actionBarSlot4.Enable();
actionBarSlot5.Enable();
actionBarSlot6.Enable();
actionBarSlot7.Enable();
actionBarSlot8.Enable();
actionBarSlot9.Enable();
actionBarSlot10.Enable();
actionBarSlot11.Enable();
actionBarSlot12.Enable();
actionBarSlot13.Enable();
actionBarSlot14.Enable();
actionBarSlot15.Enable();
actionBarSlot16.Enable();
actionBarSlot17.Enable();
actionBarSlot18.Enable();
actionBarSlot19.Enable();
actionBarSlot20.Enable();
actionBarSlot21.Enable();
actionBarSlot22.Enable();
actionBarSlot23.Enable();
actionBarSlot24.Enable();
actionBarSlot25.Enable();
}
private void OnDisable()
{
menu.Disable();
inventory.Disable();
equipment.Disable();
abilityBook.Disable();
logBook.Disable();
map.Disable();
actionBarNext.Disable();
actionBarPrevious.Disable();
actionBarSlot1.Disable();
actionBarSlot2.Disable();
actionBarSlot3.Disable();
actionBarSlot4.Disable();
actionBarSlot5.Disable();
actionBarSlot6.Disable();
actionBarSlot7.Disable();
actionBarSlot8.Disable();
actionBarSlot9.Disable();
actionBarSlot10.Disable();
actionBarSlot11.Disable();
actionBarSlot12.Disable();
actionBarSlot13.Disable();
actionBarSlot14.Disable();
actionBarSlot15.Disable();
actionBarSlot16.Disable();
actionBarSlot17.Disable();
actionBarSlot18.Disable();
actionBarSlot19.Disable();
actionBarSlot20.Disable();
actionBarSlot21.Disable();
actionBarSlot22.Disable();
actionBarSlot23.Disable();
actionBarSlot24.Disable();
actionBarSlot25.Disable();
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 881ccd9f9ac640ffaeb8aea0c2681d12
timeCreated: 1672335764