Приведено в соответствие к варианту задания
This commit is contained in:
parent
a81ae90d4c
commit
6cbdb2ad68
@ -3,7 +3,7 @@ using Trolleybus;
|
||||
|
||||
namespace Trolleybus
|
||||
{
|
||||
internal class HardMap : SimpleMap
|
||||
internal class AutoStopMap : SimpleMap
|
||||
{
|
||||
protected override void GenerateMap()
|
||||
{
|
@ -26,7 +26,7 @@ namespace Trolleybus
|
||||
map = new SimpleMap();
|
||||
break;
|
||||
case "Сложная карта":
|
||||
map = new HardMap();
|
||||
map = new AutoStopMap();
|
||||
break;
|
||||
}
|
||||
if (map != null)
|
||||
|
@ -162,31 +162,27 @@ namespace Trolleybus
|
||||
/// <param name="g"></param>
|
||||
private void DrawTrolleybus(Graphics g)
|
||||
{
|
||||
int widthEl = _pictureWidth / _placeSizeWidth;
|
||||
int heightEl = _pictureHeight / _placeSizeHeight;
|
||||
|
||||
int curWidth = 0;
|
||||
int curHeight = 0;
|
||||
|
||||
for (int i = _setTrolleybus.Count; i >= 0; i--)
|
||||
int xForLocomotive = _pictureWidth - 2 * _placeSizeWidth + 60;
|
||||
int yForLocomotive = 10;
|
||||
int countInRow = 0;
|
||||
for (int i = 0; i < _setTrolleybus.Count; i++)
|
||||
{
|
||||
_setTrolleybus.Get(i)?.SetObject(_pictureWidth - _placeSizeWidth * curWidth - 10,
|
||||
curHeight * _placeSizeHeight + 10, _pictureWidth, _pictureHeight);
|
||||
_setTrolleybus.Get(i)?.DrawningObject(g);
|
||||
|
||||
if (curWidth < widthEl)
|
||||
curWidth++;
|
||||
else
|
||||
if (countInRow >= _pictureWidth / (_placeSizeWidth + 30))
|
||||
{
|
||||
curWidth = 1;
|
||||
curHeight++;
|
||||
xForLocomotive = _pictureWidth - _placeSizeWidth + 40;
|
||||
yForLocomotive += _placeSizeHeight;
|
||||
countInRow = 0;
|
||||
}
|
||||
if (curHeight > heightEl)
|
||||
if (_setTrolleybus.Get(i) != null)
|
||||
{
|
||||
return;
|
||||
T locomotive = _setTrolleybus.Get(i);
|
||||
locomotive.SetObject(xForLocomotive, yForLocomotive, _pictureWidth, _pictureHeight);
|
||||
locomotive.DrawningObject(g);
|
||||
}
|
||||
xForLocomotive -= _placeSizeWidth + 30;
|
||||
countInRow++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user