protected override void beforeAll() { tileset = linker.getOrCreateTileset(name); tileset.setNbTiles(nbTileX,nbTileY); tileset.imagePath = imageSourceAtRessourceLevel; }
protected override void beforeAll() { tileset = linker.getOrCreateTileset(name); tileset.setNbTiles(nbTileX, nbTileY); tileset.imagePath = imageSourceAtRessourceLevel; }
protected override void onLinkerLoaded() { if(linker.tilesets.Count > 0 && selectedTileset == null){ selectedTileset = linker.tilesets[0]; } if(selectedTileset != null){ loadTilesetImage(selectedTileset); } }
public TiledTilesetData getOrCreateTileset(string name) { TiledTilesetData tileset = getTileset(name); if(tileset == null){ tileset = new TiledTilesetData(name); tilesets.Add(tileset); } return tileset; }
protected override void OnEnable() { base.OnEnable(); if(linker != null && linker.tilesets.Count > 0 && selectedTileset == null){ selectedTileset = linker.tilesets[0]; } if(selectedTileset != null){ loadTilesetImage(selectedTileset); } }
/*protected void OnEnable(){ * if(linker.tilesets.Count > 0 && selectedTileset == null){ * selectedTileset = linker.tilesets[0]; * } * if(selectedTileset != null){ * loadTilesetImage(selectedTileset); * } * }*/ protected override void onLinkerLoaded() { if (linker.tilesets.Count > 0 && selectedTileset == null) { selectedTileset = linker.tilesets[0]; } if (selectedTileset != null) { loadTilesetImage(selectedTileset); } }
public TiledTilesetData getOrCreateTileset(string name) { TiledTilesetData tileset = getTileset(name); if (tileset == null) { tileset = new TiledTilesetData(name); tilesets.Add(tileset); } return(tileset); }
protected override void OnEnable() { base.OnEnable(); if (linker != null && linker.tilesets.Count > 0 && selectedTileset == null) { selectedTileset = linker.tilesets[0]; } if (selectedTileset != null) { loadTilesetImage(selectedTileset); } }
void showTilesetSelector() { tilsetChoicesText = new string[linker.tilesets.Count]; for (int index = 0; index < linker.tilesets.Count; index++) { tilsetChoicesText[index] = linker.tilesets[index].name; } GUI.changed = false; selectedTilesetIndex = RickEditorGUI.Popup("Editing Tileset", selectedTilesetIndex, tilsetChoicesText); if (GUI.changed) { selectedTileset = linker.tilesets[selectedTilesetIndex]; loadTilesetImage(selectedTileset); } }
void loadTilesetImage(TiledTilesetData tileset) { buttonsIcons = new List <Texture2D>(); Sprite[] sprites = Resources.LoadAll <Sprite>(tileset.imagePath); killAllTexturesFrom(buttonsIcons); killAllTexturesFrom(buttonsIconsGray); killAllTexturesFrom(buttonsIconsInverted); foreach (var sprite in sprites) { buttonsIcons.Add(TextureUtils.textureFromSprite(sprite)); buttonsIconsGray.Add(TextureUtils.textureFromSpriteGrayed(sprite)); buttonsIconsInverted.Add(TextureUtils.textureFromSpriteInverted(sprite)); } }
void switchShownTile(int index) { selectedTileset = linker.tilesets[index]; loadTilesetImage(selectedTileset); }
void loadTilesetImage(TiledTilesetData tileset) { buttonsIcons = new List<Texture2D>(); Sprite[] sprites = Resources.LoadAll<Sprite>(tileset.imagePath); killAllTexturesFrom(buttonsIcons); killAllTexturesFrom(buttonsIconsGray); killAllTexturesFrom(buttonsIconsInverted); foreach (var sprite in sprites) { buttonsIcons.Add( TextureUtils.textureFromSprite(sprite) ); buttonsIconsGray.Add( TextureUtils.textureFromSpriteGrayed(sprite) ); buttonsIconsInverted.Add( TextureUtils.textureFromSpriteInverted(sprite) ); } }