36 lines
720 B
C#
36 lines
720 B
C#
using System;
|
|
using OTGIntegrated.Items;
|
|
|
|
namespace OTGIntegrated.Inventory
|
|
{
|
|
[Serializable]
|
|
public sealed class InventorySlot
|
|
{
|
|
public ItemData item;
|
|
public int amount;
|
|
|
|
public InventorySlot(ItemData item, int amount)
|
|
{
|
|
this.item = item;
|
|
this.amount = amount;
|
|
}
|
|
|
|
public bool IsEmpty()
|
|
{
|
|
return item == null || amount <= 0;
|
|
}
|
|
|
|
public string GetDisplayText()
|
|
{
|
|
return IsEmpty() ? string.Empty : $"{item.displayName} x{amount}";
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class InventorySlotSaveData
|
|
{
|
|
public string itemId;
|
|
public int amount;
|
|
}
|
|
}
|