コード例 #1
0
 private void DrawGrid(Grid grid, Graphics graph)
 {
     for (int i = 0; i < grid.Width; i++)
     {
         for (int j = 0; j < grid.Height; j++)
         {
             var point = new Point(Consts.GRID_LEFT_TOP.X + Consts.CELL_SIZE * i, Consts.GRID_LEFT_TOP.Y + Consts.CELL_SIZE * j);
             var color = GridDrawer.GetCellColor(grid[i, j].Tag);
             var pen   = new Pen(color, 3);
             graph.DrawRectangle(pen, point.X, point.Y, Consts.CELL_SIZE - 3, Consts.CELL_SIZE - 3);
         }
     }
 }
コード例 #2
0
        private void DrawWeakSpot(Grid grid, Graphics graph)
        {
            int weakSpotY = 15;

            if (grid.WeakSlot >= 0)
            {
                Brush b     = new SolidBrush(GridDrawer.GetCellColor(grid._enemies[grid.WeakSlot]));
                var   point = new Point(Consts.GRID_LEFT_TOP.X + Consts.CELL_SIZE * grid.WeakSlot + Consts.CELL_SIZE / 2, Consts.GRID_LEFT_TOP.Y - weakSpotY);
                graph.FillPolygon(b, new Point[]
                {
                    new Point(point.X - 15, point.Y),
                    new Point(point.X, point.Y - 15),
                    new Point(point.X + 15, point.Y),
                    new Point(point.X - 15, point.Y)
                });
            }
        }