public void UpdateWorker() { UIManager.Instance.ToInventoryWorkers(); Transform workersParent = UIManager.Instance.inventoryUI.workersParent; for (int i = 0; i < workersParent.childCount; i++) { InventoryWorkerUI iwui = workersParent.GetChild(i).GetComponent <InventoryWorkerUI>(); if (iwui != null) { iwui.AddListener <string>(UpdateWorker, iwui.item.Code); } } }
public void UpdateWorker(string code) { Transform workersParent = UIManager.Instance.inventoryUI.workersParent; for (int i = 0; i < workersParent.childCount; i++) { InventoryWorkerUI iwui = workersParent.GetChild(i).GetComponent <InventoryWorkerUI>(); if (iwui != null) { iwui.ResetListeners(); } } UIManager.Instance.BackFromInventory(); factory.worker = ((Worker.HiredWorker)Inventory.Instance.workers[code]).worker; factory.Work(); UpdateGUI(); }