3 лаба сделаная

This commit is contained in:
Макс Бондаренко 2022-10-24 00:44:39 +04:00
parent 0e2fe47f20
commit 88bca293e8

View File

@ -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<T> _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);
}
}