diff --git a/Battleship/Battleship/DrawningShip.cs b/Battleship/Battleship/DrawningShip.cs
index 019988f..6a56b76 100644
--- a/Battleship/Battleship/DrawningShip.cs
+++ b/Battleship/Battleship/DrawningShip.cs
@@ -22,11 +22,11 @@ namespace Battleship.DrawningObjects
///
/// Ширина окна
///
- private int _pictureWidth;
+ public int _pictureWidth;
///
/// Высота окна
///
- private int _pictureHeight;
+ public int _pictureHeight;
///
/// Левая координата прорисовки
///
diff --git a/Battleship/Battleship/FormShipCollection.cs b/Battleship/Battleship/FormShipCollection.cs
index 0901969..a047311 100644
--- a/Battleship/Battleship/FormShipCollection.cs
+++ b/Battleship/Battleship/FormShipCollection.cs
@@ -100,8 +100,7 @@ namespace Battleship
{
return;
}
- var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
- string.Empty];
+ var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
if (obj == null)
{
return;
@@ -109,10 +108,8 @@ namespace Battleship
var FormShipConfig = new FormShipConfig();
FormShipConfig.AddEvent(AddShip);
- FormShipConfig.Show();
-
+ FormShipConfig.Show();
}
-
private void AddShip(DrawningShip drawningShip)
{
if (listBoxStorages.SelectedIndex == -1)
diff --git a/Battleship/Battleship/FormShipConfig.cs b/Battleship/Battleship/FormShipConfig.cs
index 52a1b27..4f09ab2 100644
--- a/Battleship/Battleship/FormShipConfig.cs
+++ b/Battleship/Battleship/FormShipConfig.cs
@@ -15,7 +15,7 @@ namespace Battleship
public partial class FormShipConfig : Form
{
///
- /// Переменная-выбранная машина
+ /// Переменная-выбранный корабль
///
DrawningShip? _ship = null;
///
@@ -37,9 +37,7 @@ namespace Battleship
panelYellow.MouseDown += PanelColor_MouseDown;
panelBlue.MouseDown += PanelColor_MouseDown;
- // TODO buttonCancel.Click with lambda
buttonCancel.Click += (s, e) => Close();
-
}
///
/// Отрисовать машину
@@ -113,7 +111,6 @@ namespace Battleship
}
DrawShip();
}
- // TODO Реализовать логику смены цветов: основного и дополнительного (для продвинутого объекта)
///
/// Добавление машины
///
diff --git a/Battleship/Battleship/ShipGenericCollection.cs b/Battleship/Battleship/ShipGenericCollection.cs
index ac2d497..86d4fb8 100644
--- a/Battleship/Battleship/ShipGenericCollection.cs
+++ b/Battleship/Battleship/ShipGenericCollection.cs
@@ -73,11 +73,14 @@ namespace Battleship.Generics
}
private void DrawObjects(Graphics g)
{
+ int width = _pictureWidth/ _placeSizeWidth;
int i = 0;
foreach(var ship in _collection.GetShips())
{
if(ship != null)
{
+ ship._pictureWidth = _pictureWidth;
+ ship._pictureHeight = _pictureHeight;
int inRow = _pictureWidth / _placeSizeWidth;
ship.SetPosition(i % inRow * _placeSizeWidth, _pictureHeight - _pictureHeight % _placeSizeHeight - (i / inRow + 1) * _placeSizeHeight + 5);
ship.DrawTransport(g);