(client) feat:实现掉落物,UI显示,维度
This commit is contained in:
@ -142,6 +142,25 @@ namespace Entity
|
||||
{
|
||||
return _slots.AsReadOnly();
|
||||
}
|
||||
public InventorySlot GetSlot(Item.ItemResource itemResource)
|
||||
{
|
||||
if (itemResource == null) return null;
|
||||
|
||||
foreach (var slot in _slots)
|
||||
{
|
||||
if (slot.Item != null && slot.Item.DefName == itemResource.DefName)
|
||||
{
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public InventorySlot GetSlot(int i)
|
||||
{
|
||||
i = Mathf.Clamp(i, 0, Capacity - 1);
|
||||
return _slots[i];
|
||||
}
|
||||
|
||||
public int OccupiedSlotsCount => _slots.Count;
|
||||
public int AvailableSlotsCount => Capacity - _slots.Count;
|
||||
|
Reference in New Issue
Block a user