rabota idet

This commit is contained in:
Baryshev Dmitry 2024-03-09 20:25:50 +04:00
parent 2520ad8c68
commit d02c1c03a7
2 changed files with 6 additions and 64 deletions

View File

@ -27,83 +27,26 @@ public class DrawningDumpTruck : DrawningTruck
}
public override void DrawTransport(Graphics g)
{
if (EntityTruck == null || !_startPosX.HasValue || !_startPosY.HasValue)
if (EntityTruck == null || EntityTruck is not EntityDumpTruck dumpTruck || !_startPosX.HasValue || !_startPosY.HasValue)
{
return;
}
base.DrawTransport(g);
}
//public void DrawTransport(Graphics g)
{
if (EntityDumpTruck == null || !_startPosX.HasValue || !_startPosY.HasValue)
{
return;
}
Pen pen = new(Color.Black);
Brush additionalBrush = new SolidBrush(EntityDumpTruck.AdditionalColor);
//Кабина и основа
Brush body = new SolidBrush(EntityDumpTruck.BodyColor);
g.FillRectangle(body, _startPosX.Value + 100, _startPosY.Value, 30, 40);
g.DrawRectangle(pen, _startPosX.Value + 100, _startPosY.Value, 30, 40);
g.FillRectangle(body, _startPosX.Value, _startPosY.Value + 40, 130, 20);
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 40, 130, 20);
//Фары
Brush light = new SolidBrush(Color.Yellow);
g.FillRectangle(light, _startPosX.Value + 130, _startPosY.Value + 40, 4, 5);
g.FillRectangle(light, _startPosX.Value - 5, _startPosY.Value + 40, 4, 5);
Brush light1 = new SolidBrush(Color.DarkOrange);
g.FillRectangle(light1, _startPosX.Value + 125, _startPosY.Value + 40, 5, 5);
g.FillRectangle(light1, _startPosX.Value, _startPosY.Value + 40, 5, 5);
//Стекло
Brush glass = new SolidBrush(Color.LightBlue);
g.FillRectangle(glass, _startPosX.Value + 110, _startPosY.Value + 5, 20, 25);
//Отрисовка колёс
Brush wheels = new SolidBrush(Color.Black);
g.FillEllipse(wheels, _startPosX.Value, _startPosY.Value + 60, 30, 30);
g.FillEllipse(wheels, _startPosX.Value + 30, _startPosY.Value + 60, 30, 30);
g.FillEllipse(wheels, _startPosX.Value + 100, _startPosY.Value + 60, 30, 30);
Brush kolpac = new SolidBrush(Color.Gray);
g.FillEllipse(kolpac, _startPosX.Value + 6, _startPosY.Value + 66, 17, 17);
g.FillEllipse(kolpac, _startPosX.Value + 36, _startPosY.Value + 66, 17, 17);
g.FillEllipse(kolpac, _startPosX.Value + 106, _startPosY.Value + 66, 17, 17);
//Отрисовка границ
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 40, 130, 20);
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 60, 30, 30);
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 60, 30, 30);
g.DrawEllipse(pen, _startPosX.Value + 100, _startPosY.Value + 60, 30, 30);
Pen glass_ = new(Color.DarkGray);
g.DrawRectangle(glass_, _startPosX.Value + 110, _startPosY.Value + 5, 20, 25);
Pen light_ = new(Color.LightBlue);
g.DrawRectangle(light_, _startPosX.Value + 130, _startPosY.Value + 40, 4, 5);
g.DrawRectangle(light_, _startPosX.Value + 125, _startPosY.Value + 40, 5, 5);
g.DrawRectangle(light_, _startPosX.Value - 5, _startPosY.Value + 40, 4, 5);
g.DrawRectangle(light_, _startPosX.Value, _startPosY.Value + 40, 5, 5);
Brush additionalBrush = new SolidBrush(dumpTruck.AdditionalColor);
//Отрисовка кузова
if (EntityDumpTruck.Awning)
if (dumpTruck.Awning)
{
g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value, 90, 35);
}
//Отрисовка тента
if (EntityDumpTruck.Awning & EntityDumpTruck.Tent)
if (dumpTruck.Awning & dumpTruck.Tent)
{
Brush tent = new SolidBrush(EntityDumpTruck.AdditionalColor);
Brush tent = new SolidBrush(dumpTruck.AdditionalColor);
g.FillRectangle(tent, _startPosX.Value, _startPosY.Value, 95, 10);
g.FillRectangle(tent, _startPosX.Value, _startPosY.Value, 95, 3);
g.FillRectangle(tent, _startPosX.Value + 30, _startPosY.Value, 3, 40);
@ -114,7 +57,6 @@ public class DrawningDumpTruck : DrawningTruck
g.DrawRectangle(t, _startPosX.Value + 30, _startPosY.Value, 3, 40);
g.DrawRectangle(t, _startPosX.Value + 70, _startPosY.Value, 3, 40);
}
}
}

View File

@ -25,7 +25,7 @@ public class EntityDumpTruck : EntityTruck
/// <param name="additionalColor">Дополнительный цвет</param>
/// <param name="awning">Признак наличия обвеса</param>
/// <param name="tent">Признак наличия антикрыла</param>
public void Init(int speed, double weight, Color bodyColor, Color
public (int speed, double weight, Color bodyColor, Color
additionalColor, bool awning, bool tent)
{
AdditionalColor = additionalColor;