исправление заполнения

This commit is contained in:
Anastasia Yazykova 2024-04-07 21:56:17 +04:00
parent e6928d3c4d
commit 0d786c5297

View File

@ -27,23 +27,23 @@ public class BusStation : AbstractCompany
}
protected override void SetObjectsPosition()
{ int Width =0;
;
{
int Width = _pictureWidth / _placeSizeWidth - 1;
int Height = 0;
for (int i = 0; i < (_collection?.Count ?? 0); i++)
{
if (_collection?.Get(i) != null)
if (_collection.Get(i) != null)
{
_collection.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight);
_collection.Get(i)?.SetPosition(_placeSizeWidth * Width + 10, Height * _placeSizeHeight + 10);
_collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
_collection.Get(i).SetPosition(_placeSizeWidth * Width + 20, Height * _placeSizeHeight + 10);
}
if (Width < _pictureWidth / _placeSizeWidth - 1)
Width++;
if (Width > 0)
Width--;
else
{
Width = 0;
Width = _pictureWidth / _placeSizeWidth - 1;
Height++;
}
if (Height > _pictureHeight / _placeSizeHeight)
@ -53,4 +53,5 @@ public class BusStation : AbstractCompany
}
}
}