public void updateInventory(object sender, InventoryEventArgs e)
{
Item item = e.type;
int quantity = e.quantity;
if (Hero.instance.inventory.numItem(item) == 0) // no more items of this type
{
this.entries.Remove(allEntries[(int)item]);
this.loadEntries(); // !! this automatically resizes the list of entries on the panel
}
else if (Hero.instance.inventory.numItem(item) == quantity)
{
ItemEntry itemEntry = allEntries[(int)item];
this.loadEntries(itemEntry);
}
}