почти done

This commit is contained in:
Alenka 2023-10-26 23:10:37 +04:00
parent f5d9e89692
commit 842e5a8ca4
3 changed files with 60 additions and 111 deletions

View File

@ -30,9 +30,9 @@ namespace Monorail.DrawningObjects
protected int _startPosY = 0;
protected int _monoRailWidth = 133;
protected int _monoRailWidth = 110;
protected int _monoRailHeight = 50;
protected int _monoRailHeight = 60;
protected int wheelSz;
public DrawningMonorail(int speed, double weight, Color bodyColor, Color wheelColor, Color tireColor, int width, int height)
@ -122,92 +122,53 @@ DrawningObjectMonorail(this);
Pen tirePen = new Pen(EntityMonorail.TireColor);
if (_monoRailWidth - _monoRailWidth / 20 * 17 < wheelSz)
wheelSz = _monoRailWidth - _monoRailWidth / 20 * 17;
g.DrawEllipse(pen, _startPosX + 15, _startPosY + 5, 20, 20);
g.DrawEllipse(pen, _startPosX + 15, _startPosY + 35, 20, 20);
g.DrawRectangle(pen, _startPosX + 9, _startPosY + 15, 10, 30);
g.DrawRectangle(pen, _startPosX + 90, _startPosY + 15, 10,
30);
g.DrawRectangle(pen, _startPosX + 20, _startPosY + 4, 70, 52);
Point[] pointsArrLow = { new Point(_startPosX + _monoRailWidth / 10 * 4, _startPosY + _monoRailHeight / 5 * 2),
new Point(_startPosX + _monoRailWidth / 10, _startPosY + _monoRailHeight / 5 * 2),
new Point(_startPosX + _monoRailWidth / 10, _startPosY + _monoRailHeight / 10 * 7),
new Point(_startPosX + _monoRailWidth / 20 * 19, _startPosY + _monoRailHeight / 10 * 7),
new Point(_startPosX + _monoRailWidth / 20 * 19, _startPosY + _monoRailHeight / 5 * 2),
new Point(_startPosX + _monoRailWidth / 10 * 5, _startPosY + _monoRailHeight / 5 * 2),
new Point(_startPosX + _monoRailWidth / 10 * 4, _startPosY + _monoRailHeight / 5 * 2)};
//если есть доп.фонари
/* if (Cruiser.Headlights)
{
g.FillPolygon(bodyBrush, pointsArrLow);
g.DrawPolygon(pen, pointsArrLow);
Brush brYellow = new SolidBrush(Color.Yellow);
g.FillEllipse(brYellow, _startPosX + 80, _startPosY + 5, 20,
20);
g.FillEllipse(brYellow, _startPosX + 80, _startPosY + 35, 20,
20);
}*/
//основание лодки!!!
Brush br = new SolidBrush(EntityMonorail.BodyColor);
g.FillRectangle(br, _startPosX + 10, _startPosY + 15, 10, 30);
g.FillRectangle(br, _startPosX + 90, _startPosY + 15, 10, 30);
g.FillRectangle(br, _startPosX + 20, _startPosY + 5, 70, 50);
Point[] points = new Point[3];// нос лодки
points[0] = new Point(_startPosX + 100, _startPosY + 5);
points[1] = new Point(_startPosX + 100, _startPosY + 55);
points[2] = new Point(_startPosX + 100 + 50, _startPosY + 50 / 2);
g.FillPolygon(Brushes.Pink, points);
//границы носа лодки
Point[] points1 = new Point[3];// нос лодки
points1[0] = new Point(_startPosX + 100, _startPosY + 5);
points1[1] = new Point(_startPosX + 100, _startPosY + 55);
points1[2] = new Point(_startPosX + 100 + 50, _startPosY + 50 / 2);
g.DrawPolygon(pen, points1);
g.FillRectangle(Brushes.Black, _startPosX + 5, _startPosY + 15, 10, 10);
g.FillRectangle(Brushes.Black, _startPosX + 5, _startPosY + 35, 10, 10);
//если есть ракетные шахты, добавить условие
g.DrawRectangle(Pens.Black, _startPosX + 35,
_startPosY + 23, 15, 15);
g.DrawRectangle(Pens.Black, _startPosX + 50,
_startPosY + 19, 30, 25);
//крыша локомотива
Point[] pointsArrRoof = { new Point(_startPosX + _monoRailWidth / 10, _startPosY + _monoRailHeight / 5 * 2),
new Point(_startPosX + _monoRailWidth / 10 * 2, _startPosY + _monoRailHeight / 10),
new Point(_startPosX + _monoRailWidth /20 * 19, _startPosY + _monoRailHeight / 10),
new Point(_startPosX + _monoRailWidth /20 * 19, _startPosY + _monoRailHeight / 5 * 2),
new Point(_startPosX + _monoRailWidth / 10, _startPosY + _monoRailHeight / 5 * 2)};
g.FillPolygon(bodyBrush, pointsArrRoof);
g.DrawPolygon(pen, pointsArrRoof);
//дверь локомотива
Point[] pointsArrDoor = { new Point(_startPosX + _monoRailWidth / 10 * 4, _startPosY + _monoRailHeight / 5 * 2),
new Point(_startPosX + _monoRailWidth / 10 * 4, _startPosY + _monoRailHeight / 5),
new Point(_startPosX + _monoRailWidth / 10 * 5, _startPosY + _monoRailHeight / 5),
new Point(_startPosX + _monoRailWidth / 10 * 5, _startPosY + _monoRailHeight / 5 * 3),
new Point(_startPosX + _monoRailWidth / 10 * 4, _startPosY + _monoRailHeight / 5 * 3) };
g.DrawPolygon(pen, pointsArrDoor);
g.FillPolygon(cartBrush, pointsArrDoor);
//передняя часть тележки
Point[] pointsArrFrontCart = { new Point(_startPosX + _monoRailWidth / 10 * 4, _startPosY + _monoRailHeight / 10 * 7),
new Point(_startPosX + _monoRailWidth / 10 * 2, _startPosY + _monoRailHeight / 10 * 7),
new Point(_startPosX, _startPosY + _monoRailHeight / 10 * 9),
new Point(_startPosX + _monoRailWidth / 10 * 4, _startPosY + _monoRailHeight / 10 * 9),
new Point(_startPosX + _monoRailWidth / 10 * 4, _startPosY + _monoRailHeight / 10 * 7)};
g.FillPolygon(cartBrush, pointsArrFrontCart);
//задняя часть тележки
Point[] pointsArrBackCart = { new Point(_startPosX + _monoRailWidth / 10 * 6, _startPosY + _monoRailHeight / 10 * 7),
new Point(_startPosX + _monoRailWidth / 10 * 9, _startPosY + _monoRailHeight / 10 * 7),
new Point(_startPosX + _monoRailWidth, _startPosY + _monoRailHeight / 10 * 9),
new Point(_startPosX + _monoRailWidth / 10 * 6, _startPosY + _monoRailHeight / 10 * 9)
};
g.FillPolygon(cartBrush, pointsArrBackCart);
//левое окно
Rectangle leftRect = new();
leftRect.X = _startPosX + _monoRailWidth / 10 * 2;
leftRect.Y = _startPosY + _monoRailHeight / 25 * 4;
leftRect.Width = _monoRailWidth / 120 * 8;
leftRect.Height = _monoRailHeight / 50 * 10;
g.DrawRectangle(windowPen, leftRect);
g.FillRectangle(windowBrush, leftRect);
//среднее окно
Rectangle midRect = new();
midRect.X = _startPosX + _monoRailWidth / 10 * 3;
midRect.Y = _startPosY + _monoRailHeight / 25 * 4;
midRect.Width = _monoRailWidth / 120 * 8;
midRect.Height = _monoRailHeight / 50 * 10;
g.DrawRectangle(windowPen, midRect);
g.FillRectangle(windowBrush, midRect);
//правое окно
Rectangle rightRect = new();
rightRect.X = _startPosX + _monoRailWidth / 20 * 17;
rightRect.Y = _startPosY + _monoRailHeight / 25 * 4;
rightRect.Width = _monoRailWidth / 120 * 8;
rightRect.Height = _monoRailHeight / 50 * 10;
g.DrawRectangle(windowPen, rightRect);
g.FillRectangle(windowBrush, rightRect);
g.FillEllipse(wheelBrush, _startPosX + _monoRailWidth / 10, _startPosY + _monoRailHeight / 10 * 7, wheelSz, wheelSz);
g.DrawEllipse(tirePen, _startPosX + _monoRailWidth / 10, _startPosY + _monoRailHeight / 10 * 7, wheelSz, wheelSz);
g.FillEllipse(wheelBrush, _startPosX + _monoRailWidth / 10 * 8, _startPosY + _monoRailHeight / 10 * 7, wheelSz, wheelSz);
g.DrawEllipse(tirePen, _startPosX + _monoRailWidth / 10 * 8, _startPosY + _monoRailHeight / 10 * 7, wheelSz, wheelSz);
_monoRailWidth += dif;
// _monoRailWidth += dif;
}
}

