From 4d50d2fa2714634c53de9f555a7fdfa06985dea2 Mon Sep 17 00:00:00 2001 From: GokaPek <109132407+GokaPek@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:57:43 +0400 Subject: [PATCH 1/3] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=B0=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SelfPropelledArtilleryUnit/DrawingSPAU.cs | 19 +++++++-------- .../SelfPropelledArtilleryUnit/EntitySPAU.cs | 24 ++++--------------- .../SelfPropelledArtilleryUnit/Form.cs | 8 +++---- .../SelfPropelledArtilleryUnit/Program.cs | 2 -- 4 files changed, 15 insertions(+), 38 deletions(-) diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawingSPAU.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawingSPAU.cs index 66df303..9b74014 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawingSPAU.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawingSPAU.cs @@ -10,7 +10,7 @@ namespace SelfPropelledArtilleryUnit /// /// Класс, отвечающий за прорисовку и перемещение объекта-сущности /// - public class DrawningSPAU + public class DrawingSPAU { /// /// Класс-сущность @@ -47,14 +47,12 @@ namespace SelfPropelledArtilleryUnit /// Вес /// Цвет кузова /// Дополнительный цвет - /// Признак наличия обвеса - /// Признак наличия антикрыла - /// Признак наличия гоночной полосы + /// Признак наличия залповой установки /// Ширина картинки /// Высота картинки /// true - объект создан, false - проверка не пройдена,нельзя создать объект в этих размерах public bool Init(int speed, double weight, Color bodyColor, Color - additionalColor, bool bodyKit, bool wing, bool sportLine, int width, int height) + additionalColor, bool bodyKit, int width, int height) { _pictureWidth = width; _pictureHeight = height; @@ -68,7 +66,7 @@ namespace SelfPropelledArtilleryUnit } EntitySPAU = new EntitySPAU(); EntitySPAU.Init(speed, weight, bodyColor, additionalColor, - bodyKit, wing, sportLine); + bodyKit); return true; } /// @@ -78,7 +76,6 @@ namespace SelfPropelledArtilleryUnit /// Координата Y public void SetPosition(int x, int y) { - // TODO: Изменение x, y @ if (x < 0 || x > _pictureWidth - _carWidth) { x = 0; @@ -153,7 +150,7 @@ namespace SelfPropelledArtilleryUnit } //гусеницы Brush brBlack = new SolidBrush(Color.Black); - Brush br = new SolidBrush(EntitySPAU.BodyColor); + Brush brBody = new SolidBrush(EntitySPAU.BodyColor); g.FillEllipse(brBlack, _startPosX + 5, _startPosY + 50, 20, 20); g.FillEllipse(brBlack, _startPosX + 30, _startPosY + 50, 20, 20); g.FillEllipse(brBlack, _startPosX + 55, _startPosY + 50, 20, 20); @@ -166,7 +163,7 @@ namespace SelfPropelledArtilleryUnit pointsGun[1].X = _startPosX + 40; pointsGun[1].Y = _startPosY + 45; pointsGun[2].X = _startPosX + 135; pointsGun[2].Y = _startPosY + 5; pointsGun[3].X = _startPosX + 130; pointsGun[3].Y = _startPosY + 0; - g.FillPolygon(br, pointsGun); + g.FillPolygon(brBody, pointsGun); g.DrawPolygon(penBlack, pointsGun); //корпус Point[] pointsCorp = new Point[4]; @@ -174,7 +171,7 @@ namespace SelfPropelledArtilleryUnit pointsCorp[1].X = _startPosX + 10; pointsCorp[1].Y = _startPosY + 30; pointsCorp[2].X = _startPosX + 130; pointsCorp[2].Y = _startPosY + 30; pointsCorp[3].X = _startPosX + 135; pointsCorp[3].Y = _startPosY + 60; - g.FillPolygon(br, pointsCorp); + g.FillPolygon(brBody, pointsCorp); g.DrawPolygon(penBlack, pointsCorp); //башня Point[] pointsHead = new Point[4]; @@ -182,7 +179,7 @@ namespace SelfPropelledArtilleryUnit pointsHead[1].X = _startPosX + 45; pointsHead[1].Y = _startPosY + 15; pointsHead[2].X = _startPosX + 70; pointsHead[2].Y = _startPosY + 15; pointsHead[3].X = _startPosX + 75; pointsHead[3].Y = _startPosY + 30; - g.FillPolygon(br, pointsHead); + g.FillPolygon(brBody, pointsHead); g.DrawPolygon(penBlack, pointsHead); } } diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/EntitySPAU.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/EntitySPAU.cs index 0da6d2a..97c239b 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/EntitySPAU.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/EntitySPAU.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SelfPropelledArtilleryUnit +namespace SelfPropelledArtilleryUnit { public class EntitySPAU { @@ -25,19 +19,11 @@ namespace SelfPropelledArtilleryUnit /// public Color AdditionalColor { get; private set; } /// - /// Признак (опция) наличия обвеса + /// Признак (опция) наличия залповой установки /// public bool BodyKit { get; private set; } /// - /// Признак (опция) наличия антикрыла - /// - public bool Wing { get; private set; } - /// - /// Признак (опция) наличия гоночной полосы - /// - public bool SportLine { get; private set; } - /// - /// Шаг перемещения автомобиля + /// Шаг перемещения САУ /// public double Step => (double)Speed * 100 / Weight; /// @@ -51,15 +37,13 @@ namespace SelfPropelledArtilleryUnit /// Признак наличия антикрыла /// Признак наличия гоночной полосы public void Init(int speed, double weight, Color bodyColor, Color - additionalColor, bool bodyKit, bool wing, bool sportLine) + additionalColor, bool bodyKit) { Speed = speed; Weight = weight; BodyColor = bodyColor; AdditionalColor = additionalColor; BodyKit = bodyKit; - Wing = wing; - SportLine = sportLine; } } } diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs index e91c33f..935f790 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs @@ -5,7 +5,7 @@ namespace SelfPropelledArtilleryUnit /// /// - /// - private DrawningSPAU? _drawningSPAU; + private DrawingSPAU? _drawningSPAU; /// /// /// @@ -38,7 +38,7 @@ namespace SelfPropelledArtilleryUnit private void buttonCreate_Click(object sender, EventArgs e) { Random random = new(); - _drawningSPAU = new DrawningSPAU(); + _drawningSPAU = new DrawingSPAU(); _drawningSPAU.Init(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), @@ -46,8 +46,6 @@ namespace SelfPropelledArtilleryUnit Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), Convert.ToBoolean(random.Next(0, 2)), - Convert.ToBoolean(random.Next(0, 2)), - Convert.ToBoolean(random.Next(0, 2)), pictureBoxSPAU.Width, pictureBoxSPAU.Height); _drawningSPAU.SetPosition(random.Next(10, 100), random.Next(10, 100)); @@ -57,7 +55,7 @@ namespace SelfPropelledArtilleryUnit private void buttonMove_Click(object sender, EventArgs e) { if(_drawningSPAU == null) -{ + { return; } string name = ((Button)sender)?.Name ?? string.Empty; diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Program.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Program.cs index aabba24..960f82b 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Program.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Program.cs @@ -8,8 +8,6 @@ namespace SelfPropelledArtilleryUnit [STAThread] static void Main() { - // To customize application configuration such as set high DPI settings or default font, - // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); Application.Run(new Form()); } -- 2.25.1 From 6b7270aa571a8796427a244ac6124ea156a9b67d Mon Sep 17 00:00:00 2001 From: GokaPek <109132407+GokaPek@users.noreply.github.com> Date: Sat, 21 Oct 2023 17:08:27 +0400 Subject: [PATCH 2/3] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{DrawingSPAU.cs => DrawningSPAU.cs} | 2 +- SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/{DrawingSPAU.cs => DrawningSPAU.cs} (99%) diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawingSPAU.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawningSPAU.cs similarity index 99% rename from SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawingSPAU.cs rename to SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawningSPAU.cs index 9b74014..df4c0df 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawingSPAU.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawningSPAU.cs @@ -10,7 +10,7 @@ namespace SelfPropelledArtilleryUnit /// /// Класс, отвечающий за прорисовку и перемещение объекта-сущности /// - public class DrawingSPAU + public class DrawningSPAU { /// /// Класс-сущность diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs index 935f790..02c87cd 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs @@ -5,7 +5,7 @@ namespace SelfPropelledArtilleryUnit /// /// - /// - private DrawingSPAU? _drawningSPAU; + private DrawningSPAU? _drawningSPAU; /// /// /// @@ -38,7 +38,7 @@ namespace SelfPropelledArtilleryUnit private void buttonCreate_Click(object sender, EventArgs e) { Random random = new(); - _drawningSPAU = new DrawingSPAU(); + _drawningSPAU = new DrawningSPAU(); _drawningSPAU.Init(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), -- 2.25.1 From adb32498b26d3895187a3f81e2c3cee8ef4518af Mon Sep 17 00:00:00 2001 From: GokaPek <109132407+GokaPek@users.noreply.github.com> Date: Sun, 22 Oct 2023 17:03:43 +0400 Subject: [PATCH 3/3] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=84=D0=BB=D0=B8=D0=BA=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{DrawningSPAU.cs => DrawingSPAU.cs} | 2 +- SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/{DrawningSPAU.cs => DrawingSPAU.cs} (99%) diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawningSPAU.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawingSPAU.cs similarity index 99% rename from SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawningSPAU.cs rename to SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawingSPAU.cs index df4c0df..9b74014 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawningSPAU.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawingSPAU.cs @@ -10,7 +10,7 @@ namespace SelfPropelledArtilleryUnit /// /// Класс, отвечающий за прорисовку и перемещение объекта-сущности /// - public class DrawningSPAU + public class DrawingSPAU { /// /// Класс-сущность diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs index 02c87cd..935f790 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs @@ -5,7 +5,7 @@ namespace SelfPropelledArtilleryUnit /// /// - /// - private DrawningSPAU? _drawningSPAU; + private DrawingSPAU? _drawningSPAU; /// /// /// @@ -38,7 +38,7 @@ namespace SelfPropelledArtilleryUnit private void buttonCreate_Click(object sender, EventArgs e) { Random random = new(); - _drawningSPAU = new DrawningSPAU(); + _drawningSPAU = new DrawingSPAU(); _drawningSPAU.Init(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), -- 2.25.1