Button remapping work

This commit is contained in:
2025-11-03 02:48:05 -08:00
parent 9fc875eda5
commit 7b7fc910bd
40 changed files with 2390 additions and 84 deletions

View File

@@ -124,7 +124,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
public override void _Input(InputEvent @event)
{
if (Visible && @event.IsActionPressed(GameInputs.UiCancel))
if (Visible && @event.IsActionPressed(GameInputs.Inventory))
{
if (UseButton.HasFocus() || DropButton.HasFocus() || ThrowButton.HasFocus())
{
@@ -134,6 +134,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
}
else
{
AcceptEvent();
Autoload.AudioManager.Play(SoundEffect.Cancel);
_gameRepo.CloseInventory();
}
@@ -142,17 +143,17 @@ public partial class InventoryMenu : Control, IInventoryMenu
if (ItemSlots.Length == 0 || UseButton.HasFocus() || DropButton.HasFocus() || ThrowButton.HasFocus())
return;
if (@event.IsActionPressed(GameInputs.UiRight) && _currentPageNumber == InventoryPageNumber.FirstPage)
if (@event.IsActionPressed(GameInputs.MoveRight) && _currentPageNumber == InventoryPageNumber.FirstPage)
{
var inventory = Player.Inventory;
if (inventory.Items.Count > _itemsPerPage)
ChangeInventoryPage(InventoryPageNumber.SecondPage);
}
if (@event.IsActionPressed(GameInputs.UiLeft) && _currentPageNumber == InventoryPageNumber.SecondPage)
if (@event.IsActionPressed(GameInputs.MoveLeft) && _currentPageNumber == InventoryPageNumber.SecondPage)
ChangeInventoryPage(InventoryPageNumber.FirstPage);
if (@event.IsActionPressed(GameInputs.UiDown))
if (@event.IsActionPressed(GameInputs.MoveDown))
{
var oldIndex = _currentIndex;
var newIndex = new[] { _currentIndex + 1, _itemsPerPage - 1, ItemSlots.Length - 1 }.Min();
@@ -165,7 +166,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
_currentIndex = newIndex;
}
if (@event.IsActionPressed(GameInputs.UiUp))
if (@event.IsActionPressed(GameInputs.MoveUp))
{
var oldIndex = _currentIndex;
var newIndex = new[] { _currentIndex - 1, 0 }.Max();
@@ -179,7 +180,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
_currentIndex = newIndex;
}
if (@event.IsActionPressed(GameInputs.UiAccept))
if (@event.IsActionPressed(GameInputs.Attack))
{
DisplayUserActionPrompt();
Autoload.AudioManager.Play(SoundEffect.Select);