PIbd22_Kamcharova_K.A._Doub.../DoubleDeckerBus/Drawing/DrawingDoubleDeckerbus.cs

57 lines
2.7 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.Body);
Brush additionalBrush = new SolidBrush(doubleDeckerBus.Body);
base.DrawTransport(g);
if (doubleDeckerBus.Secondfloor)
{
Brush additionalBrush2 = new SolidBrush(doubleDeckerBus.Body);
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);
}
}
}
}