private void SetEmployeesButton() { foreach (var buildingWorker in building.BuildingData.AvailableWorker) { if (buildingWorker != null) { if (!uiData.Contains(buildingWorker.WorkerType.ToString())) { var btn = proceduralUiElements.CreateButton( uiData.employeeLayout.rectTransform, buildingWorker.WorkerType.ToString()); SetEventListener(btn, buildingWorker.WorkerType); var(employedPlaces, countEmployedPlaces) = building.BuildingData.GetCountOfEmployed(buildingWorker.WorkerType); var countLabel = proceduralUiElements.GenerateCountOfEmployedWorker( uiData.countLayout.rectTransform, (employedPlaces, countEmployedPlaces) ); if (employedPlaces > 0) { var signsoBtn = proceduralUiElements.CreateButton( parent: uiData.quitLayout.rectTransform, "Quit" ); SetEventListener(signsoBtn, buildingWorker.Worker, buildingWorker.WorkerType); //-------------- uiData.AddEmployeesQuitButton(signsoBtn, signsoBtn.gameObject.transform.GetChild(0).GetComponent <TextMeshProUGUI>()); } //---------- uiData.AddEmployeesApplyButton(btn, btn.gameObject.transform.GetChild(0).GetComponent <TextMeshProUGUI>()); uiData.AddEmployeesCountButton(btn, countLabel); } } } }