Added item stacking

This commit is contained in:
cblech
2025-04-17 16:10:12 +02:00
parent fb362e10ad
commit fb0c14c3f1
7 changed files with 119 additions and 32 deletions
+10 -2
View File
@@ -43,6 +43,12 @@ public partial class InventoryUi : Control
uiSlot!.nameLabel.Text = inventorySlot.itemInstance?.blueprint.name ?? "";
uiSlot!.nameLabel.LabelSettings = uiSlot!.nameLabel.LabelSettings.Duplicate() as LabelSettings;
uiSlot!.nameLabel.LabelSettings!.FontColor = inventorySlot.itemInstance?.blueprint.color ?? Colors.White;
var amountText = inventorySlot.itemInstance != null &&
inventorySlot.itemInstance.amount != 1
? inventorySlot.itemInstance.amount.ToString()
: "";
uiSlot!.amountLabel.Text = amountText;
}
}
@@ -99,6 +105,7 @@ public partial class InventoryUi : Control
{
InputInventoryOpenClose();
}
if (Input.IsActionJustPressed("ui_inventory_disadvance"))
{
_selectedSlot++;
@@ -106,7 +113,8 @@ public partial class InventoryUi : Control
_selectedSlot = 0;
SetSlotSelectPosition();
}
if(Input.IsActionJustPressed("ui_inventory_advance"))
if (Input.IsActionJustPressed("ui_inventory_advance"))
{
_selectedSlot--;
if (_selectedSlot < 0)
@@ -143,4 +151,4 @@ public partial class InventoryUi : Control
_slotOnMouse = null;
}
}
}
}