From 801caf48d30b903b2a52d8d1899de91999ccfda0 Mon Sep 17 00:00:00 2001 From: Almaz <79022113685@mail.ru> Date: Wed, 10 Apr 2024 00:34:32 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=80=D0=B8=D1=81?= =?UTF-8?q?=D0=BE=D0=B2=D0=BA=D0=B0=20=D0=BA=D1=80=D0=B5=D0=B9=D1=81=D0=B5?= =?UTF-8?q?=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Drawings/DrawningCruiser.cs | 31 ++++++----- .../Drawings/DrawningMilitaryCruiser.cs | 51 +++++++++---------- 2 files changed, 38 insertions(+), 44 deletions(-) diff --git a/ProjectCruiser/ProjectCruiser/Drawings/DrawningCruiser.cs b/ProjectCruiser/ProjectCruiser/Drawings/DrawningCruiser.cs index ea8c06f..7fee537 100644 --- a/ProjectCruiser/ProjectCruiser/Drawings/DrawningCruiser.cs +++ b/ProjectCruiser/ProjectCruiser/Drawings/DrawningCruiser.cs @@ -34,11 +34,11 @@ public class DrawningCruiser /// /// Ширина прорисовки крейсера /// - private readonly int _drawningCruiserWidth = 90; + private readonly int _drawningCruiserWidth = 180; /// /// Высота прорисовки крейсера /// - private readonly int _drawingCruiserHeight = 50; + private readonly int _drawingCruiserHeight = 70; /// /// Координата X объекта @@ -158,21 +158,20 @@ public class DrawningCruiser Pen pen = new(Color.Black); + // Основной корпус крейсера + Brush Brush = new + SolidBrush(EntityCruiser.BodyColor); - //Границы крейсера - g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value, 20, 20); - g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 30, 20, 20); - g.DrawEllipse(pen, _startPosX.Value + 70, _startPosY.Value, 20, 20); - g.DrawEllipse(pen, _startPosX.Value + 70, _startPosY.Value + 30, 20, 20); - g.DrawRectangle(pen, _startPosX.Value + 1, _startPosY.Value + 10, 10, 30); - g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value + 10, 10, 30); - g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 1, 70, 52); - - //кузов крейсера - Brush br = new SolidBrush(EntityCruiser.BodyColor); - g.FillRectangle(br, _startPosX.Value, _startPosY.Value + 10, 10, 30); - g.FillRectangle(br, _startPosX.Value + 80, _startPosY.Value + 10, 10, 30); - g.FillRectangle(br, _startPosX.Value + 10, _startPosY.Value, 70, 50); + Point[] hull = new Point[] + { + new Point((int)(_startPosX + 5), (int)(_startPosY + 10)), + new Point((int)(_startPosX + 110), (int)(_startPosY + 10)), + new Point((int)(_startPosX + 170), (int)(_startPosY + 40)), + new Point((int)(_startPosX + 110), (int)(_startPosY + 60)), + new Point((int)(_startPosX + 5), (int)(_startPosY + 60)) + }; + g.FillPolygon(Brush, hull); + g.DrawPolygon(pen, hull); } } diff --git a/ProjectCruiser/ProjectCruiser/Drawings/DrawningMilitaryCruiser.cs b/ProjectCruiser/ProjectCruiser/Drawings/DrawningMilitaryCruiser.cs index b86968c..9409d28 100644 --- a/ProjectCruiser/ProjectCruiser/Drawings/DrawningMilitaryCruiser.cs +++ b/ProjectCruiser/ProjectCruiser/Drawings/DrawningMilitaryCruiser.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -19,7 +20,7 @@ public class DrawningMilitaryCruiser: DrawningCruiser /// Признак наличия обвеса /// Признак наличия брони /// Признак наличия оружия - public DrawningMilitaryCruiser(int speed, double weigth, Color bodyColor, Color additionalColor, bool bodyKit, bool armor, bool weapon): base(110, 60) + public DrawningMilitaryCruiser(int speed, double weigth, Color bodyColor, Color additionalColor, bool bodyKit, bool armor, bool weapon): base(180, 70) { EntityCruiser = new EntityMilitaryCruiser(speed, weigth, bodyColor, additionalColor, bodyKit, armor, weapon); } @@ -33,36 +34,30 @@ public class DrawningMilitaryCruiser: DrawningCruiser } Pen pen = new(Color.Black); - Brush additionalBrush = new SolidBrush(militaryCruiser.AdditionalColor); - //Границы крейсера - g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 5, 20, 20); - g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 35, 20, 20); - g.DrawEllipse(pen, _startPosX.Value + 80, _startPosY.Value + 5, 20, 20); - g.DrawEllipse(pen, _startPosX.Value + 80, _startPosY.Value + 35, 20, 20); - g.DrawRectangle(pen, _startPosX.Value + 9, _startPosY.Value + 15, 10, 30); - g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value + 15, 10, 30); - g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 4, 70, 52); + // Основной корпус парусника + Brush brush = new SolidBrush(militaryCruiser.BodyColor); - //кузов крейсера - Brush br = new SolidBrush(militaryCruiser.BodyColor); - g.FillRectangle(br, _startPosX.Value + 10, _startPosY.Value + 15, 10, 30); - g.FillRectangle(br, _startPosX.Value + 90, _startPosY.Value + 15, 10, 30); - g.FillRectangle(br, _startPosX.Value + 20, _startPosY.Value + 5, 70, 50); - - _startPosX += 10; - _startPosY += 5; - base.DrawTransport(g); - _startPosX -= 10; - _startPosY -= 5; - - // оружие крейсера - if (militaryCruiser.Weapon) + Point[] hull = new Point[] { - g.FillRectangle(additionalBrush, _startPosX.Value + 75, _startPosY.Value + 23, 25, 15); - g.FillRectangle(additionalBrush, _startPosX.Value + 35, _startPosY.Value + 23, 35, 15); - g.FillRectangle(additionalBrush, _startPosX.Value + 10, _startPosY.Value + 23, 20, 15); + new Point((int)(_startPosX + 5), (int)(_startPosY + 10)), + new Point((int)(_startPosX + 110), (int)(_startPosY + 10)), + new Point((int)(_startPosX + 170), (int)(_startPosY + 40)), + new Point((int)(_startPosX + 110), (int)(_startPosY + 60)), + new Point((int)(_startPosX + 5), (int)(_startPosY + 60)) + }; + g.FillPolygon(brush, hull); + g.DrawPolygon(pen, hull); + base.DrawTransport(g); + + //Взлетная полоса + Brush additionalBrush = new SolidBrush(militaryCruiser.AdditionalColor); + g.FillEllipse(additionalBrush, (int)(_startPosX + 100), (int)(_startPosY + 25), 20, 20); + g.DrawEllipse(pen, (int)(_startPosX + 100), (int)(_startPosY + 25), 20, 20); + + //Рокетная шахта + g.FillRectangle(additionalBrush, (int)(_startPosX + 70), (int)(_startPosY + 20), 20, 30); + g.FillRectangle(additionalBrush, (int)(_startPosX + 40), (int)(_startPosY + 27), 30, 15); - } } }