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);

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=29 format=3 uid="uid://dlj8qdg1c5048"]
[gd_scene load_steps=30 format=3 uid="uid://dlj8qdg1c5048"]
[ext_resource type="Script" uid="uid://cmtet15hi5oiy" path="res://src/ui/inventory_menu/InventoryMenu.cs" id="1_l64wl"]
[ext_resource type="Shader" uid="uid://cnphwvmr05hp1" path="res://src/ui/inventory_menu/InventoryMenu.gdshader" id="2_0fvsh"]
@@ -8,6 +8,7 @@
[ext_resource type="LabelSettings" uid="uid://ca1q6yu8blwxf" path="res://src/ui/label_settings/InventoryMainTextBold.tres" id="6_tmdno"]
[ext_resource type="LabelSettings" uid="uid://cuuo43x72xcsc" path="res://src/ui/label_settings/MainTextBold.tres" id="7_vyrxm"]
[ext_resource type="Theme" uid="uid://daxuhpmyxwxck" path="res://src/ui/inventory_menu/InventoryDialogueSelectionStyle.tres" id="8_khyvo"]
[ext_resource type="Shortcut" uid="uid://dumkrjur22k2a" path="res://src/ui/ButtonShortcut.tres" id="9_b6rkr"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_i55tv"]
shader = ExtResource("2_0fvsh")
@@ -381,6 +382,7 @@ theme_override_styles/disabled = SubResource("StyleBoxEmpty_fu7o2")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_nkvce")
theme_override_styles/normal = SubResource("StyleBoxEmpty_545ij")
button_mask = 0
shortcut = ExtResource("9_b6rkr")
text = "Use"
alignment = 0
@@ -405,6 +407,7 @@ theme_override_styles/disabled = SubResource("StyleBoxEmpty_ascpt")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_abpb1")
theme_override_styles/normal = SubResource("StyleBoxEmpty_545ij")
button_mask = 0
shortcut = ExtResource("9_b6rkr")
text = "Throw"
alignment = 0
@@ -429,6 +432,7 @@ theme_override_styles/disabled = SubResource("StyleBoxEmpty_uerb4")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_lvcf8")
theme_override_styles/normal = SubResource("StyleBoxEmpty_ct6ql")
button_mask = 0
shortcut = ExtResource("9_b6rkr")
text = "Drop"
alignment = 0