private void Map_MouseClick(object sender, MouseEventArgs e) { foreach (Control control in EntityType.Controls) { if (control is RadioButton) { if (((RadioButton)control).Checked) { if (control.Tag.ToString() == "0") { _grid.SetPlayer(e.X, e.Y); } else if (control.Tag.ToString() == "1") { _grid.SetAI(e.X, e.Y); } else if (control.Tag.ToString() == "2") { _grid.SetBlock(e.X, e.Y); } else if (control.Tag.ToString() == "3") { _grid.ClearCell(e.X, e.Y); } } } } Map.Invalidate(); }
private void Map_MouseMove(object sender, MouseEventArgs e) { if (_isDrawWall) { _grid.SetBlock(e.X, e.Y); Map.Invalidate(); } }
private void Zoom_SelectedItemChanged(object sender, EventArgs e) { int zoom; Int32.TryParse(Zoom.Items[Zoom.SelectedIndex].ToString(), out zoom); _grid.Zoom(zoom); Map.Invalidate(); }
private void Load_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.ShowDialog(); MapLoader loader = new MapLoader(open.FileName); FileName.Text = open.FileName; loader.LoadMap(_grid); Map.Invalidate(); }
private void SetAttr_Click(object sender, EventArgs e) { int screenWidth = 1920, screenHeigth = 1080; if (!String.IsNullOrEmpty(SW.Text)) { Int32.TryParse(SW.Text, out screenWidth); } if (!String.IsNullOrEmpty(SH.Text)) { Int32.TryParse(SH.Text, out screenHeigth); } _grid = new FieldGrid(20, screenWidth, screenHeigth); Map.Invalidate(); }
private void Map_MouseUp(object sender, MouseEventArgs e) { foreach (Control control in EntityType.Controls) { if (control is RadioButton) { if (((RadioButton)control).Checked) { if (control.Tag.ToString() == "2") { _isDrawWall = false; _grid.SetBlock(e.X, e.Y); Map.Invalidate(); } } } } }
private void Clear_Click(object sender, EventArgs e) { _grid.ClearField(); Map.Invalidate(); }