public override void Enable(City city, GUIMaster gui) { this.selectedCity = city; this.selectedButton = null; base.Enable(city, gui); //Clear List Entries and Texts selectionTitle.text = ""; selectionDesc.text = ""; foreach (ProjectButton b in availableProjectList.GetComponentsInChildren <ProjectButton>()) { Destroy(b.transform.gameObject); } foreach (ProjectButton b in unavailableProjectsList.GetComponentsInChildren <ProjectButton>()) { Destroy(b.transform.gameObject); } //TODO: Implement automatic buttons //Populate project lists foreach (string projectID in selectedCity.construction.GetAvailableProjects()) { ProjectButton pb = Instantiate(projectButtonPrefab); pb.transform.SetParent(availableProjectList.transform); pb.ProjectSelector = this; pb.text.text = GlobalProjectDictionary.GetProjectData(projectID).Name; pb.ProjectID = projectID; } UpdateGUI(); }
public void SelectProject(ProjectButton b) { b.button.interactable = false; if (selectedButton != null) { selectedButton.button.interactable = true; } ProjectData p = GlobalProjectDictionary.GetProjectData(b.ProjectID); selectionTitle.text = p.Name; selectionDesc.text = p.GetDescription(selectedCity, gui.Game); selectedButton = b; confirmButton.interactable = p.IsConstructable(selectedCity, gui.Game); }