/// <summary> /// Handles the TilesetDeleted event of the <see cref="TilesetManager"/> class. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="TilesetDeletedEventArgs"/> instance containing the event data.</param> private void TilesetDeleted(object sender, TilesetDeletedEventArgs e) { using (UndoRedoManager.Start("Deleting tileset")) { foreach (var map in Maps) { foreach (var layer in map.ConcreteLayers) { foreach (var tile in layer.Tiles) { if (tile.Tileset == e.ID) { tile.SrcX = 0; tile.SrcY = 0; tile.Terrain = 0; tile.Tileset = 0; } } } foreach (var layer in map.Layers) { foreach (var tile in layer.Tiles) { if (tile.Tileset == e.ID) { tile.SrcX = 0; tile.SrcY = 0; tile.Terrain = 0; tile.Tileset = 0; } } } map.CacheAllTiles(); } UndoRedoManager.Commit(); } }
/// <summary> /// Handles the TilesetDeleted event of the <see cref="TilesetManager"/> object. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="TilesetDeletedEventArgs"/> instance containing the event data.</param> private void TilesetDeleted(object sender, TilesetDeletedEventArgs e) { cmbTilesets.Items.Remove(e.Name); viewTexture.Texture = null; if (cmbTilesets.Items.Count > 0) cmbTilesets.SelectedIndex = 0; }
/// <summary> /// Handles the TilesetDeleted event of the <see cref="TilesetManager"/> object. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="TilesetDeletedEventArgs"/> instance containing the event data.</param> private void TilesetDeleted(object sender, TilesetDeletedEventArgs e) { string selectednode = null; if (treeProject.SelectedNode.Name == "Tileset" + e.Name) selectednode = tilesetsNode.Name; foreach (TreeNode node in tilesetsNode.Nodes) { if (node != null) { if (node.Text == e.Name) tilesetsNode.Nodes.Remove(node); } } SortNodes(selectednode); }