From 88bca293e8040d0faf1c982748742585f0ecf688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=20=D0=91=D0=BE=D0=BD=D0=B4=D0=B0?= =?UTF-8?q?=D1=80=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Mon, 24 Oct 2022 00:44:39 +0400 Subject: [PATCH] =?UTF-8?q?3=20=D0=BB=D0=B0=D0=B1=D0=B0=20=D1=81=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D0=B0=D0=BD=D0=B0=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarmlyShip/WarmlyShip/MapWithSetShipGeneric.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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); } }