예제 #1
0
 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();
 }
예제 #2
0
 private void Map_MouseMove(object sender, MouseEventArgs e)
 {
     if (_isDrawWall)
     {
         _grid.SetBlock(e.X, e.Y);
         Map.Invalidate();
     }
 }
예제 #3
0
        private void Zoom_SelectedItemChanged(object sender, EventArgs e)
        {
            int zoom;

            Int32.TryParse(Zoom.Items[Zoom.SelectedIndex].ToString(), out zoom);

            _grid.Zoom(zoom);
            Map.Invalidate();
        }
예제 #4
0
        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();
        }
예제 #5
0
        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();
        }
예제 #6
0
 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();
                 }
             }
         }
     }
 }
예제 #7
0
 private void Clear_Click(object sender, EventArgs e)
 {
     _grid.ClearField();
     Map.Invalidate();
 }