private void SetTakeLoanInteractions() { Button takeLoan = proceduralUiElements.CreateButton( uiData.employeeLayout.rectTransform, "Take Loan" ); takeLoan.onClick.AddListener(() => { bank.TakeLoan(1000); this.signalBus.Fire(new UpdateUIWindow()); }); //it should be in another List uiData.AddEmployeesApplyButton(takeLoan, takeLoan.gameObject.transform.GetChild(0).GetComponent <TextMeshProUGUI>()); }
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); } } } }