(Feat) Add Build
This commit is contained in:
@@ -226,7 +226,7 @@ namespace Ashwild.Inventory
|
||||
}
|
||||
}
|
||||
|
||||
InventoryUI.OnSwapRequested(currentSlotIndex, targetSlot);
|
||||
inv.MoveSlot(currentSlotIndex, targetSlot);
|
||||
}
|
||||
|
||||
private void OnMoveToInventory()
|
||||
@@ -238,7 +238,7 @@ namespace Ashwild.Inventory
|
||||
{
|
||||
if (inv.GetSlot(i).IsEmpty)
|
||||
{
|
||||
InventoryUI.OnSwapRequested(currentSlotIndex, i);
|
||||
inv.MoveSlot(currentSlotIndex, i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -249,7 +249,7 @@ namespace Ashwild.Inventory
|
||||
InventorySlot slot = inv.GetSlot(i);
|
||||
if (!slot.IsEmpty && slot.ItemData == sourceSlot.ItemData && slot.CanAccept(sourceSlot.ItemData))
|
||||
{
|
||||
InventoryUI.OnSwapRequested(currentSlotIndex, i);
|
||||
inv.MoveSlot(currentSlotIndex, i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -273,24 +273,7 @@ namespace Ashwild.Inventory
|
||||
private void OnSplit()
|
||||
{
|
||||
if (currentSlotIndex < 0) return;
|
||||
PlayerInventory inv = PlayerInventory.Instance;
|
||||
InventorySlot slot = inv.GetSlot(currentSlotIndex);
|
||||
if (slot.IsEmpty || slot.Quantity <= 1) return;
|
||||
|
||||
int halfQty = slot.Quantity / 2;
|
||||
int remaining = slot.Quantity - halfQty;
|
||||
|
||||
for (int i = 0; i < inv.InventorySize; i++)
|
||||
{
|
||||
if (inv.GetSlot(i).IsEmpty)
|
||||
{
|
||||
slot.Set(slot.ItemData, remaining);
|
||||
inv.GetSlot(i).Set(slot.ItemData, halfQty);
|
||||
inv.onSlotChanged?.Invoke(currentSlotIndex);
|
||||
inv.onSlotChanged?.Invoke(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
PlayerInventory.Instance.SplitSlot(currentSlotIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user