From c387d6137b5fc6b9e1b8def3c24d998d238e9c5c Mon Sep 17 00:00:00 2001 From: MorozovDanil Date: Mon, 1 Apr 2024 12:07:08 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Drawnings/DrawningContainerShip.cs | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/ProjectContainerShip/ProjectContainerShip/Drawnings/DrawningContainerShip.cs b/ProjectContainerShip/ProjectContainerShip/Drawnings/DrawningContainerShip.cs index dcf70df..4ebbc83 100644 --- a/ProjectContainerShip/ProjectContainerShip/Drawnings/DrawningContainerShip.cs +++ b/ProjectContainerShip/ProjectContainerShip/Drawnings/DrawningContainerShip.cs @@ -19,10 +19,10 @@ public class DrawningContainerShip : DrawningShip /// Признак наличия контейнеров public DrawningContainerShip(int speed, double weight, Color bodyColor, Color additionalColor, bool crane, bool container) : base(125, 60) { - EntityShip = new EntityContainerShip(speed, weight, bodyColor, additionalColor, crane, container); + EntityShip = new EntityContainerShip(speed, weight, bodyColor, additionalColor, crane, container); } /// true - объект создан, false - проверка не пройдена, нельзя создать объект в этих размерах - public override void DrawTransport(Graphics g) + public override void DrawTransport(Graphics g) { if (EntityShip == null || EntityShip is not EntityContainerShip containerShip || !_startPosX.HasValue || !_startPosY.HasValue) { @@ -35,6 +35,18 @@ public class DrawningContainerShip : DrawningShip base.DrawTransport(g); _startPosX -= 5; _startPosY -= 30; + + // контейнеры + if (containerShip.Container) + { + g.DrawRectangle(pen, _startPosX.Value + 60, _startPosY.Value + 55, 40, 5); + g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value + 55, 40, 5); + g.DrawRectangle(pen, _startPosX.Value + 60, _startPosY.Value + 50, 40, 5); + g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value + 50, 40, 5); + g.DrawRectangle(pen, _startPosX.Value + 60, _startPosY.Value + 45, 40, 5); + g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value + 45, 40, 5); + } + // кран if (containerShip.Crane) { @@ -47,16 +59,6 @@ public class DrawningContainerShip : DrawningShip } - // контейнеры - if (containerShip.Container) - { - g.DrawRectangle(pen, _startPosX.Value + 60, _startPosY.Value + 55, 40, 5); - g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value + 55, 40, 5); - g.DrawRectangle(pen, _startPosX.Value + 60, _startPosY.Value + 50, 40, 5); - g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value + 50, 40, 5); - g.DrawRectangle(pen, _startPosX.Value + 60, _startPosY.Value + 45, 40, 5); - g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value + 45, 40, 5); - } _startPosX += 5; _startPosY += 30;