protected override void TakeAllItems()
{
var clientItemCollection = m_Inventory.GetItemCollection(m_AddToItemCollectionName);
var equippableClientItemCollection = m_Inventory.GetItemCollection("Equippable Slots");
if (clientItemCollection == null)
{
clientItemCollection = m_Inventory.MainItemCollection;
}
// Get all the item infos in the item collection, requires an array.
var pooledArray = GenericObjectPool.Get<Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo[]>();
var allItemInfos = m_Chest.Inventory.MainItemCollection.GetAllItemInfos(ref pooledArray);
for (int i = 0; i < allItemInfos.Count; i++)
{
var itemInfo = allItemInfos[i];
var item = itemInfo.Item;
// Do nothing if the item is null ( it shouldn't be null )
if (item == null) { continue; }
if (characterInventoryBridge.EquippableCategory.InherentlyContains(item))
m_Chest.Inventory.MainItemCollection.GiveItem(itemInfo, equippableClientItemCollection, null);
else
m_Chest.Inventory.MainItemCollection.GiveItem(itemInfo, clientItemCollection, null);
}
// IMPORTANT: make sure to return the pooled array once you finished using it.
GenericObjectPool.Return(pooledArray);
//m_Chest.Inventory.MainItemCollection.GiveAllItems(
// clientItemCollection, null);
m_DisplayPanel.Close();
}