broken
This commit is contained in:
@@ -1,36 +1,29 @@
|
||||
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;
|
||||
readonly Config m_Config;
|
||||
|
||||
public InputService(Config config) {
|
||||
_config = config;
|
||||
m_Config = config;
|
||||
}
|
||||
|
||||
|
||||
public void Dispose() {
|
||||
}
|
||||
|
||||
public void EnableControls() {
|
||||
_config.InputAsset.Enable();
|
||||
m_Config.inputAsset.Enable();
|
||||
}
|
||||
|
||||
public void DisableControls() {
|
||||
_config.InputAsset.Disable();
|
||||
m_Config.inputAsset.Disable();
|
||||
}
|
||||
|
||||
public InputAction FindInputAction(string path) {
|
||||
return _config.InputAsset.FindAction(path);
|
||||
return m_Config.inputAsset.FindAction(path);
|
||||
}
|
||||
|
||||
public void LockCursor() {
|
||||
@@ -42,5 +35,10 @@ namespace RebootKit.Engine.Services.Input {
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class Config {
|
||||
public InputActionAsset inputAsset;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,12 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootKit.Engine.Services.Input {
|
||||
[CreateAssetMenu(menuName = RConsts.ServiceAssetMenu + "Input")]
|
||||
[CreateAssetMenu(menuName = RConsts.k_ServiceAssetMenu + "Input")]
|
||||
public class InputServiceAsset : ServiceAsset<InputService> {
|
||||
[SerializeField]
|
||||
private InputService.Config _config;
|
||||
[SerializeField] InputService.Config m_Config;
|
||||
|
||||
public override InputService Create(DIContext context) {
|
||||
InputService instance = new(_config);
|
||||
InputService instance = new(m_Config);
|
||||
context.Inject(instance);
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace RebootKit.Engine.Services.Input
|
||||
{
|
||||
[CreateAssetMenu(menuName = RConsts.AssetMenu + "Input Action", fileName = "Input Action")]
|
||||
public class ScriptableInputAction : ScriptableObject
|
||||
{
|
||||
namespace RebootKit.Engine.Services.Input {
|
||||
[CreateAssetMenu(menuName = RConsts.k_AddComponentMenu + "Input Action", fileName = "Input Action")]
|
||||
public class ScriptableInputAction : ScriptableObject {
|
||||
[field: SerializeField]
|
||||
public InputAction Action { get; private set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user