public void DisplayLists() { foreach (Transform currentDisplayedEntry in VerticalLayoutParent) { SimplePool.Despawn(currentDisplayedEntry.gameObject); } var filteredDefs = FilterLists(); foreach (var defName in filteredDefs) { var def = TileDefMap.GetTileDef(defName); var go = SimplePool.Spawn(TileDefEntryPrefab, Vector3.zero, Quaternion.identity); go.transform.SetParent(VerticalLayoutParent); go.transform.localScale = Vector3.one; go.GetComponentInChildren <TextMeshProUGUI>().text = def.Name; var images = go.GetComponentsInChildren <Image>(); foreach (var image in images) { if (image.gameObject.name == "Preview Image") { image.sprite = def.Sprite; } } foreach (Transform child in go.transform) { if (child.name == "Edit") { child.GetComponent <Button>().onClick.AddListener(delegate { TileDefEditClicked(defName); }); } else if (child.name == "Button") { child.GetComponent <Button>().onClick.AddListener(delegate { TileDefSelected(defName); }); } } } }
private void TileDefSelected(string tileName) { var tile = TileDefMap.GetTileDef(tileName); SelectedTileDefController.TileDefSelectedInternal(tile); }
public Tile ToTile(Room room, TileLayer layer) { return(new TileActual(TileDefMap.GetTileDef(Definition), Position, room, layer, TileEntity)); }