private void TilePanel_MouseMove(object sender, MouseEventArgs e)
        {
            gui.CoLabel.Text = "X: " + y + "  Y: " + x;
            HeadController.TileType type = gui.GetTileType();
            Tile tile      = gui.Controller.Map.GetGrid()[x, y];
            int  team      = gui.GetTeamNumber();
            bool antOnHill = gui.GetOnHill();

            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                Control control = (Control)sender;
                if (control.Capture)
                {
                    control.Capture = false;
                }
                if (control.ClientRectangle.Contains(e.Location))
                {
                    gui.Controller.SetTileType(type, tile, team, antOnHill);
                }
                if (draw)
                {
                    this.Refresh();
                }
            }
            DrawSelection();
            draw = false;
        }
Exemple #2
0
 public Tile(int x, int y, HeadController.TileType type)
 {
     X         = x;
     Y         = y;
     this.Type = type;
     this.Team = -1;
 }
        private void TilePanel_MouseDown(object sender, MouseEventArgs e)
        {
            HeadController.TileType type = gui.GetTileType();
            Tile tile      = gui.Controller.Map.GetGrid()[x, y];
            int  team      = gui.GetTeamNumber();
            bool antOnHill = gui.GetOnHill();

            Control control = (Control)sender;

            if (control.Capture)
            {
                control.Capture = false;
            }
            if (control.ClientRectangle.Contains(e.Location))
            {
                gui.Controller.SetTileType(type, tile, team, antOnHill);
            }
            this.Refresh();
            DrawSelection();
        }
        private void PaintPanel(object sender, PaintEventArgs e)
        {
            HeadController.TileType type = gui.Controller.Map.GetGrid()[x, y].Type;
            Color teamColor = gui.Controller.GetTeamColor(gui.Controller.Map.GetGrid()[x, y].Team);

            this.BackColor = gui.Controller.GetTileBackGroundColor(gui.Controller.Map.GetGrid()[x, y]);

            if (type == HeadController.TileType.Hill)
            {
                Pen       p1    = new Pen(teamColor, 2);
                Rectangle rect1 = new Rectangle(2, 2, this.Width - 4, this.Height - 4);
                e.Graphics.DrawEllipse(p1, rect1);
            }

            if (type == HeadController.TileType.Ant)
            {
                SolidBrush myBrush = new SolidBrush(teamColor);
                Rectangle  rect    = new Rectangle(2, 2, this.Width - 4, this.Height - 4);
                e.Graphics.FillEllipse(myBrush, rect);
            }
            DrawGrid(e);
        }