private void CreateChoice(JSONNode plantType) { // Get JSONNode from dict via url // Instantiate // Set Parent // Set script variables GameObject choice = Instantiate(plantTypeChoicePrefab) as GameObject; PlantTypeChoice script = choice.GetComponent <PlantTypeChoice>(); choice.transform.SetParent(choicePanelScrollContent, false); choice.GetComponentInChildren <Toggle>().group = GetComponent <ToggleGroup>(); // set script variables script.selectionReceiver = this; script.SetCommonName(plantType ["common_name"].Value); script.SetLatinName(plantType["latin_name"].Value); script.url = plantType["url"].Value; script.remover = this; script.plantTypeNode = plantType; if (plantType ["plant_count"].AsInt > 0) { script.removeButton.gameObject.SetActive(false); } }
public void Remove(PlantTypeChoice item) { plantTypeDict.Remove(item.url); DataManager.dataManager.StartCoroutine("DeleteRequest", item.url); Destroy(item.gameObject); }
public void MakeSelection(PlantTypeChoice choice) { // Set selectedPlantType if (choice.selected) { selectedPlantType = choice; } // Enable selectButton selectButton.interactable = true; // Set Icon - Implement later if (!emptySitesEnabled) { EnableEmptySites(true); } }