60 lines
2.8 KiB
C#
60 lines
2.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using DoubleDeckerbus.Entities;
|
|
|
|
namespace DoubleDeckerbus.Drawing
|
|
{
|
|
public class DrawingDoubleDeckerbus : DrawingBus
|
|
{
|
|
public DrawingDoubleDeckerbus(int speed, double weight, Color bodyColor, Color additionalColor, bool secondfloor, bool stairs, int width, int height) : base(speed, weight, bodyColor, width, height, 180, 110)
|
|
{
|
|
if (EntityBus != null)
|
|
{
|
|
EntityBus = new EntityDoubleDeckerBus(speed, weight, bodyColor, additionalColor, secondfloor, stairs);
|
|
}
|
|
}
|
|
public override void DrawTransport(Graphics g)
|
|
{
|
|
if (EntityBus is not EntityDoubleDeckerBus doubleDeckerBus)
|
|
{
|
|
return;
|
|
}
|
|
Pen pen = new(Color.Black); //чёрный цвет для колёс
|
|
Pen additionalPen = new(doubleDeckerBus.AddColor);
|
|
Brush additionalBrush = new SolidBrush(doubleDeckerBus.AddColor);
|
|
base.DrawTransport(g);
|
|
|
|
if (doubleDeckerBus.Secondfloor)
|
|
{
|
|
Brush additionalBrush2 = new SolidBrush(doubleDeckerBus.AddColor);
|
|
Brush brBlue = new SolidBrush(Color.LightBlue);
|
|
|
|
g.FillRectangle(additionalBrush2, _startPosX + 7, _startPosY + 12, 172, 40); //большой прямоугольник
|
|
|
|
g.DrawLine(pen, _startPosX + 7, _startPosY + 36, _startPosX + 178, _startPosY + 36);
|
|
|
|
g.FillRectangle(brBlue, _startPosX + 15, _startPosY + 15, 15, 15);
|
|
g.FillRectangle(brBlue, _startPosX + 42, _startPosY + 15, 15, 15);
|
|
g.FillRectangle(brBlue, _startPosX + 69, _startPosY + 15, 15, 15);
|
|
g.FillRectangle(brBlue, _startPosX + 96, _startPosY + 15, 15, 15);
|
|
g.FillRectangle(brBlue, _startPosX + 123, _startPosY + 15, 15, 15);
|
|
g.FillRectangle(brBlue, _startPosX + 150, _startPosY + 15, 15, 15);
|
|
}
|
|
|
|
if (doubleDeckerBus.Stairs)
|
|
{
|
|
g.DrawLine(pen, _startPosX + 10, _startPosY + 55, _startPosX + 34, _startPosY + 55);
|
|
g.DrawLine(pen, _startPosX + 10, _startPosY + 58, _startPosX + 34, _startPosY + 58);
|
|
g.DrawLine(pen, _startPosX + 10, _startPosY + 64, _startPosX + 34, _startPosY + 64);
|
|
g.DrawLine(pen, _startPosX + 10, _startPosY + 72, _startPosX + 34, _startPosY + 72);
|
|
g.DrawLine(pen, _startPosX + 10, _startPosY + 80, _startPosX + 34, _startPosY + 80);
|
|
g.DrawLine(pen, _startPosX + 10, _startPosY + 88, _startPosX + 34, _startPosY + 88);
|
|
g.DrawLine(pen, _startPosX + 10, _startPosY + 94, _startPosX + 34, _startPosY + 94);
|
|
}
|
|
}
|
|
}
|
|
} |