diff --git a/WarmlyShip/WarmlyShip/FormMapWithSetShips.Designer.cs b/WarmlyShip/WarmlyShip/FormMapWithSetShips.Designer.cs index 65dd6d8..a341bb7 100644 --- a/WarmlyShip/WarmlyShip/FormMapWithSetShips.Designer.cs +++ b/WarmlyShip/WarmlyShip/FormMapWithSetShips.Designer.cs @@ -164,7 +164,8 @@ // this.comboBoxSelectorMap.FormattingEnabled = true; this.comboBoxSelectorMap.Items.AddRange(new object[] { - "Простая карта"}); + "Простая карта", + "Океан"}); this.comboBoxSelectorMap.Location = new System.Drawing.Point(6, 26); this.comboBoxSelectorMap.Name = "comboBoxSelectorMap"; this.comboBoxSelectorMap.Size = new System.Drawing.Size(238, 28); diff --git a/WarmlyShip/WarmlyShip/FormMapWithSetShips.cs b/WarmlyShip/WarmlyShip/FormMapWithSetShips.cs index 69a41c3..9c4fabe 100644 --- a/WarmlyShip/WarmlyShip/FormMapWithSetShips.cs +++ b/WarmlyShip/WarmlyShip/FormMapWithSetShips.cs @@ -32,6 +32,9 @@ namespace WarmlyShip case "Простая карта": map = new SimpleMap(); break; + case "Океан": + map = new OceanMap(); + break; } if (map != null) { @@ -58,14 +61,14 @@ namespace WarmlyShip if (form.ShowDialog() == DialogResult.OK) { DrawningObjectShip ship = new(form.SelectedShip); - if (_mapShipsCollectionGeneric + ship) + if (form.SelectedShip == null || !(_mapShipsCollectionGeneric + ship)) { - MessageBox.Show("Объект добавлен"); - pictureBox.Image = _mapShipsCollectionGeneric.ShowSet(); + MessageBox.Show("Не удалось добавить объект"); } else { - MessageBox.Show("Не удалось добавить объект"); + MessageBox.Show("Объект добавлен"); + pictureBox.Image = _mapShipsCollectionGeneric.ShowSet(); } } } diff --git a/WarmlyShip/WarmlyShip/MapWithSetShipsGeneric.cs b/WarmlyShip/WarmlyShip/MapWithSetShipsGeneric.cs index 13bf9b4..9cb3bfd 100644 --- a/WarmlyShip/WarmlyShip/MapWithSetShipsGeneric.cs +++ b/WarmlyShip/WarmlyShip/MapWithSetShipsGeneric.cs @@ -21,11 +21,11 @@ namespace WarmlyShip /// /// Размер занимаемого объектом места (ширина) /// - private readonly int _placeSizeWidth = 210; + private readonly int _placeSizeWidth = 180; /// /// Размер занимаемого объектом места (высота) /// - private readonly int _placeSizeHeight = 90; + private readonly int _placeSizeHeight = 120; /// /// Набор объектов /// @@ -144,6 +144,14 @@ namespace WarmlyShip /// private void DrawBackground(Graphics g) { + for (int x = 0; x < _pictureWidth; x++) + { + for (int y = 0; y < _pictureWidth; y++) + { + Brush waterColor = new SolidBrush(Color.LightSkyBlue); + g.FillRectangle(waterColor, x * x, y * y, x * (x + 1), y * (y + 1)); + } + } Pen pen = new(Color.Black, 3); for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++) {