снизил кол-во опциональных частей

This commit is contained in:
Cat-pranks 2024-03-06 12:52:43 +04:00
parent ee25905cc2
commit 64fdafe57a
4 changed files with 22 additions and 44 deletions

View File

@ -23,10 +23,10 @@ public class DrawningAccordionBus:DrawningBus
/// /// <param name="garmoshka">Признак наличия гармошки</param>
public DrawningAccordionBus(int speed, double weight, Color bodyColor, Color
additionalColor, bool bodyGlass, bool door, bool disk, bool garmoshka):base(180,40)
additionalColor, bool bodyGlass,bool garmoshka):base(180,40)
{
EntityBus = new EntityAccordionBus(speed, weight, bodyColor, additionalColor,
bodyGlass, door, disk, garmoshka);
bodyGlass, garmoshka);
}
public override void DrawTransport(Graphics g)
@ -34,7 +34,7 @@ public class DrawningAccordionBus:DrawningBus
if(EntityBus == null || EntityBus is not EntityAccordionBus accordionBus || !_startPosX.HasValue || !_startPosY.HasValue)
return;
base.DrawTransport(g);
//гармошка
if (accordionBus.BodyGarmoshka)
{
g.DrawRectangle(new Pen(Color.Black), _startPosX.Value + 70, _startPosY.Value, 40, 30);
@ -44,24 +44,7 @@ public class DrawningAccordionBus:DrawningBus
g.DrawRectangle(new Pen(Color.Black), _startPosX.Value, _startPosY.Value, 70, 30);
g.DrawRectangle(new Pen(Color.Black), _startPosX.Value + 110, _startPosY.Value, 70, 30);
//колёса
if (accordionBus.BodyDisk)
{
//диски
Brush brWhite = new SolidBrush(Color.White);
g.FillEllipse(brWhite, _startPosX.Value, _startPosY.Value + 25, 20, 15);
g.FillEllipse(brWhite, _startPosX.Value + 50, _startPosY.Value + 25, 20, 15);
Brush brWheel = new SolidBrush(accordionBus.AdditionalColor);
g.FillEllipse(brWheel, _startPosX.Value, _startPosY.Value + 25, 20, 15);
g.FillEllipse(brWheel, _startPosX.Value + 50, _startPosY.Value + 25, 20, 15);
g.FillEllipse(brWheel, _startPosX.Value + 110, _startPosY.Value + 25, 20, 15);
g.FillEllipse(brWheel, _startPosX.Value + 160, _startPosY.Value + 25, 20, 15);
}
Pen penWheel = new Pen(Color.Black);
g.DrawEllipse(penWheel, _startPosX.Value, _startPosY.Value + 25, 20, 15);
g.DrawEllipse(penWheel, _startPosX.Value + 50, _startPosY.Value + 25, 20, 15);
g.DrawEllipse(penWheel, _startPosX.Value + 110, _startPosY.Value + 25, 20, 15);
g.DrawEllipse(penWheel, _startPosX.Value + 160, _startPosY.Value + 25, 20, 15);
//стекла
if (accordionBus.BodyGlass)
{
@ -76,15 +59,6 @@ public class DrawningAccordionBus:DrawningBus
g.DrawEllipse(penGlass, _startPosX.Value + 115, _startPosY.Value + 5, 10, 15);
g.DrawEllipse(penGlass, _startPosX.Value + 165, _startPosY.Value + 5, 10, 15);
}
//двери
if (accordionBus.BodyDoor)
{
Brush brDoor = new SolidBrush(Color.Black);
g.FillRectangle(brDoor, _startPosX.Value + 45, _startPosY.Value + 10, 5, 20);
g.FillRectangle(brDoor, _startPosX.Value + 25, _startPosY.Value + 10, 5, 20);
g.FillRectangle(brDoor, _startPosX.Value + 135, _startPosY.Value + 10, 5, 20);
g.FillRectangle(brDoor, _startPosX.Value + 155, _startPosY.Value + 10, 5, 20);
}
}
}

View File

@ -171,6 +171,17 @@ public class DrawningBus
{
if (EntityBus == null || !_startPosX.HasValue || !_startPosY.HasValue)
return;
//диски
Brush brWhite = new SolidBrush(Color.White);
g.FillEllipse(brWhite, _startPosX.Value, _startPosY.Value + 25, 20, 15);
g.FillEllipse(brWhite, _startPosX.Value + 50, _startPosY.Value + 25, 20, 15);
Brush brWheel = new SolidBrush(Color.Black);
g.FillEllipse(brWheel, _startPosX.Value, _startPosY.Value + 25, 20, 15);
g.FillEllipse(brWheel, _startPosX.Value + 50, _startPosY.Value + 25, 20, 15);
g.FillEllipse(brWheel, _startPosX.Value + 110, _startPosY.Value + 25, 20, 15);
g.FillEllipse(brWheel, _startPosX.Value + 160, _startPosY.Value + 25, 20, 15);
//кузов
Brush br = new SolidBrush(EntityBus.BodyColor);
g.FillRectangle(br, _startPosX.Value, _startPosY.Value, 70, 30);
@ -186,6 +197,11 @@ public class DrawningBus
g.DrawEllipse(penWheel, _startPosX.Value + 50, _startPosY.Value + 25, 20, 15);
g.DrawEllipse(penWheel, _startPosX.Value + 110, _startPosY.Value + 25, 20, 15);
g.DrawEllipse(penWheel, _startPosX.Value + 160, _startPosY.Value + 25, 20, 15);
//двери
Brush brDoor = new SolidBrush(Color.Black);
g.FillRectangle(brDoor, _startPosX.Value + 45, _startPosY.Value + 10, 5, 20);
g.FillRectangle(brDoor, _startPosX.Value + 25, _startPosY.Value + 10, 5, 20);
g.FillRectangle(brDoor, _startPosX.Value + 135, _startPosY.Value + 10, 5, 20);
g.FillRectangle(brDoor, _startPosX.Value + 155, _startPosY.Value + 10, 5, 20);
}
}

View File

@ -16,14 +16,6 @@ public class EntityAccordionBus: EntityBus
/// </summary>
public bool BodyGlass { get; private set; }
/// <summary>
/// Признак (опция) дверей
/// </summary>
public bool BodyDoor { get; private set; }
/// <summary>
/// Признак (опция) наличия дисков
/// </summary>
public bool BodyDisk { get; private set; }
/// <summary>
/// признак наличия гармошки
/// </summary>
public bool BodyGarmoshka { get; private set; }
@ -37,12 +29,10 @@ public class EntityAccordionBus: EntityBus
/// <param name="disk">наличие дисков</param>
/// <param name="garmoshka">наличие гармошки</param>
public EntityAccordionBus(int speed, double weigth, Color bodyColor, Color additionalColor, bool glass, bool door, bool disk, bool garmoshka) : base (speed,weigth,bodyColor)
public EntityAccordionBus(int speed, double weigth, Color bodyColor, Color additionalColor, bool glass, bool garmoshka) : base (speed,weigth,bodyColor)
{
AdditionalColor = additionalColor;
BodyGlass = glass;
BodyDoor = door;
BodyDisk = disk;
BodyGarmoshka = garmoshka;
}
}

View File

@ -64,8 +64,6 @@ public partial class FormAccordionBus : Form
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
Convert.ToBoolean(rnd.Next(0, 2)),
Convert.ToBoolean(rnd.Next(0, 2)),
Convert.ToBoolean(rnd.Next(0, 2)),
Convert.ToBoolean(rnd.Next(0, 2)));
break;
default: