/// <summary>
/// Internal method which returns the amount of the specified ItemIdentifier.
/// </summary>
/// <param name="itemIdentifier">The ItemIdentifier to get the amount of.</param>
/// <returns>The amount of the specified ItemIdentifier.</returns>
protected override int GetItemIdentifierAmountInternal(IItemIdentifier itemIdentifier)
{
if (itemIdentifier is ItemType) {
//Debug.LogError($"Error: The ItemIdentifier {itemIdentifier} is an ItemType. The identifier must be created by the Ultimate Inventory System.");
//return 0;
var itemDefinition = itemIdentifier.GetItemDefinition();
var itemInfo = m_Inventory.GetItemInfo(itemDefinition as ItemDefinition);
if (itemInfo.HasValue == false) { return 0; }
itemIdentifier = itemInfo.Value.Item;
}
#if UNITY_EDITOR
if (!m_InventorySytemManager.Database.Contains(itemIdentifier as Opsive.UltimateInventorySystem.Core.Item)) {
Debug.LogError($"Error: The Item ({itemIdentifier}) does not exist within the active database ({m_InventorySytemManager.Database.name}).");
return 0;
}
#endif
var item = itemIdentifier as Opsive.UltimateInventorySystem.Core.Item;
if (item?.ItemCollection == null) {
return m_DefaultItemCollection.GetItemAmount(item);
}
return item.ItemCollection.GetItemAmount(item);
}