diff --git a/WarmlyShip/WarmlyShip/MapWithSetShipGeneric.cs b/WarmlyShip/WarmlyShip/MapWithSetShipGeneric.cs index f5d97d0..2636a8d 100644 --- a/WarmlyShip/WarmlyShip/MapWithSetShipGeneric.cs +++ b/WarmlyShip/WarmlyShip/MapWithSetShipGeneric.cs @@ -41,8 +41,8 @@ namespace WarmlyShip { Bitmap bmp = new(_pictureWidth, _pictureHeight); Graphics gr = Graphics.FromImage(bmp); - DrawBackground(gr); DrawShips(gr); + DrawBackground(gr); return bmp; } @@ -96,13 +96,14 @@ namespace WarmlyShip private void DrawBackground(Graphics g) { - Pen pen = new(Color.Black, 3); + Pen pen = new(Color.Brown, 8); for (int i = 0; i < _pictureWidth / _placeSizeWidth; ++i) { - for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j) //линия рамзетки места + for (int j = 1; j < _pictureHeight / _placeSizeHeight + 1; ++j) //линия рамзетки места { - g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * - _placeSizeWidth + _placeSizeWidth / 2, j * _placeSizeHeight); + g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j * _placeSizeHeight); + for (int k = 0; k < _placeSizeWidth / (30 * 2); ++k) + g.DrawLine(pen, i * _placeSizeWidth + (k + 1) * 30, j * _placeSizeHeight, i * _placeSizeWidth + (k + 1) * 30, j * _placeSizeHeight + 30); } g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, (_pictureHeight / _placeSizeHeight) * _placeSizeHeight); } @@ -110,15 +111,13 @@ 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).SetObject((_pictureWidth / _placeSizeWidth - (i % (_pictureWidth / _placeSizeWidth)) - 1) * _placeSizeWidth, (i / (_pictureWidth / _placeSizeWidth)) * _placeSizeHeight + temp, _pictureWidth, _pictureHeight); _setShips.Get(i).DrawningObject(g); } }