diff --git a/WarmlyShip/WarmlyShip/MapWithSetShipGeneric.cs b/WarmlyShip/WarmlyShip/MapWithSetShipGeneric.cs index 50b81eb..f5d97d0 100644 --- a/WarmlyShip/WarmlyShip/MapWithSetShipGeneric.cs +++ b/WarmlyShip/WarmlyShip/MapWithSetShipGeneric.cs @@ -13,7 +13,7 @@ namespace WarmlyShip private readonly int _pictureWidth; private readonly int _pictureHeight; private readonly int _placeSizeWidth = 210; - private readonly int _placeSizeHeight = 90; + private readonly int _placeSizeHeight = 100; private readonly SetShipGeneric _setShips; private readonly U _map; @@ -97,7 +97,7 @@ namespace WarmlyShip private void DrawBackground(Graphics g) { Pen pen = new(Color.Black, 3); - for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++) + for (int i = 0; i < _pictureWidth / _placeSizeWidth; ++i) { for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j) //линия рамзетки места { @@ -110,13 +110,17 @@ namespace WarmlyShip private void DrawShips(Graphics g) { + int j = 0; for (int i = 0; i < _setShips.Count; ++i) { + if (i >= _pictureHeight / _placeSizeHeight) ++j; if (_setShips.Get(i) != null ) { - + int temp = 0; + if (_setShips.Get(i).GetCurrentPosition().Bottom - _setShips.Get(i).GetCurrentPosition().Top < 75) temp = (int)(_setShips.Get(i).GetCurrentPosition().Bottom - _setShips.Get(i).GetCurrentPosition().Top) / 2; + _setShips.Get(i).SetObject(j * _placeSizeWidth, i * _placeSizeHeight + temp, _pictureWidth, _pictureHeight); + _setShips.Get(i).DrawningObject(g); } - _setShips.Get(i)?.DrawningObject(g); } }