View File

@ -37,43 +37,30 @@ namespace Monorail.DrawningObjects
Brush additionalBrush = new SolidBrush(advancedMonorail.AdditionalColor);
//3 колеса
if (advancedMonorail.AddWheelsNumb >= 3)
/* if (advancedMonorail.AddWheelsNumb >= 3)
{
g.FillEllipse(additionalBrush, _startPosX + _monoRailWidth / 10 * 6, _startPosY + _monoRailHeight / 10 * 7, wheelSz, wheelSz);
g.DrawEllipse(additionalPen, _startPosX + _monoRailWidth / 10 * 6, _startPosY + _monoRailHeight / 10 * 7, wheelSz, wheelSz);
}
//4 колеса
if (advancedMonorail.AddWheelsNumb >= 4)
{
g.FillEllipse(additionalBrush, _startPosX + _monoRailWidth / 10 * 3, _startPosY + _monoRailHeight / 10 * 7, wheelSz, wheelSz);
g.DrawEllipse(additionalPen, _startPosX + _monoRailWidth / 10 * 3, _startPosY + _monoRailHeight / 10 * 7, wheelSz, wheelSz);
}
g.DrawEllipse(additionalPen, _startPosX + _monoRailWidth / 10 * 3, _startPosY + _monoRailHeight / 10 * 7, wheelSz, wheelSz);
}*/
if (advancedMonorail.SecondCabine)
{
Point[] pointsSecondCabine = { new Point(_startPosX + _monoRailWidth / 20 * 19, _startPosY + _monoRailHeight / 10),
new Point(_startPosX + _monoRailWidth + dif, _startPosY + _monoRailHeight / 5 * 2),
new Point(_startPosX + _monoRailWidth + dif, _startPosY + _monoRailHeight / 10 * 7),
new Point(_startPosX + _monoRailWidth / 20 * 19, _startPosY + _monoRailHeight / 10 * 7),};
g.FillPolygon(additionalBrush, pointsSecondCabine);
g.DrawPolygon(additionalPen, pointsSecondCabine);
Rectangle Rect = new();
Rect.X = _startPosX + _monoRailWidth / 20 * 19;
Rect.Y = _startPosY + _monoRailHeight / 25 * 4 + _monoRailHeight / 50 * 3;
Rect.Width = _monoRailWidth / 120 * 6;
Rect.Height = _monoRailHeight / 50 * 7;
g.DrawRectangle(windowPen, Rect);
g.FillRectangle(windowBrush, Rect);
}
_monoRailWidth += dif;
//магнитная линия
if (advancedMonorail.MagniteRail)
{
g.DrawLine(additionalPen, new Point(_startPosX, _startPosY + _monoRailHeight - 1), new Point(_startPosX + _monoRailWidth, _startPosY + _monoRailHeight - 1));
Brush brYellow = new SolidBrush(Color.Yellow);
g.FillEllipse(brYellow, _startPosX + 80, _startPosY + 5, 20,
20);
g.FillEllipse(brYellow, _startPosX + 80, _startPosY + 35, 20,
20);
_monoRailWidth += dif;
//магнитная линия
if (advancedMonorail.MagniteRail)
{
g.FillEllipse(Brushes.Green, _startPosX + 90, _startPosY + 20, 20, 20);
}
}
}
}
}
}

View File

@ -89,8 +89,9 @@ pos)
if (monorail != null)
{
int inRow = _pictureWidth / _placeSizeWidth;
//monorail.SetPosition(i % inRow * _placeSizeWidth, _pictureHeight - _pictureHeight % _placeSizeHeight - (i / inRow + 1) * _placeSizeHeight);
monorail.SetPosition((i % inRow) * _placeSizeWidth + _placeSizeWidth / 20, _placeSizeHeight * (i / inRow) + _placeSizeHeight / 10); ;
// monorail.SetPosition(i % inRow * _placeSizeWidth, _pictureHeight - _pictureHeight % _placeSizeHeight - (i / inRow + 1) * _placeSizeHeight + 5);
monorail.SetPosition((i % inRow) * _placeSizeWidth + _placeSizeWidth / 50, _placeSizeHeight * (i / inRow) + _placeSizeHeight / 20);
monorail.DrawTransport(g);
}
i++;