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:
@@ -1,4 +1,5 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
using Godot;
|
||||
using NathanHoad;
|
||||
using System;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class JoypadRemapButton : InputMapButton
|
||||
{
|
||||
public event Action CancelRemap;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
SetProcessInput(false);
|
||||
@@ -17,6 +20,9 @@ public partial class JoypadRemapButton : InputMapButton
|
||||
if (InputHelper.GetJoypadInputForAction(GameInputs.Pause).IsMatch(@event))
|
||||
{
|
||||
InputHelper.SetJoypadInputForAction(Action, InputEvent);
|
||||
InputHelper.SetKeyboardInputForAction(Action, InputEvent);
|
||||
Text = InputHelper.GetLabelForInput(InputEvent);
|
||||
CancelRemap?.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
using Godot;
|
||||
using NathanHoad;
|
||||
using System;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class KeyboardRemapButton : InputMapButton
|
||||
{
|
||||
public event Action CancelRemap;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
SetProcessInput(false);
|
||||
@@ -18,6 +21,8 @@ public partial class KeyboardRemapButton : InputMapButton
|
||||
if (InputHelper.GetKeyboardInputForAction(GameInputs.Pause).IsMatch(@event))
|
||||
{
|
||||
InputHelper.SetKeyboardInputForAction(Action, InputEvent);
|
||||
Text = InputHelper.GetLabelForInput(InputEvent);
|
||||
CancelRemap?.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -125,7 +125,7 @@ public partial class OptionsMenu : Control
|
||||
if (!Visible)
|
||||
return;
|
||||
|
||||
if (Input.IsActionJustPressed(GameInputs.Interact))
|
||||
if (Input.IsActionJustPressed(GameInputs.Interact) || Input.IsActionJustPressed(GameInputs.Pause))
|
||||
{
|
||||
AcceptEvent();
|
||||
SaveAndExitMenu();
|
||||
|
||||
@@ -47,7 +47,9 @@ layout_mode = 2
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(1280, 960)
|
||||
layout_mode = 2
|
||||
mouse_filter = 0
|
||||
current_tab = 0
|
||||
tab_focus_mode = 0
|
||||
|
||||
[node name="Game" type="PanelContainer" parent="CanvasLayer/CenterContainer/VBoxContainer/TabContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
Reference in New Issue
Block a user