Bondarenko M.S. Lab Work 3 #8

Merged
eegov merged 12 commits from LabWork_03 into LabWork_02 2022-11-07 12:10:38 +04:00
Showing only changes of commit 88bca293e8 - Show all commits

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);
}
}