This commit is contained in:
2025-03-14 19:53:29 +01:00
commit 0d3516774e
159 changed files with 9069 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
using System;
using System.Threading;
using Cysharp.Threading.Tasks;
using RebootKit.Engine.Foundation;
using UnityEngine;
using UnityEngine.InputSystem;
namespace RebootKit.Engine.Services.Input {
public class InputService : IService {
[Serializable]
public class Config {
public InputActionAsset InputAsset;
}
private Config _config;
public InputService(Config config) {
_config = config;
}
public void Dispose() {
}
public async UniTask OnInit(CancellationToken cancellationToken) {
await UniTask.Yield(cancellationToken);
}
public void EnableControls() {
_config.InputAsset.Enable();
}
public void DisableControls() {
_config.InputAsset.Disable();
}
public InputAction FindInputAction(string path) {
return _config.InputAsset.FindAction(path);
}
public void LockCursor() {
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
public void UnlockCursor() {
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a6ee7382dba74afe84aaf53259b1cf8a
timeCreated: 1740769896

View File

@@ -0,0 +1,14 @@
using RebootKit.Engine.Foundation;
using UnityEngine;
namespace RebootKit.Engine.Services.Input {
[CreateAssetMenu(menuName = RConsts.ServiceAssetMenu + "Input")]
public class InputServiceAsset : ServiceAsset<InputService> {
[SerializeField]
private InputService.Config _config;
public override InputService Create() {
return new InputService(_config);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8fcf71fe79ef1ed4cbfdefde09e708d9

View File

@@ -0,0 +1,12 @@
using UnityEngine;
using UnityEngine.InputSystem;
namespace RebootKit.Engine.Services.Input
{
[CreateAssetMenu(menuName = RConsts.AssetMenu + "Input Action", fileName = "Input Action")]
public class ScriptableInputAction : ScriptableObject
{
[field: SerializeField]
public InputAction Action { get; private set; }
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e8d574cf0e024ec7bc4363a675dbb2c9
timeCreated: 1740768148