//by clicking on each tile take the number of row, column, and type of the tile // if it is a box. Then, keep related image in the currentTool private void Tile_Click(object sender, EventArgs e) { Grides mytile = sender as Grides; currentTile = mytile; currentRow = currentTile.row; currentCol = currentTile.column; currentType = tile[currentRow, currentCol].type; switch (currentType) { case 6: currentTool = Grides.ObstacleType.blueBox; break; case 7: currentTool = Grides.ObstacleType.redBox; break; case 8: currentTool = Grides.ObstacleType.greenBox; break; case 9: currentTool = Grides.ObstacleType.yellowBox; break; default: MessageBox.Show("You should select just a box"); break; } }
private void buttonYellowBox_Click(object sender, EventArgs e) { currentTool = Grides.ObstacleType.yellowBox; }
private void buttonGreenBox_Click(object sender, EventArgs e) { currentTool = Grides.ObstacleType.greenBox; }
private void buttonRedDoor_Click(object sender, EventArgs e) { currentTool = Grides.ObstacleType.redDoor; }
private void buttonWall_Click(object sender, EventArgs e) { currentTool = Grides.ObstacleType.Wall; }
/// <summary> /// add the clicked image (from the images list) to the currentTool /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonNone_Click(object sender, EventArgs e) { currentTool = Grides.ObstacleType.None; }