public static void SelectTile(int xPos, int yPos, TileTab tab, int clicks) { var ti = TileHandler.GetTileImage(tab); var tileSize = ti.TileSize; int originalIndex = TileHandler.GetTileIndex(xPos, yPos, tab); int index = ti.ColumnsPerRow * yPos + xPos; if (xPos >= ti.Image.Width / tileSize || yPos >= ti.Image.Height / tileSize) { return; } if (clicks == 1) { if (SelectedTiles.Contains(index)) { SelectedTiles.Remove(index); } else { SelectedTiles.Add(index); } } else { switch (tab) { case TileTab.Source: { TileHandler.SelectedTile = originalIndex; break; } case TileTab.Randomized: { TileHandler.SelectedTile = RandomizedMap[xPos, yPos]; break; } case TileTab.RuleTest: { TileHandler.SelectedTile = RuleTestMap[xPos, yPos]; break; } } } }
public static List <Tile> GetSelectedTiles() { return(SourceImages[SelectedSource].GetTiles().Where(t => SelectedTiles.Contains(t.Index)).ToList()); }