public void ConnectToInventory(Dictionary <InventoryItem, uGUI_ItemIcon> lookup) { this.InventoryMapping = lookup; (Container as IItemsContainer).onAddItem += OnAddItemLate; if (this.MaterialsProcessing.Count == 0) { return; } foreach (KeyValuePair <InventoryItem, uGUI_ItemIcon> pair in lookup) { InventoryItem item = pair.Key; uGUI_ItemIcon icon = pair.Value; BioEnergy bioEnergy = this.MaterialsProcessing.Find(item.item); if (bioEnergy is null) { QuickLogger.Debug("Matching pickable in bioreactor not found", true); continue; } bioEnergy.AddDisplayText(icon); } }
private void OnAddItemLate(InventoryItem item) { if (this.InventoryMapping is null) { return; } if (this.InventoryMapping.TryGetValue(item, out uGUI_ItemIcon icon)) { BioEnergy bioEnergy = this.MaterialsProcessing.Find(item.item); if (bioEnergy is null) { QuickLogger.Debug("Matching pickable in bioreactor not found", true); return; } bioEnergy.AddDisplayText(icon); } }