Change affinity

This commit is contained in:
2025-01-19 12:59:24 -08:00
parent f3a51de28a
commit 4910ff7770
20 changed files with 272 additions and 89 deletions

View File

@@ -383,12 +383,8 @@ public partial class InventoryMenu : Control, IInventoryMenu
GameRepo.PlayerData.Inventory.Equip(equipableItem);
itemSlot.SetEquippedSelectedItemStyle();
}
SetProcessInput(false);
await HideUserActionPrompt();
await ShowInventoryInfo();
await ToSignal(GetTree().CreateTimer(1f), "timeout");
await RedrawInventory();
SetProcessInput(true);
RefreshUIAfterUserSelection();
}
}
@@ -398,14 +394,21 @@ public partial class InventoryMenu : Control, IInventoryMenu
if (currentItem is IEquipableItem)
await EquipOrUnequipItem();
else if (currentItem is IUsableItem usableItem)
{
usableItem.Use();
GameRepo.PlayerData.Inventory.Remove(usableItem);
if (_currentIndex >= ItemSlots.Length - 1)
_currentIndex--;
if (_currentIndex <= 0)
_currentIndex = 0;
}
if (currentItem is ConsumableItem consumableItem)
DestroyItem(consumableItem);
RefreshUIAfterUserSelection();
}
private async void DestroyItem(IUsableItem usableItem)
{
GameRepo.PlayerData.Inventory.Remove(usableItem);
if (_currentIndex >= ItemSlots.Length - 1)
_currentIndex--;
if (_currentIndex <= 0)
_currentIndex = 0;
}
private async void ThrowButtonPressed()
@@ -437,6 +440,16 @@ public partial class InventoryMenu : Control, IInventoryMenu
EmitSignal(SignalName.ClosedMenu);
}
private async void RefreshUIAfterUserSelection()
{
SetProcessInput(false);
await HideUserActionPrompt();
await ShowInventoryInfo();
await RedrawInventory();
await ToSignal(GetTree().CreateTimer(1f), "timeout");
SetProcessInput(true);
}
private enum InventoryPageNumber
{
FirstPage,