/* * Summary: Draws the player's grid and ships. * Parameter: grid - the grid to show * Parameter: thePlayer - the player to show the ships of * Parameter: small - true if the small grid is shown * Parameter: showShips - true if ships are to be shown * Parameter: left - the left side of the grid * Parameter: top - the top of the grid * Parameter: width - the width of the grid * Parameter: height - the height of the grid * Parameter: cellWidth - the width of each cell * Parameter: cellHeight - the height of each cell * Parameter: cellGap - the gap between the cells */ private static void DrawCustomField(ISeaGrid grid, Player thePlayer, bool small, bool showShips, int left, int top, int width, int height, int cellWidth, int cellHeight, int cellGap, bool showonlydestroyed) { //SwinGame.FillRectangle(Color.Blue, left, top, width, height) int rowTop = 0; int colLeft = 0; //Draw the grid for (int row = 0; row <= 9; row++) { rowTop = top + (cellGap + cellHeight) * row; for (int col = 0; col <= 9; col++) { colLeft = left + (cellGap + cellWidth) * col; Color fillColor = default(Color); bool draw = false; draw = true; switch (grid[row, col]) { //case TileView.Ship: //draw = false; //break; //If small Then fillColor = _SMALL_SHIP Else fillColor = _LARGE_SHIP case TileView.Miss: if (small) { fillColor = SMALL_MISS; } else { fillColor = LARGE_MISS; } break; case TileView.Hit: if (small) { fillColor = SMALL_HIT; } else { fillColor = LARGE_HIT; } break; case TileView.Sea: case TileView.Ship: if (small) { fillColor = SMALL_SEA; } else { draw = false; } break; } if (draw) { SwinGame.FillRectangle(fillColor, colLeft, rowTop, cellWidth, cellHeight); if (!small) { SwinGame.DrawRectangle(OUTLINE_COLOR, colLeft, rowTop, cellWidth, cellHeight); } } } } if (!showShips) { return; } UtilityFunctions.DrawShips(grid, thePlayer, small, showShips, rowTop, colLeft, left, top, width, height, cellWidth, cellHeight, cellGap, showonlydestroyed); }