1 этап)

This commit is contained in:
Макс Бондаренко 2022-10-29 22:29:16 +04:00
parent 62bae752ae
commit 0dc69f5f7d

View File

@ -49,13 +49,9 @@ namespace WarmlyShip
public Bitmap ShowOnMap()
{
Shaking();
for (int i = 0; i < _setShips.Count; i++)
foreach (var car in _setShips.GetShips())
{
var ship = _setShips[i];
if (ship != null)
{
return _map.CreateMap(_pictureWidth, _pictureHeight, ship);
}
return _map.CreateMap(_pictureWidth, _pictureHeight, car);
}
return new(_pictureWidth, _pictureHeight);
}
@ -111,7 +107,7 @@ namespace WarmlyShip
private void DrawShips(Graphics g)
{
for (int i = 0; i < _setShips.Count; ++i)
/*for (int i = 0; i < _setShips.Count; ++i)
{
if (_setShips[i] != null )
{
@ -120,6 +116,19 @@ namespace WarmlyShip
_setShips[i].SetObject((_pictureWidth / _placeSizeWidth - (i % (_pictureWidth / _placeSizeWidth)) - 1) * _placeSizeWidth, (i / (_pictureWidth / _placeSizeWidth)) * _placeSizeHeight + temp, _pictureWidth, _pictureHeight);
_setShips[i].DrawningObject(g);
}
}*/
int i = 0;
foreach (var ship in _setShips.GetShips())
{
if (ship != null)
{
int temp = 0;
if (ship.GetCurrentPosition().Bottom - ship.GetCurrentPosition().Top < 75) temp = (int)(ship.GetCurrentPosition().Bottom - ship.GetCurrentPosition().Top);
ship.SetObject((_pictureWidth / _placeSizeWidth - (i % (_pictureWidth / _placeSizeWidth)) - 1) * _placeSizeWidth, (i / (_pictureWidth / _placeSizeWidth)) * _placeSizeHeight + temp, _pictureWidth, _pictureHeight);
ship.DrawningObject(g);
}
++i;
}
}