private void TilesChanged(object sender, ChangeEventArgs e) { if (e.ChangeType == ChangeEventArgs.EventType.Modified && e.Tile.Index == currentTileIndex) { CurrentTileIndex = CurrentTileIndex; } if (e.ChangeType == ChangeEventArgs.EventType.Removed && e.Tile.Index == currentTileIndex) { CurrentTileIndex = -1; } if (e.ChangeType == ChangeEventArgs.EventType.Selected) { CurrentTileIndex = e.Tile?.Index ?? 0; } if (CurrentMap != null) { if (e.ChangeType == ChangeEventArgs.EventType.Removed && CurrentMap.ContainsTile(e.Tile.Index)) { CurrentMap.ReplaceTile(e.Tile.Index, 0); } if (e.ChangeType == ChangeEventArgs.EventType.Modified && CurrentMap.ContainsTile(e.Tile.Index)) { Redraw(e.Tile.Index); } } }