Change affinity
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user