Started implementing SFX
Fixed Shield animation jumps and secondary attack Fixed demon wall stone behavior Made overworld ambient sounds unpausable
This commit is contained in:
@@ -46,17 +46,19 @@ public partial class InputMapper : PanelContainer
|
||||
private List<KeyboardRemapButton> _actionKeyMap = [];
|
||||
|
||||
private SimpleInjector.Container _container;
|
||||
private ISaveFileManager _saveFileManager;
|
||||
|
||||
[Signal] public delegate void SaveControllerInputEventHandler();
|
||||
|
||||
private bool _remappingKeyboard;
|
||||
private bool _remappingController;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
SetProcessInput(false);
|
||||
_container = new SimpleInjector.Container();
|
||||
_container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();
|
||||
_container.RegisterSingleton<IFileSystem, FileSystem>();
|
||||
_container.RegisterSingleton<ISaveFileManager, SaveFileManager>();
|
||||
_saveFileManager = _container.GetInstance<ISaveFileManager>();
|
||||
|
||||
MoveForwardController.Action = GameInputs.MoveUp;
|
||||
MoveForwardKeyboard.Action = GameInputs.MoveUp;
|
||||
@@ -79,6 +81,27 @@ public partial class InputMapper : PanelContainer
|
||||
SortController.Action = GameInputs.InventorySort;
|
||||
SortKeyboard.Action = GameInputs.InventorySort;
|
||||
|
||||
MoveForwardController.CancelRemap += CancelRemap;
|
||||
MoveForwardKeyboard.CancelRemap += CancelRemap;
|
||||
MoveLeftController.CancelRemap += CancelRemap;
|
||||
MoveLeftKeyboard.CancelRemap += CancelRemap;
|
||||
MoveRightController.CancelRemap += CancelRemap;
|
||||
MoveRightKeyboard.CancelRemap += CancelRemap;
|
||||
MoveBackwardController.CancelRemap += CancelRemap;
|
||||
MoveBackwardKeyboard.CancelRemap += CancelRemap;
|
||||
StrafeLeftController.CancelRemap += CancelRemap;
|
||||
StrafeLeftKeyboard.CancelRemap += CancelRemap;
|
||||
StrafeRightController.CancelRemap += CancelRemap;
|
||||
StrafeRightKeyboard.CancelRemap += CancelRemap;
|
||||
AttackController.CancelRemap += CancelRemap;
|
||||
AttackKeyboard.CancelRemap += CancelRemap;
|
||||
InteractController.CancelRemap += CancelRemap;
|
||||
InteractKeyboard.CancelRemap += CancelRemap;
|
||||
InventoryController.CancelRemap += CancelRemap;
|
||||
InventoryKeyboard.CancelRemap += CancelRemap;
|
||||
SortController.CancelRemap += CancelRemap;
|
||||
SortKeyboard.CancelRemap += CancelRemap;
|
||||
|
||||
_actionJoyMap.Add(MoveForwardController);
|
||||
_actionJoyMap.Add(MoveLeftController);
|
||||
_actionJoyMap.Add(MoveRightController);
|
||||
@@ -122,31 +145,62 @@ public partial class InputMapper : PanelContainer
|
||||
SortKeyboard.Remap += OnRemap;
|
||||
SortController.Remap += OnRemap;
|
||||
|
||||
VisibilityChanged += InputMapper_VisibilityChanged;
|
||||
|
||||
InputHelper.JoypadInputChanged += (string action, InputEvent input) =>
|
||||
{
|
||||
if (!_remappingController)
|
||||
return;
|
||||
|
||||
var buttonChanged = _actionJoyMap.SingleOrDefault(x => x.Action == action);
|
||||
if (buttonChanged != null)
|
||||
{
|
||||
buttonChanged.SetProcessInput(false);
|
||||
buttonChanged.Text = InputHelper.GetLabelForInput(input);
|
||||
_remappingController = false;
|
||||
}
|
||||
var allButtons = _actionKeyMap.Concat<InputMapButton>(_actionJoyMap);
|
||||
foreach (var button in allButtons)
|
||||
button.Disabled = false;
|
||||
};
|
||||
|
||||
|
||||
InputHelper.KeyboardInputChanged += (string action, InputEvent input) =>
|
||||
{
|
||||
if (!_remappingKeyboard)
|
||||
return;
|
||||
|
||||
var buttonChanged = _actionKeyMap.SingleOrDefault(x => x.Action == action);
|
||||
if (buttonChanged != null)
|
||||
{
|
||||
buttonChanged.SetProcessInput(false);
|
||||
buttonChanged.Text = InputHelper.GetLabelForInput(input);
|
||||
_remappingKeyboard = false;
|
||||
}
|
||||
var allButtons = _actionKeyMap.Concat<InputMapButton>(_actionJoyMap);
|
||||
foreach (var button in allButtons)
|
||||
button.Disabled = false;
|
||||
|
||||
if (!InputHelper.HasJoypad())
|
||||
foreach (var joyPadButton in _actionJoyMap)
|
||||
joyPadButton.Disabled = true;
|
||||
};
|
||||
|
||||
if (!InputHelper.HasJoypad())
|
||||
foreach (var joyPadButton in _actionJoyMap)
|
||||
joyPadButton.Disabled = true;
|
||||
}
|
||||
|
||||
private void CancelRemap()
|
||||
{
|
||||
var allButtons = _actionKeyMap.Concat<InputMapButton>(_actionJoyMap);
|
||||
foreach (var button in allButtons)
|
||||
button.Disabled = false;
|
||||
}
|
||||
|
||||
private void InputMapper_VisibilityChanged()
|
||||
{
|
||||
SetProcessInput(Visible);
|
||||
}
|
||||
|
||||
public void LoadControllerInput(string jsonData)
|
||||
@@ -181,6 +235,10 @@ public partial class InputMapper : PanelContainer
|
||||
|
||||
private void OnRemap(InputMapButton inputButton)
|
||||
{
|
||||
if (_actionJoyMap.Contains(inputButton))
|
||||
_remappingController = true;
|
||||
if (_actionKeyMap.Contains(inputButton))
|
||||
_remappingKeyboard = true;
|
||||
inputButton.Text = "...";
|
||||
inputButton.SetProcessInput(true);
|
||||
var allButtons = _actionKeyMap.Concat<InputMapButton>(_actionJoyMap);
|
||||
|
||||
Reference in New Issue
Block a user