public override void Awake() { equipSlotFields = container.GetComponentsInChildren <InventoryEquippableField>(true); characterStats = new Dictionary <string, List <InventoryEquipStatRowLookup> >(ItemManager.instance.equipStats.Length); base.Awake(); if (statusRowPrefab != null) { rowsPool = new InventoryPool <InventoryEquipStatRowUI>(statusRowPrefab, 64); } if (statusCategoryPrefab != null) { categoryPool = new InventoryPool <InventoryEquipStatCategoryUI>(statusCategoryPrefab, 8); } InventoryManager.AddEquipCollection(this, equipPriority); //UpdateCharacterStats(); OnSwappedItems += (fromCollection, fromSlot, toCollection, toSlot) => { if (fromCollection == toCollection) { return; // Just moving inside collection, no need to re-do anything. } if (toCollection[toSlot].item != null && fromCollection[fromSlot].item != null) { // Actually swapped item var item = fromCollection[fromSlot].item as EquippableInventoryItem; if (item != null) { item.NotifyItemUnEquipped(); } } if (toCollection == this) { // Move to this inventory UpdateCharacterStats(); var i = toCollection[toSlot].item as EquippableInventoryItem; if (i != null) { bool handled = i.HandleLocks(equipSlotFields[i.index], this); if (handled) { i.NotifyItemEquipped(equipSlotFields[i.index]); if (i.playOnEquip != null) { InventoryUIUtility.AudioPlayOneShot(i.playOnEquip); } } } } else if (fromCollection == this) { UpdateCharacterStats(); // Moved from this collection to -> toCollection var i = toCollection[toSlot].item as EquippableInventoryItem; if (i != null) { i.NotifyItemUnEquipped(); } } }; window.OnShow += () => { RepaintStats(); }; }