Added item stacking
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user