From 3348c036dd89e2e00cd0bd84ba052340a0e40bb2 Mon Sep 17 00:00:00 2001 From: BoiledMilk123 Date: Mon, 11 Mar 2024 23:38:42 +0400 Subject: [PATCH 1/8] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=80=D0=BE=D0=B4=D0=B8=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=B8=20=D0=B2=D0=B2=D0=BE=D0=B4=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82=D0=BE=D1=80=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Project1/Project1.sln | 31 +++ Project1/Project1/Project1.vcxproj | 135 +++++++++++ Project1/Project1/Project1.vcxproj.filters | 22 ++ Project1/Project1/sove.cpp | 56 +++++ .../{ => Drawnings}/DirectionType.cs | 2 +- .../Drawnings/DrawningElectricLocomotive.cs | 84 +++++++ .../DrawningLocomotive.cs} | 210 +++++++++--------- .../EntityElectricLocomotive.cs | 32 +-- .../Entities/EntityLocomotive.cs | 45 ++++ .../FormElectricLocomotive.Designer.cs | 20 +- .../FormElectricLocomotive.cs | 68 ++++-- 11 files changed, 540 insertions(+), 165 deletions(-) create mode 100644 Project1/Project1.sln create mode 100644 Project1/Project1/Project1.vcxproj create mode 100644 Project1/Project1/Project1.vcxproj.filters create mode 100644 Project1/Project1/sove.cpp rename ProjectElectricLocomotive/ProjectElectricLocomotive/{ => Drawnings}/DirectionType.cs (90%) create mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningElectricLocomotive.cs rename ProjectElectricLocomotive/ProjectElectricLocomotive/{DrawningElectricLocomotive.cs => Drawnings/DrawningLocomotive.cs} (57%) rename ProjectElectricLocomotive/ProjectElectricLocomotive/{ => Entities}/EntityElectricLocomotive.cs (57%) create mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/Entities/EntityLocomotive.cs diff --git a/Project1/Project1.sln b/Project1/Project1.sln new file mode 100644 index 0000000..4149998 --- /dev/null +++ b/Project1/Project1.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34024.191 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project1", "Project1\Project1.vcxproj", "{51322AFD-5D22-49A7-BC85-AC24DACBAEE8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Debug|x64.ActiveCfg = Debug|x64 + {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Debug|x64.Build.0 = Debug|x64 + {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Debug|x86.ActiveCfg = Debug|Win32 + {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Debug|x86.Build.0 = Debug|Win32 + {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Release|x64.ActiveCfg = Release|x64 + {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Release|x64.Build.0 = Release|x64 + {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Release|x86.ActiveCfg = Release|Win32 + {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {188BD3AE-A59B-46F9-AEC9-A67BF38B0430} + EndGlobalSection +EndGlobal diff --git a/Project1/Project1/Project1.vcxproj b/Project1/Project1/Project1.vcxproj new file mode 100644 index 0000000..96fe319 --- /dev/null +++ b/Project1/Project1/Project1.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {51322afd-5d22-49a7-bc85-ac24dacbaee8} + Project1 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/Project1/Project1/Project1.vcxproj.filters b/Project1/Project1/Project1.vcxproj.filters new file mode 100644 index 0000000..61be7de --- /dev/null +++ b/Project1/Project1/Project1.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/Project1/Project1/sove.cpp b/Project1/Project1/sove.cpp new file mode 100644 index 0000000..e966ec7 --- /dev/null +++ b/Project1/Project1/sove.cpp @@ -0,0 +1,56 @@ +#define _USE_MATH_DEFINES +#define _CRT_SECURE_NO_WARNINGS +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace std; + + +typedef long long ll; +typedef unsigned long long ull; +typedef unsigned int uint; +typedef long double ld; +typedef pair pll; +typedef pair pii; + + +const ll LINF = 100090009990; +const int INF = 1009000999; +const int N = 1002; +const int M = 1002; +const ld PI = 3.1415926535; +const ld E = 2.7182818284; +const ll MOD = 1000000007; +const int MAX = 150010; +const ld EPS = 1e-10; + + + + +int main() +{ + vector Buttons{ "A", "B","C", "D", "L1", "L2", "R1", "R2" }; + vector ButtonsAns{ "A", "B","C", "D", "L1", "L2", "R1", "R2" }; + vector used, unused; + int stick; + + + return 0; +} \ No newline at end of file diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/DirectionType.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DirectionType.cs similarity index 90% rename from ProjectElectricLocomotive/ProjectElectricLocomotive/DirectionType.cs rename to ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DirectionType.cs index 17ab51c..44c4914 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/DirectionType.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DirectionType.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace ProjectElectricLocomotive; +namespace ProjectElectricLocomotive.Drawnings; public enum DirectionType { diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningElectricLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningElectricLocomotive.cs new file mode 100644 index 0000000..aafc9d9 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningElectricLocomotive.cs @@ -0,0 +1,84 @@ + +using ProjectElectricLocomotive.Entities; + +namespace ProjectElectricLocomotive.Drawnings; + +/// +/// Класс, отвечающий за прорисовку и перемещение объекта - сущности +/// +public class DrawningElectricLocomotive : DrawningLocomotive +{ + /// + /// Конструктор + /// + /// + /// + /// + /// + /// + /// + /// + public DrawningElectricLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, bool electricHorns, bool batteryPlacement) : base(83,45) + { + EntityLocomotive = new EntityElectricLocomotive(speed, weight, bodyColor, additionalColor, electricHorns, batteryPlacement); + } + + public override void DrawTransport(Graphics g) + { + if (EntityLocomotive == null || EntityLocomotive is not EntityElectricLocomotive electricLocomotive || !_startPosX.HasValue || !_startPosY.HasValue) + { + return; + } + + //Создание перьев и кистей для прорисовки электровоза + Brush blackBrush = new SolidBrush(Color.Black); + Pen penSolid = new(Color.Black, 2); + Pen penSolidYellow = new(Color.Yellow, 0.5f); + Brush additionalBrush = new SolidBrush(electricLocomotive.AdditionalColor); + + //Прорисовка дополнительного элемента (рогов) + if (electricLocomotive.ElectricHorns) + { + + + //Инициализация опорных точек для прорисовки "рогов" + Point pointHorns1 = new Point(_startPosX.Value + 13, _startPosY.Value + 5); + Point pointHorns2 = new Point(_startPosX.Value + 16, _startPosY.Value + 2); + Point pointHorns3 = new Point(_startPosX.Value + 11, _startPosY.Value); + + //Прорисовка "рогов" электровоза + g.DrawLine(penSolid, pointHorns1, pointHorns2); + g.DrawLine(penSolid, pointHorns2, pointHorns3); + } + //Прорисовка дополнительного элемента (места под батарею) + if (electricLocomotive.BatteryPlacement) + { + //Инициализация опорных точек для прорисовки молнии на хранилище батарей + Point pointLightning1 = new Point(_startPosX.Value + 39, _startPosY.Value + 37); + Point pointLightning2 = new Point(_startPosX.Value + 37, _startPosY.Value + 39); + Point pointLightning3 = new Point(_startPosX.Value + 39, _startPosY.Value + 40); + Point pointLightning4 = new Point(_startPosX.Value + 37, _startPosY.Value + 41); + + //Прорисовка "хранилища батарей" электровоза + g.FillRectangle(blackBrush, _startPosX.Value + 36, _startPosY.Value + 37, 8, 4.5f); + g.DrawLine(penSolidYellow, pointLightning1, pointLightning2); + g.DrawLine(penSolidYellow, pointLightning2, pointLightning3); + g.DrawLine(penSolidYellow, pointLightning3, pointLightning4); + + } + + _startPosY += 5; + base.DrawTransport(g); + _startPosY -= 5; + + //Опциональная прорисовка цвета передних колёс + g.FillEllipse(additionalBrush, _startPosX.Value + 9, _startPosY.Value + 37, 8, 8); + g.FillEllipse(additionalBrush, _startPosX.Value + 24, _startPosY.Value + 37, 8, 8); + + //Опциональная прорисовка цвета задних колёс + g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 26, _startPosY.Value + 37, 8, 8); + g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 37, _startPosY.Value + 37, 8, 8); + + } + +} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/DrawningElectricLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs similarity index 57% rename from ProjectElectricLocomotive/ProjectElectricLocomotive/DrawningElectricLocomotive.cs rename to ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs index b3298c0..a5afd18 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/DrawningElectricLocomotive.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs @@ -1,15 +1,18 @@ - -namespace ProjectElectricLocomotive; +using ProjectElectricLocomotive.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; -/// -/// Класс, отвечающий за прорисовку и перемещение объекта - сущности -/// -public class DrawningElectricLocomotive +namespace ProjectElectricLocomotive.Drawnings; + +public class DrawningLocomotive { /// /// Класс-сущность /// - public EntityElectricLocomotive? EntityElectricLocomotive { get; private set; } + public EntityLocomotive? EntityLocomotive { get; protected set; } /// /// Ширина окна @@ -22,47 +25,59 @@ public class DrawningElectricLocomotive private int? _pictureHeight; /// - /// Левая координата прорисовки электровоза + /// Левая координата прорисовки локомотива /// - private int? _startPosX; + protected int? _startPosX; /// - /// Верхняя координата прорисовки электровоза + /// Верхняя координата прорисовки локомотива /// - private int? _startPosY; + protected int? _startPosY; /// - /// Ширина прорисовки электровоза + /// Ширина прорисовки локомотива /// private readonly int _drawningElectricLocomotiveWidth = 83; /// - /// Высота прорисовки электровоза + /// Высота прорисовки локомотива /// - private readonly int _drawningElectricLocomotiveHeight = 45; + private readonly int _drawningElectricLocomotiveHeight = 40; /// - /// Инициализация свойств + /// Пустой конструктор /// - /// - /// - /// - /// - /// - /// - /// - public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool electricHorns, bool batteryPlacement) + private DrawningLocomotive() { - EntityElectricLocomotive = new EntityElectricLocomotive(); - - EntityElectricLocomotive.Init(speed, weight, bodyColor, additionalColor, electricHorns, batteryPlacement); _pictureWidth = null; _pictureHeight = null; _startPosX = null; _startPosY = null; } + /// + /// Конструктор + /// + /// + /// + /// + public DrawningLocomotive(int speed, double weight, Color bodyColor) : this() + { + EntityLocomotive = new EntityLocomotive(speed, weight, bodyColor); + } + + /// + /// Конструктор для наследников + /// + /// Ширина прорисовки локомотива + /// Высота прорисовки локомотива + protected DrawningLocomotive(int drawningElectricLocomotiveWidth, int drawningElectricLocomotiveHeight) : this() + { + _drawningElectricLocomotiveWidth = drawningElectricLocomotiveWidth; + _drawningElectricLocomotiveHeight = drawningElectricLocomotiveHeight; + } + /// /// Установка границ поля /// @@ -71,17 +86,17 @@ public class DrawningElectricLocomotive /// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах public bool SetPictureSize(int width, int height) { - if(_drawningElectricLocomotiveHeight > height || _drawningElectricLocomotiveWidth > width) + if (_drawningElectricLocomotiveHeight > height || _drawningElectricLocomotiveWidth > width) { return false; } _pictureWidth = width; _pictureHeight = height; - if (_startPosY.HasValue && _startPosY + _drawningElectricLocomotiveHeight < _pictureHeight ) + if (_startPosY.HasValue && _startPosY + _drawningElectricLocomotiveHeight < _pictureHeight) { - _startPosY = _pictureHeight - _drawningElectricLocomotiveHeight; + _startPosY = _pictureHeight - _drawningElectricLocomotiveHeight; } - if (_startPosX.HasValue && _startPosX + _drawningElectricLocomotiveWidth < _pictureWidth ) + if (_startPosX.HasValue && _startPosX + _drawningElectricLocomotiveWidth < _pictureWidth) { _startPosX = _pictureWidth - _drawningElectricLocomotiveWidth; } @@ -95,7 +110,8 @@ public class DrawningElectricLocomotive /// Координата Y public void SetPosition(int x, int y) { - if(!_pictureHeight.HasValue || !_pictureWidth.HasValue) { + if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) + { return; } @@ -104,12 +120,12 @@ public class DrawningElectricLocomotive _startPosY = y; - - if ( _drawningElectricLocomotiveHeight + y > _pictureHeight) + + if (_drawningElectricLocomotiveHeight + y > _pictureHeight) { _startPosY = _pictureHeight - _drawningElectricLocomotiveHeight; } - if ( _drawningElectricLocomotiveWidth + x > _pictureWidth) + if (_drawningElectricLocomotiveWidth + x > _pictureWidth) { _startPosX = _pictureWidth - _drawningElectricLocomotiveWidth; } @@ -133,39 +149,39 @@ public class DrawningElectricLocomotive /// true - перемещение выполнено, false - перемещение невозможно public bool MoveTransport(DirectionType direction) { - if(EntityElectricLocomotive == null || !_startPosX.HasValue || !_startPosY.HasValue) + if (EntityLocomotive == null || !_startPosX.HasValue || !_startPosY.HasValue) { return false; } - switch(direction) + switch (direction) { //влево case DirectionType.Left: - if(_startPosX.Value - EntityElectricLocomotive.Step > 0) + if (_startPosX.Value - EntityLocomotive.Step > 0) { - _startPosX -= (int)EntityElectricLocomotive.Step; + _startPosX -= (int)EntityLocomotive.Step; } return true; //вверх case DirectionType.Up: - if(_startPosY.Value - EntityElectricLocomotive.Step > 0) + if (_startPosY.Value - EntityLocomotive.Step > 0) { - _startPosY -= (int)EntityElectricLocomotive.Step; - } + _startPosY -= (int)EntityLocomotive.Step; + } return true; //вправо case DirectionType.Right: - if (_startPosX.Value + _drawningElectricLocomotiveWidth + EntityElectricLocomotive.Step < _pictureWidth) + if (_startPosX.Value + _drawningElectricLocomotiveWidth + EntityLocomotive.Step < _pictureWidth) { - _startPosX += (int)EntityElectricLocomotive.Step; + _startPosX += (int)EntityLocomotive.Step; } return true; //вниз case DirectionType.Down: - if (_startPosY.Value + _drawningElectricLocomotiveHeight + EntityElectricLocomotive.Step < _pictureHeight) + if (_startPosY.Value + _drawningElectricLocomotiveHeight + EntityLocomotive.Step < _pictureHeight) { - _startPosY += (int)EntityElectricLocomotive.Step; + _startPosY += (int)EntityLocomotive.Step; } return true; default: @@ -177,9 +193,9 @@ public class DrawningElectricLocomotive /// Прорисовка объекта /// /// - public void DrawTransport(Graphics g) + public virtual void DrawTransport(Graphics g) { - if (EntityElectricLocomotive == null || !_startPosX.HasValue || !_startPosY.HasValue) + if (EntityLocomotive == null || !_startPosX.HasValue || !_startPosY.HasValue) { return; } @@ -189,34 +205,33 @@ public class DrawningElectricLocomotive Pen penSolid = new(Color.Black, 2); Pen penSolidYellow = new(Color.Yellow, 0.5f); Pen windowPen = new(Color.DeepSkyBlue); - Brush additionalBrush = new SolidBrush(EntityElectricLocomotive.AdditionalColor); Brush blackBrush = new SolidBrush(Color.Black); Brush whiteBrush = new SolidBrush(Color.White); //Инициализация опорных точек для прорисовки корпуса - Point pointStart = new Point(_startPosX.Value + 75, _startPosY.Value + 20); - Point point1 = new Point(_startPosX.Value + 75, _startPosY.Value + 5); - Point point2 = new Point(_startPosX.Value + 10, _startPosY.Value + 5); - Point pointFinish = new Point(_startPosX.Value + 5, _startPosY.Value + 20); + Point pointStart = new Point(_startPosX.Value + 75, _startPosY.Value + 15); + Point point1 = new Point(_startPosX.Value + 75, _startPosY.Value); + Point point2 = new Point(_startPosX.Value + 10, _startPosY.Value); + Point pointFinish = new Point(_startPosX.Value + 5, _startPosY.Value + 15); //Инициализация опорных точек для прорисовки первой "юбки" - Point point3 = new Point(_startPosX.Value + 7, _startPosY.Value + 37); - Point point4 = new Point(_startPosX.Value + 0, _startPosY.Value + 37 +6 ); - Point point5 = new Point(_startPosX.Value + 7, _startPosY.Value + 37 + 6 ); + Point point3 = new Point(_startPosX.Value + 7, _startPosY.Value + 32); + Point point4 = new Point(_startPosX.Value, _startPosY.Value + 32 + 6); + Point point5 = new Point(_startPosX.Value + 7, _startPosY.Value + 32 + 6); //Инициализация опорных точек для прорисовки второй "юбки" - Point point6 = new Point(_startPosX.Value + 69, _startPosY.Value + 37); - Point point7 = new Point(_startPosX.Value + 75 + 7, _startPosY.Value + 37 + 6); - Point point8 = new Point(_startPosX.Value + 69, _startPosY.Value + 37 + 6); - + Point point6 = new Point(_startPosX.Value + 69, _startPosY.Value + 32); + Point point7 = new Point(_startPosX.Value + 75 + 7, _startPosY.Value + 32 + 6); + Point point8 = new Point(_startPosX.Value + 69, _startPosY.Value + 32 + 6); + //Совокупность точек полигона уголка первой "юбки" Point[] firstTrianglePoints = { - + point3, point4, point5, - + }; //Совокупность точек полигона уголка второй "юбки" Point[] secondTrianglePoints = @@ -233,77 +248,50 @@ public class DrawningElectricLocomotive g.FillPolygon(blackBrush, secondTrianglePoints); //Прорисовка корпуса - g.DrawRectangle(pen, _startPosX.Value + 5, _startPosY.Value + 20, 70, 17); + g.DrawRectangle(pen, _startPosX.Value + 5, _startPosY.Value + 15, 70, 17); g.DrawLine(pen, point3, point4); - + g.DrawLine(pen, pointStart, point1); g.DrawLine(pen, point1, point2); g.DrawLine(pen, point2, pointFinish); Brush brWhite = new SolidBrush(Color.White); - g.DrawRectangle(windowPen, _startPosX.Value + 24.3f, _startPosY.Value + 9, 8, 8); + g.DrawRectangle(windowPen, _startPosX.Value + 24.3f, _startPosY.Value + 4, 8, 8); - g.DrawRectangle(pen, _startPosX.Value + 35, _startPosY.Value + 14, 8, 12); + g.DrawRectangle(pen, _startPosX.Value + 35, _startPosY.Value + 9, 8, 12); - g.FillRectangle(brWhite, _startPosX.Value + 36, _startPosY.Value + 16, 7, 10); + g.FillRectangle(brWhite, _startPosX.Value + 36, _startPosY.Value + 11, 7, 10); //Прорисовка передней и задней "юбки" - g.FillRectangle(blackBrush, _startPosX.Value + 7, _startPosY.Value + 37, 25, 5.3f); - g.FillRectangle(blackBrush, _startPosX.Value + 47, _startPosY.Value + 37, 22, 5.3f); + g.FillRectangle(blackBrush, _startPosX.Value + 7, _startPosY.Value + 32, 25, 5.3f); + g.FillRectangle(blackBrush, _startPosX.Value + 47, _startPosY.Value + 32, 22, 5.3f); //Прорисовка двух передних колёс - g.FillEllipse(whiteBrush, _startPosX.Value + 6.3f, _startPosY.Value + 37, 10, 10); - g.DrawEllipse(penSolid, _startPosX.Value + 9, _startPosY.Value + 37, 8, 8); - g.FillEllipse(additionalBrush, _startPosX.Value + 9, _startPosY.Value + 37, 8, 8); - g.DrawEllipse(penSolid, _startPosX.Value + 24, _startPosY.Value + 37, 8, 8); - g.FillEllipse(additionalBrush, _startPosX.Value + 24, _startPosY.Value + 37, 8, 8); + g.FillEllipse(whiteBrush, _startPosX.Value + 6.3f, _startPosY.Value + 32, 10, 10); + g.DrawEllipse(penSolid, _startPosX.Value + 9, _startPosY.Value + 32, 8, 8); + g.DrawEllipse(penSolid, _startPosX.Value + 24, _startPosY.Value + 32, 8, 8); + //Прорисовка двух задних колёс - g.FillEllipse(whiteBrush, _startPosX.Value + 25 + 38, _startPosY.Value + 37, 10, 10); - g.DrawEllipse(penSolid, _startPosX.Value + 25 + 26, _startPosY.Value + 37, 8, 8); - g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 26, _startPosY.Value + 37, 8, 8); - g.DrawEllipse(penSolid, _startPosX.Value+ 25 + 37, _startPosY.Value + 37, 8, 8); - g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 37, _startPosY.Value + 37, 8, 8); + g.FillEllipse(whiteBrush, _startPosX.Value + 25 + 38, _startPosY.Value + 32, 10, 10); + g.DrawEllipse(penSolid, _startPosX.Value + 25 + 26, _startPosY.Value + 32, 8, 8); + g.DrawEllipse(penSolid, _startPosX.Value + 25 + 37, _startPosY.Value + 32, 8, 8); //Прорисовка заднего "шлюза" - g.FillRectangle(blackBrush, _startPosX.Value + 75, _startPosY.Value + 9, 5.7f, 27.4f); + g.FillRectangle(blackBrush, _startPosX.Value + 75, _startPosY.Value + 4, 5.7f, 27.4f); //Прорисовка первого и третьего окна - g.DrawRectangle(windowPen, _startPosX.Value + 12, _startPosY.Value + 9, 8, 8); - g.DrawRectangle(windowPen, _startPosX.Value + 63, _startPosY.Value + 9, 8, 8); + g.DrawRectangle(windowPen, _startPosX.Value + 12, _startPosY.Value + 4, 8, 8); + g.DrawRectangle(windowPen, _startPosX.Value + 63, _startPosY.Value + 4, 8, 8); + //Опциональная прорисовка цвета передних колёс + g.FillEllipse(whiteBrush, _startPosX.Value + 9, _startPosY.Value + 32, 8, 8); + g.FillEllipse(whiteBrush, _startPosX.Value + 24, _startPosY.Value + 32, 8, 8); - - if (EntityElectricLocomotive.ElectricHorns) - { - - - //Инициализация опорных точек для прорисовки "рогов" - Point pointHorns1 = new Point(_startPosX.Value + 13, _startPosY.Value + 5); - Point pointHorns2 = new Point(_startPosX.Value + 16, _startPosY.Value + 2); - Point pointHorns3 = new Point(_startPosX.Value + 11, _startPosY.Value); - - //Прорисовка "рогов" электровоза - g.DrawLine(penSolid, pointHorns1, pointHorns2); - g.DrawLine(penSolid, pointHorns2, pointHorns3); - } - if(EntityElectricLocomotive.BatteryPlacement) - { - //Инициализация опорных точек для прорисовки молнии на хранилище батарей - Point pointLightning1 = new Point(_startPosX.Value + 39, _startPosY.Value + 37); - Point pointLightning2 = new Point(_startPosX.Value + 37, _startPosY.Value + 39); - Point pointLightning3 = new Point(_startPosX.Value + 39, _startPosY.Value + 40); - Point pointLightning4 = new Point(_startPosX.Value + 37, _startPosY.Value + 41); - - //Прорисовка "хранилища батарей" электровоза - g.FillRectangle(blackBrush, _startPosX.Value + 36, _startPosY.Value + 37, 8, 4.5f); - g.DrawLine(penSolidYellow, pointLightning1, pointLightning2); - g.DrawLine(penSolidYellow, pointLightning2, pointLightning3); - g.DrawLine(penSolidYellow, pointLightning3, pointLightning4); - - } - + //Опциональная прорисовка цвета задних колёс + g.FillEllipse(whiteBrush, _startPosX.Value + 25 + 26, _startPosY.Value + 32, 8, 8); + g.FillEllipse(whiteBrush, _startPosX.Value + 25 + 37, _startPosY.Value + 32, 8, 8); } } diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/EntityElectricLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Entities/EntityElectricLocomotive.cs similarity index 57% rename from ProjectElectricLocomotive/ProjectElectricLocomotive/EntityElectricLocomotive.cs rename to ProjectElectricLocomotive/ProjectElectricLocomotive/Entities/EntityElectricLocomotive.cs index 0a3040f..9c0ac12 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/EntityElectricLocomotive.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Entities/EntityElectricLocomotive.cs @@ -1,26 +1,11 @@  -namespace ProjectElectricLocomotive; +namespace ProjectElectricLocomotive.Entities; /// -/// Класс-сущность "Тепловоз" +/// Класс-сущность "Электровоз" /// -public class EntityElectricLocomotive +public class EntityElectricLocomotive : EntityLocomotive { - /// - /// Скорость - /// - public int Speed { get; private set; } - - /// - /// Вес - /// - public double Weight { get; private set; } - - /// - /// Основной цвет - /// - public Color BodyColor { get; private set; } - /// /// Дополнительный цвет (для дополнительных элементов) /// @@ -36,11 +21,6 @@ public class EntityElectricLocomotive /// public bool BatteryPlacement { get; private set; } - /// - /// Шаг перемещения объекта - /// - public double Step => Speed * 100 / Weight; - /// /// Инициализация полей объекта-класса тепловоза /// @@ -51,14 +31,10 @@ public class EntityElectricLocomotive /// /// - public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool electricHorns, bool batteryPlacement) + public EntityElectricLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, bool electricHorns, bool batteryPlacement) : base(speed, weight, bodyColor) { - Speed = speed; - Weight = weight; - BodyColor = bodyColor; AdditionalColor = additionalColor; ElectricHorns = electricHorns; BatteryPlacement = batteryPlacement; - } } diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Entities/EntityLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Entities/EntityLocomotive.cs new file mode 100644 index 0000000..52007b7 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Entities/EntityLocomotive.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectElectricLocomotive.Entities; +/// +/// Класс-сущность "Локомотив" +/// +public class EntityLocomotive +{ + /// + /// Скорость + /// + public int Speed { get; private set; } + + /// + /// Вес + /// + public double Weight { get; private set; } + + /// + /// Основной цвет + /// + public Color BodyColor { get; private set; } + + /// + /// Шаг перемещения объекта + /// + public double Step => Speed * 100 / Weight; + + /// + /// Конструктор сущности + /// + /// + /// + /// + public EntityLocomotive(int speed, double weight, Color bodyColor) + { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + } +} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.Designer.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.Designer.cs index 577dbcc..dcf94c2 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.Designer.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.Designer.cs @@ -34,6 +34,7 @@ buttonDown = new Button(); buttonRight = new Button(); buttonUp = new Button(); + buttonCreateLocomotive = new Button(); ((System.ComponentModel.ISupportInitialize)pictureBoxElectricLocomotive).BeginInit(); SuspendLayout(); // @@ -49,11 +50,11 @@ // buttonCreate // buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; - buttonCreate.Location = new Point(12, 430); + buttonCreate.Location = new Point(12, 436); buttonCreate.Name = "buttonCreate"; - buttonCreate.Size = new Size(104, 37); + buttonCreate.Size = new Size(150, 31); buttonCreate.TabIndex = 1; - buttonCreate.Text = "Создать"; + buttonCreate.Text = "Создать электровоз"; buttonCreate.UseVisualStyleBackColor = true; buttonCreate.Click += ButtonCreate_Click; // @@ -109,11 +110,23 @@ buttonUp.UseVisualStyleBackColor = false; buttonUp.Click += ButtonMove_Click; // + // buttonCreateLocomotive + // + buttonCreateLocomotive.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonCreateLocomotive.Location = new Point(187, 436); + buttonCreateLocomotive.Name = "buttonCreateLocomotive"; + buttonCreateLocomotive.Size = new Size(150, 31); + buttonCreateLocomotive.TabIndex = 6; + buttonCreateLocomotive.Text = "Создать локомотив"; + buttonCreateLocomotive.UseVisualStyleBackColor = true; + buttonCreateLocomotive.Click += buttonCreateLocomotive_Click; + // // FormElectricLocomotive // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(866, 479); + Controls.Add(buttonCreateLocomotive); Controls.Add(buttonUp); Controls.Add(buttonRight); Controls.Add(buttonDown); @@ -134,5 +147,6 @@ private Button buttonDown; private Button buttonRight; private Button buttonUp; + private Button buttonCreateLocomotive; } } \ No newline at end of file diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs index d788b47..52bc870 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs @@ -1,4 +1,5 @@ -using System; +using ProjectElectricLocomotive.Drawnings; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -12,7 +13,7 @@ namespace ProjectElectricLocomotive; public partial class FormElectricLocomotive : Form { - private DrawningElectricLocomotive? _drawningElectricLocomotive; + private DrawningLocomotive? _drawningLocomotive; public FormElectricLocomotive() { @@ -24,34 +25,55 @@ public partial class FormElectricLocomotive : Form /// private void Draw() { - if (_drawningElectricLocomotive == null) + if (_drawningLocomotive == null) { return; } Bitmap bmp = new(pictureBoxElectricLocomotive.Width, pictureBoxElectricLocomotive.Height); Graphics gr = Graphics.FromImage(bmp); - _drawningElectricLocomotive.DrawTransport(gr); + _drawningLocomotive.DrawTransport(gr); pictureBoxElectricLocomotive.Image = bmp; } - private void ButtonCreate_Click(object sender, EventArgs e) + private void CreateObject(string type) { Random random = new(); - _drawningElectricLocomotive = new DrawningElectricLocomotive(); - _drawningElectricLocomotive.Init(random.Next(100, 300), random.Next(1000, 3000), - Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), - 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))); - _drawningElectricLocomotive.SetPictureSize(pictureBoxElectricLocomotive.Width, pictureBoxElectricLocomotive.Height); - _drawningElectricLocomotive.SetPosition(random.Next(0,pictureBoxElectricLocomotive.Width), random.Next(0,pictureBoxElectricLocomotive.Height)); - - Bitmap bmp = new(pictureBoxElectricLocomotive.Width, pictureBoxElectricLocomotive.Height); - Graphics gr = Graphics.FromImage(bmp); - _drawningElectricLocomotive.DrawTransport(gr); - pictureBoxElectricLocomotive.Image = bmp; + switch (type) + { + case nameof(DrawningLocomotive): + _drawningLocomotive = new DrawningLocomotive(random.Next(100, 300), random.Next(1000, 3000), + Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256))); + break; + case nameof(DrawningElectricLocomotive): + _drawningLocomotive = new DrawningElectricLocomotive(random.Next(100, 300), random.Next(1000, 3000), + Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), + 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))); + break; + default: + return; + } + _drawningLocomotive.SetPictureSize(pictureBoxElectricLocomotive.Width, pictureBoxElectricLocomotive.Height); + _drawningLocomotive.SetPosition(random.Next(10,100), random.Next(10,100)); + Draw(); } + /// + /// Обработка нажатия кнопки "Создать электровоз" + /// + /// + /// + private void ButtonCreate_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningElectricLocomotive)); + + /// + /// Обработка нажатия кнопки "Создать локомотив" + /// + /// + /// + private void buttonCreateLocomotive_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningLocomotive)); + + /// /// Перемещение объекта по форме (нажатие кнопок навигации) /// @@ -59,7 +81,7 @@ public partial class FormElectricLocomotive : Form /// private void ButtonMove_Click(object sender, EventArgs e) { - if (_drawningElectricLocomotive == null) + if (_drawningLocomotive == null) { return; } @@ -69,19 +91,19 @@ public partial class FormElectricLocomotive : Form { case "buttonUp": result = - _drawningElectricLocomotive.MoveTransport(DirectionType.Up); + _drawningLocomotive.MoveTransport(DirectionType.Up); break; case "buttonDown": result = - _drawningElectricLocomotive.MoveTransport(DirectionType.Down); + _drawningLocomotive.MoveTransport(DirectionType.Down); break; case "buttonLeft": result = - _drawningElectricLocomotive.MoveTransport(DirectionType.Left); + _drawningLocomotive.MoveTransport(DirectionType.Left); break; case "buttonRight": result = - _drawningElectricLocomotive.MoveTransport(DirectionType.Right); + _drawningLocomotive.MoveTransport(DirectionType.Right); break; } if (result) @@ -89,6 +111,8 @@ public partial class FormElectricLocomotive : Form Draw(); } } + + } -- 2.25.1 From eacd8071bbac6140240ba255c02227f8efed5428 Mon Sep 17 00:00:00 2001 From: BoiledMilk123 Date: Tue, 12 Mar 2024 00:56:03 +0400 Subject: [PATCH 2/8] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=81=D1=82=D1=80=D0=B0=D1=82=D0=B5=D0=B3?= =?UTF-8?q?=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Drawnings/DirectionType.cs | 5 + .../Drawnings/DrawningLocomotive.cs | 58 +++++--- .../FormElectricLocomotive.Designer.cs | 26 ++++ .../FormElectricLocomotive.cs | 50 ++++++- .../MovementStrategy/AbstractStrategy.cs | 140 ++++++++++++++++++ .../MovementStrategy/IMoveableObject.cs | 27 ++++ .../MovementStrategy/MovableLocomotive.cs | 67 +++++++++ .../MovementStrategy/MoveToBorder.cs | 41 +++++ .../MovementStrategy/MoveToCenter.cs | 42 ++++++ .../MovementStrategy/MovementDirection.cs | 31 ++++ .../MovementStrategy/ObjectParameters.cs | 76 ++++++++++ .../MovementStrategy/StrategyStatus.cs | 26 ++++ 12 files changed, 569 insertions(+), 20 deletions(-) create mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/AbstractStrategy.cs create mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs create mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs create mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToBorder.cs create mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToCenter.cs create mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovementDirection.cs create mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/ObjectParameters.cs create mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/StrategyStatus.cs diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DirectionType.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DirectionType.cs index 44c4914..28e2f32 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DirectionType.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DirectionType.cs @@ -8,6 +8,11 @@ namespace ProjectElectricLocomotive.Drawnings; public enum DirectionType { + /// + /// Неизвестное направление + /// + Unknow = -1, + /// /// Вверх /// diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs index a5afd18..f48b627 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs @@ -37,13 +37,35 @@ public class DrawningLocomotive /// /// Ширина прорисовки локомотива /// - private readonly int _drawningElectricLocomotiveWidth = 83; + private readonly int _drawningLocomotiveWidth = 83; /// /// Высота прорисовки локомотива /// - private readonly int _drawningElectricLocomotiveHeight = 40; + private readonly int _drawningLocomotiveHeight = 40; + + /// + /// Координата X объекта + /// + public int? GetPosX => _startPosX; + + /// + /// Координата Y объекта + /// + public int? GetPosY => _startPosY; + + /// + /// Ширина объекта + /// + public int GetWidth => _drawningLocomotiveWidth; + + /// + /// Высота объекта + /// + public int GetHeight => _drawningLocomotiveHeight; + + /// /// Пустой конструктор @@ -70,12 +92,12 @@ public class DrawningLocomotive /// /// Конструктор для наследников /// - /// Ширина прорисовки локомотива - /// Высота прорисовки локомотива - protected DrawningLocomotive(int drawningElectricLocomotiveWidth, int drawningElectricLocomotiveHeight) : this() + /// Ширина прорисовки локомотива + /// Высота прорисовки локомотива + protected DrawningLocomotive(int drawningLocomotiveWidth, int drawningLocomotiveHeight) : this() { - _drawningElectricLocomotiveWidth = drawningElectricLocomotiveWidth; - _drawningElectricLocomotiveHeight = drawningElectricLocomotiveHeight; + _drawningLocomotiveWidth = drawningLocomotiveWidth; + _drawningLocomotiveHeight = drawningLocomotiveHeight; } /// @@ -86,19 +108,19 @@ public class DrawningLocomotive /// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах public bool SetPictureSize(int width, int height) { - if (_drawningElectricLocomotiveHeight > height || _drawningElectricLocomotiveWidth > width) + if (_drawningLocomotiveHeight > height || _drawningLocomotiveWidth > width) { return false; } _pictureWidth = width; _pictureHeight = height; - if (_startPosY.HasValue && _startPosY + _drawningElectricLocomotiveHeight < _pictureHeight) + if (_startPosY.HasValue && _startPosY + _drawningLocomotiveHeight < _pictureHeight) { - _startPosY = _pictureHeight - _drawningElectricLocomotiveHeight; + _startPosY = _pictureHeight - _drawningLocomotiveHeight; } - if (_startPosX.HasValue && _startPosX + _drawningElectricLocomotiveWidth < _pictureWidth) + if (_startPosX.HasValue && _startPosX + _drawningLocomotiveWidth < _pictureWidth) { - _startPosX = _pictureWidth - _drawningElectricLocomotiveWidth; + _startPosX = _pictureWidth - _drawningLocomotiveWidth; } return true; } @@ -121,13 +143,13 @@ public class DrawningLocomotive - if (_drawningElectricLocomotiveHeight + y > _pictureHeight) + if (_drawningLocomotiveHeight + y > _pictureHeight) { - _startPosY = _pictureHeight - _drawningElectricLocomotiveHeight; + _startPosY = _pictureHeight - _drawningLocomotiveHeight; } - if (_drawningElectricLocomotiveWidth + x > _pictureWidth) + if (_drawningLocomotiveWidth + x > _pictureWidth) { - _startPosX = _pictureWidth - _drawningElectricLocomotiveWidth; + _startPosX = _pictureWidth - _drawningLocomotiveWidth; } if (x < 0) { @@ -172,14 +194,14 @@ public class DrawningLocomotive return true; //вправо case DirectionType.Right: - if (_startPosX.Value + _drawningElectricLocomotiveWidth + EntityLocomotive.Step < _pictureWidth) + if (_startPosX.Value + _drawningLocomotiveWidth + EntityLocomotive.Step < _pictureWidth) { _startPosX += (int)EntityLocomotive.Step; } return true; //вниз case DirectionType.Down: - if (_startPosY.Value + _drawningElectricLocomotiveHeight + EntityLocomotive.Step < _pictureHeight) + if (_startPosY.Value + _drawningLocomotiveHeight + EntityLocomotive.Step < _pictureHeight) { _startPosY += (int)EntityLocomotive.Step; } diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.Designer.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.Designer.cs index dcf94c2..b758749 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.Designer.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.Designer.cs @@ -35,6 +35,8 @@ buttonRight = new Button(); buttonUp = new Button(); buttonCreateLocomotive = new Button(); + comboBoxStrategy = new ComboBox(); + buttonStrategyStep = new Button(); ((System.ComponentModel.ISupportInitialize)pictureBoxElectricLocomotive).BeginInit(); SuspendLayout(); // @@ -121,11 +123,33 @@ buttonCreateLocomotive.UseVisualStyleBackColor = true; buttonCreateLocomotive.Click += buttonCreateLocomotive_Click; // + // comboBoxStrategy + // + comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxStrategy.FormattingEnabled = true; + comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К краю" }); + comboBoxStrategy.Location = new Point(733, 24); + comboBoxStrategy.Name = "comboBoxStrategy"; + comboBoxStrategy.Size = new Size(121, 23); + comboBoxStrategy.TabIndex = 7; + // + // buttonStrategyStep + // + buttonStrategyStep.Location = new Point(764, 72); + buttonStrategyStep.Name = "buttonStrategyStep"; + buttonStrategyStep.Size = new Size(90, 33); + buttonStrategyStep.TabIndex = 8; + buttonStrategyStep.Text = "Шаг"; + buttonStrategyStep.UseVisualStyleBackColor = true; + buttonStrategyStep.Click += buttonStrategyStep_Click; + // // FormElectricLocomotive // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(866, 479); + Controls.Add(buttonStrategyStep); + Controls.Add(comboBoxStrategy); Controls.Add(buttonCreateLocomotive); Controls.Add(buttonUp); Controls.Add(buttonRight); @@ -148,5 +172,7 @@ private Button buttonRight; private Button buttonUp; private Button buttonCreateLocomotive; + private ComboBox comboBoxStrategy; + private Button buttonStrategyStep; } } \ No newline at end of file diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs index 52bc870..305f806 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs @@ -1,4 +1,5 @@ using ProjectElectricLocomotive.Drawnings; +using ProjectElectricLocomotive.MovementStrategy; using System; using System.Collections.Generic; using System.ComponentModel; @@ -13,11 +14,20 @@ namespace ProjectElectricLocomotive; public partial class FormElectricLocomotive : Form { + /// + /// Поле-объект для прорисовки объекта + /// private DrawningLocomotive? _drawningLocomotive; + private AbstractStrategy? _strategy; + + /// + /// Конструктор формы + /// public FormElectricLocomotive() { InitializeComponent(); + _strategy = null; } /// @@ -36,6 +46,10 @@ public partial class FormElectricLocomotive : Form pictureBoxElectricLocomotive.Image = bmp; } + /// + /// Создание объекта класса-перемещения + /// + /// private void CreateObject(string type) { Random random = new(); @@ -55,7 +69,9 @@ public partial class FormElectricLocomotive : Form return; } _drawningLocomotive.SetPictureSize(pictureBoxElectricLocomotive.Width, pictureBoxElectricLocomotive.Height); - _drawningLocomotive.SetPosition(random.Next(10,100), random.Next(10,100)); + _drawningLocomotive.SetPosition(random.Next(10, 100), random.Next(10, 100)); + _strategy = null; + comboBoxStrategy.Enabled = true; Draw(); } @@ -112,7 +128,37 @@ public partial class FormElectricLocomotive : Form } } - + /// + /// + /// + /// + /// + private void buttonStrategyStep_Click(object sender, EventArgs e) + { + if (_drawningLocomotive == null) return; + if (comboBoxStrategy.Enabled) + { + _strategy = comboBoxStrategy.SelectedIndex switch + { + 0 => new MoveToCenter(), + 1 => new MoveToBorder(), + _ => null, + }; + if (_strategy == null) return; + _strategy.SetData(new MoveableLocomotive(_drawningLocomotive), pictureBoxElectricLocomotive.Width, pictureBoxElectricLocomotive.Height); + } + if (_strategy == null) return; + comboBoxStrategy.Enabled = false; + _strategy.MakeStep(); + Draw(); + + if (_strategy.GetStatus() == StrategyStatus.Finish) + { + comboBoxStrategy.Enabled = true; + _strategy = null; + } + } + } diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/AbstractStrategy.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/AbstractStrategy.cs new file mode 100644 index 0000000..3b2a3d2 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/AbstractStrategy.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectElectricLocomotive.MovementStrategy; + +public abstract class AbstractStrategy +{ + + /// + /// Перемещаемый объект + /// + private IMoveableObject? _moveableObject; + + /// + /// Статус перемещения + /// + private StrategyStatus _state = StrategyStatus.NotInit; + + /// + /// Ширина поля + /// + protected int FieldWidth { get; private set; } + + /// + /// Высота поля + /// + protected int FieldHeight { get; private set; } + + /// + /// Статус перемещения + /// + public StrategyStatus GetStatus() { return _state; } + + /// + /// Установка данных + /// + /// Перемещаемый объект + /// Ширина поля + /// Высота поля + public void SetData(IMoveableObject moveableObject, int width, int height) + { + if (moveableObject == null) + { + _state = StrategyStatus.NotInit; + return; + } + + _state = StrategyStatus.InProgress; + _moveableObject = moveableObject; + FieldWidth = width; + FieldHeight = height; + } + + /// + /// Шаг перемещения + /// + public void MakeStep() + { + if (_state != StrategyStatus.InProgress) + { + return; + } + if (IsTargetDestinaion()) + { + _state = StrategyStatus.Finish; + return; + } + MoveToTarget(); + } + + /// + /// Перемещение влево + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveLeft() => MoveTo(MovementDirection.Left); + + /// + /// Перемещение вправо + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveRight() => MoveTo(MovementDirection.Right); + + /// + /// Перемещение вверх + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveUp() => MoveTo(MovementDirection.Up); + + /// + /// Перемещение вниз + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveDown() => MoveTo(MovementDirection.Down); + + /// + /// Параметры объекта + /// + protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition; + + /// + /// Шаг объекта + /// + /// + protected int? GetStep() + { + if (_state != StrategyStatus.InProgress) + { + return null; + } + return _moveableObject?.GetStep; + } + + /// + /// Перемещение к цели + /// + protected abstract void MoveToTarget(); + + /// + /// Достигнута ли цель + /// + /// + protected abstract bool IsTargetDestinaion(); + + /// + /// Попытка перемещения в требуемом направлении + /// + /// Направление + /// Результат попытки (true - удалось переместиться, false - неудача) + private bool MoveTo(MovementDirection movementDirection) + { + if (_state != StrategyStatus.InProgress) + { + return false; + } + return _moveableObject?.TryMoveObject(movementDirection) ?? false; + } +} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs new file mode 100644 index 0000000..209f702 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectElectricLocomotive.MovementStrategy; + +public interface IMoveableObject +{ + /// + /// Получение координат объекта + /// + ObjectParameters? GetObjectPosition { get; } + + /// + /// Шаг объекта + /// + int GetStep { get; } + + /// + /// Попытка переместить объект в указанном направлении + /// + /// Направление + /// True - объект перемещен, false - перемещение невозможно + bool TryMoveObject(MovementDirection direction); +} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs new file mode 100644 index 0000000..d45a96a --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs @@ -0,0 +1,67 @@ +using ProjectElectricLocomotive.Drawnings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectElectricLocomotive.MovementStrategy; + +/// +/// Класс-реализация IMoveableObject c использованием DrawningLocomotive +/// +public class MoveableLocomotive : IMoveableObject +{ + /// + /// Поле-объект класса DrawningLocomotive или его наследника + /// + private readonly DrawningLocomotive? _locomotive = null; + + /// + /// Конструктор + /// + /// Объект класса DrawningLocomotive + public MoveableLocomotive(DrawningLocomotive locomotive) + { + _locomotive = locomotive; + } + + public ObjectParameters? GetObjectPosition + { + get + { + if (_locomotive == null || _locomotive.EntityLocomotive == null || !_locomotive.GetPosX.HasValue || !_locomotive.GetPosY.HasValue) + { + return null; + } + return new ObjectParameters(_locomotive.GetPosX.Value, _locomotive.GetPosY.Value, _locomotive.GetWidth, _locomotive.GetHeight); + } + } + + public int GetStep => (int)(_locomotive?.EntityLocomotive?.Step ?? 0); + + public bool TryMoveObject(MovementDirection direction) + { + if (_locomotive == null || _locomotive.EntityLocomotive == null) + { + return false; + } + return _locomotive.MoveTransport(GetDirectionType(direction)); + } + /// + /// Конвертация из MovementDirection в DirectionType + /// + /// MovementDirection + /// DirectionType + private static DirectionType GetDirectionType(MovementDirection direction) + { + return direction switch + { + MovementDirection.Left => DirectionType.Left, + MovementDirection.Right => DirectionType.Right, + MovementDirection.Up => DirectionType.Up, + MovementDirection.Down => DirectionType.Down, + _ => DirectionType.Unknow, + }; + } +} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToBorder.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToBorder.cs new file mode 100644 index 0000000..d4f70a9 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToBorder.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectElectricLocomotive.MovementStrategy; + +public class MoveToBorder : AbstractStrategy +{ + protected override bool IsTargetDestinaion() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return false; + } + return objParams.RightBorder + GetStep() >= FieldWidth && objParams.DownBorder + GetStep() >= FieldHeight; + } + + protected override void MoveToTarget() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return; + } + int diffX = objParams.RightBorder - FieldWidth; + if (Math.Abs(diffX) > GetStep()) + { + if (diffX > 0) MoveLeft(); + else MoveRight(); + } + int diffY = objParams.DownBorder - FieldHeight; + if (Math.Abs(diffY) > GetStep()) + { + if (diffY > 0) MoveUp(); + else MoveDown(); + } + } +} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToCenter.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToCenter.cs new file mode 100644 index 0000000..7d3da73 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToCenter.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectElectricLocomotive.MovementStrategy; + +public class MoveToCenter : AbstractStrategy +{ + protected override bool IsTargetDestinaion() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return false; + } + return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 && + objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2; + } + + protected override void MoveToTarget() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return; + } + int diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2; + if (Math.Abs(diffX) > GetStep()) + { + if (diffX > 0) MoveLeft(); + else MoveRight(); + } + int diffY = objParams.ObjectMiddleVertical - FieldHeight / 2; + if (Math.Abs(diffY) > GetStep()) + { + if (diffY > 0) MoveUp(); + else MoveDown(); + } + } +} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovementDirection.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovementDirection.cs new file mode 100644 index 0000000..1d38253 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovementDirection.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectElectricLocomotive.MovementStrategy; + +public enum MovementDirection +{ + /// + /// Вверх + /// + Up = 1, + + /// + /// Вверх + /// + Down = 2, + + /// + /// Вверх + /// + Left = 3, + + /// + /// Вверх + /// + Right = 4, + +} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/ObjectParameters.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/ObjectParameters.cs new file mode 100644 index 0000000..5b3cc06 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/ObjectParameters.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectElectricLocomotive.MovementStrategy; + +public class ObjectParameters +{ + /// + /// Координата x + /// + private readonly int _x; + + /// + /// Координата y + /// + private readonly int _y; + + /// + /// Ширина объекта + /// + private readonly int _width; + + /// + /// Высота объекта + /// + private readonly int _height; + + /// + /// Левая граница + /// + public int LeftBorder => _x; + /// + /// Верхняя граница + /// + public int TopBorder => _y; + + /// + /// Правая граница + /// + public int RightBorder => _x + _width; + + /// + /// Нижняя граница + /// + public int DownBorder => _y + _height; + + /// + /// Середина объекта + /// + public int ObjectMiddleHorizontal => _x + _width / 2; + /// + /// Середина объекта + /// + public int ObjectMiddleVertical => _y + _height / 2; + + /// + /// Конструктор + /// + /// Координата x + /// Координата y + /// Ширина объекта + /// Высота объекта + public ObjectParameters(int x, int y, int width, int height) + { + _x = x; + _y = y; + _width = width; + _height = height; + } + + + +} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/StrategyStatus.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/StrategyStatus.cs new file mode 100644 index 0000000..19f2183 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/StrategyStatus.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectElectricLocomotive.MovementStrategy; + +public enum StrategyStatus +{ + /// + /// Всё готово к началу + /// + NotInit, + + /// + /// Выполняется + /// + InProgress, + + + /// + /// Завершено + /// + Finish +} -- 2.25.1 From b67d1a8499a7c6f480ec8b40e45a56fab7483553 Mon Sep 17 00:00:00 2001 From: BoiledMilk123 Date: Tue, 12 Mar 2024 00:59:56 +0400 Subject: [PATCH 3/8] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D1=83=D0=B6=D0=BD=D0=BE=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Project1/Project1.sln | 31 ----- Project1/Project1/Project1.vcxproj | 135 --------------------- Project1/Project1/Project1.vcxproj.filters | 22 ---- Project1/Project1/sove.cpp | 56 --------- 4 files changed, 244 deletions(-) delete mode 100644 Project1/Project1.sln delete mode 100644 Project1/Project1/Project1.vcxproj delete mode 100644 Project1/Project1/Project1.vcxproj.filters delete mode 100644 Project1/Project1/sove.cpp diff --git a/Project1/Project1.sln b/Project1/Project1.sln deleted file mode 100644 index 4149998..0000000 --- a/Project1/Project1.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.7.34024.191 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project1", "Project1\Project1.vcxproj", "{51322AFD-5D22-49A7-BC85-AC24DACBAEE8}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Debug|x64.ActiveCfg = Debug|x64 - {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Debug|x64.Build.0 = Debug|x64 - {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Debug|x86.ActiveCfg = Debug|Win32 - {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Debug|x86.Build.0 = Debug|Win32 - {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Release|x64.ActiveCfg = Release|x64 - {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Release|x64.Build.0 = Release|x64 - {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Release|x86.ActiveCfg = Release|Win32 - {51322AFD-5D22-49A7-BC85-AC24DACBAEE8}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {188BD3AE-A59B-46F9-AEC9-A67BF38B0430} - EndGlobalSection -EndGlobal diff --git a/Project1/Project1/Project1.vcxproj b/Project1/Project1/Project1.vcxproj deleted file mode 100644 index 96fe319..0000000 --- a/Project1/Project1/Project1.vcxproj +++ /dev/null @@ -1,135 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - Win32Proj - {51322afd-5d22-49a7-bc85-ac24dacbaee8} - Project1 - 10.0 - - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - \ No newline at end of file diff --git a/Project1/Project1/Project1.vcxproj.filters b/Project1/Project1/Project1.vcxproj.filters deleted file mode 100644 index 61be7de..0000000 --- a/Project1/Project1/Project1.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Исходные файлы - - - \ No newline at end of file diff --git a/Project1/Project1/sove.cpp b/Project1/Project1/sove.cpp deleted file mode 100644 index e966ec7..0000000 --- a/Project1/Project1/sove.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#define _USE_MATH_DEFINES -#define _CRT_SECURE_NO_WARNINGS -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -using namespace std; - - -typedef long long ll; -typedef unsigned long long ull; -typedef unsigned int uint; -typedef long double ld; -typedef pair pll; -typedef pair pii; - - -const ll LINF = 100090009990; -const int INF = 1009000999; -const int N = 1002; -const int M = 1002; -const ld PI = 3.1415926535; -const ld E = 2.7182818284; -const ll MOD = 1000000007; -const int MAX = 150010; -const ld EPS = 1e-10; - - - - -int main() -{ - vector Buttons{ "A", "B","C", "D", "L1", "L2", "R1", "R2" }; - vector ButtonsAns{ "A", "B","C", "D", "L1", "L2", "R1", "R2" }; - vector used, unused; - int stick; - - - return 0; -} \ No newline at end of file -- 2.25.1 From 8bf8eab70b7776d0730b940ef96d171b02b8df7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D1=81402?= <с402@LAPTOP-GSFF9G8M> Date: Tue, 12 Mar 2024 11:58:14 +0300 Subject: [PATCH 4/8] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D1=83=D0=B6=D0=BD=D0=BE=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Drawnings/DrawningElectricLocomotive.cs | 14 ++------------ .../Drawnings/DrawningLocomotive.cs | 15 +++++---------- .../MovementStrategy/IMoveableObject.cs | 6 ++++++ .../MovementStrategy/MovableLocomotive.cs | 1 + 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningElectricLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningElectricLocomotive.cs index aafc9d9..c9283c8 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningElectricLocomotive.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningElectricLocomotive.cs @@ -15,7 +15,6 @@ public class DrawningElectricLocomotive : DrawningLocomotive /// /// /// - /// /// /// public DrawningElectricLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, bool electricHorns, bool batteryPlacement) : base(83,45) @@ -32,7 +31,7 @@ public class DrawningElectricLocomotive : DrawningLocomotive //Создание перьев и кистей для прорисовки электровоза Brush blackBrush = new SolidBrush(Color.Black); - Pen penSolid = new(Color.Black, 2); + Pen penSolid = new(electricLocomotive.AdditionalColor, 2); Pen penSolidYellow = new(Color.Yellow, 0.5f); Brush additionalBrush = new SolidBrush(electricLocomotive.AdditionalColor); @@ -40,7 +39,6 @@ public class DrawningElectricLocomotive : DrawningLocomotive if (electricLocomotive.ElectricHorns) { - //Инициализация опорных точек для прорисовки "рогов" Point pointHorns1 = new Point(_startPosX.Value + 13, _startPosY.Value + 5); Point pointHorns2 = new Point(_startPosX.Value + 16, _startPosY.Value + 2); @@ -60,7 +58,7 @@ public class DrawningElectricLocomotive : DrawningLocomotive Point pointLightning4 = new Point(_startPosX.Value + 37, _startPosY.Value + 41); //Прорисовка "хранилища батарей" электровоза - g.FillRectangle(blackBrush, _startPosX.Value + 36, _startPosY.Value + 37, 8, 4.5f); + g.FillRectangle(additionalBrush, _startPosX.Value + 36, _startPosY.Value + 37, 8, 4.5f); g.DrawLine(penSolidYellow, pointLightning1, pointLightning2); g.DrawLine(penSolidYellow, pointLightning2, pointLightning3); g.DrawLine(penSolidYellow, pointLightning3, pointLightning4); @@ -71,14 +69,6 @@ public class DrawningElectricLocomotive : DrawningLocomotive base.DrawTransport(g); _startPosY -= 5; - //Опциональная прорисовка цвета передних колёс - g.FillEllipse(additionalBrush, _startPosX.Value + 9, _startPosY.Value + 37, 8, 8); - g.FillEllipse(additionalBrush, _startPosX.Value + 24, _startPosY.Value + 37, 8, 8); - - //Опциональная прорисовка цвета задних колёс - g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 26, _startPosY.Value + 37, 8, 8); - g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 37, _startPosY.Value + 37, 8, 8); - } } diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs index f48b627..b5c64de 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs @@ -65,8 +65,6 @@ public class DrawningLocomotive /// public int GetHeight => _drawningLocomotiveHeight; - - /// /// Пустой конструктор /// @@ -137,12 +135,9 @@ public class DrawningLocomotive return; } - _startPosX = x; _startPosY = y; - - if (_drawningLocomotiveHeight + y > _pictureHeight) { _startPosY = _pictureHeight - _drawningLocomotiveHeight; @@ -229,6 +224,7 @@ public class DrawningLocomotive Pen windowPen = new(Color.DeepSkyBlue); Brush blackBrush = new SolidBrush(Color.Black); Brush whiteBrush = new SolidBrush(Color.White); + Brush additionalBrush = new SolidBrush(EntityLocomotive.BodyColor); //Инициализация опорных точек для прорисовки корпуса Point pointStart = new Point(_startPosX.Value + 75, _startPosY.Value + 15); @@ -285,7 +281,6 @@ public class DrawningLocomotive g.FillRectangle(brWhite, _startPosX.Value + 36, _startPosY.Value + 11, 7, 10); - //Прорисовка передней и задней "юбки" g.FillRectangle(blackBrush, _startPosX.Value + 7, _startPosY.Value + 32, 25, 5.3f); g.FillRectangle(blackBrush, _startPosX.Value + 47, _startPosY.Value + 32, 22, 5.3f); @@ -309,11 +304,11 @@ public class DrawningLocomotive g.DrawRectangle(windowPen, _startPosX.Value + 63, _startPosY.Value + 4, 8, 8); //Опциональная прорисовка цвета передних колёс - g.FillEllipse(whiteBrush, _startPosX.Value + 9, _startPosY.Value + 32, 8, 8); - g.FillEllipse(whiteBrush, _startPosX.Value + 24, _startPosY.Value + 32, 8, 8); + g.FillEllipse(additionalBrush, _startPosX.Value + 9, _startPosY.Value + 32, 8, 8); + g.FillEllipse(additionalBrush, _startPosX.Value + 24, _startPosY.Value + 32, 8, 8); //Опциональная прорисовка цвета задних колёс - g.FillEllipse(whiteBrush, _startPosX.Value + 25 + 26, _startPosY.Value + 32, 8, 8); - g.FillEllipse(whiteBrush, _startPosX.Value + 25 + 37, _startPosY.Value + 32, 8, 8); + g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 26, _startPosY.Value + 32, 8, 8); + g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 37, _startPosY.Value + 32, 8, 8); } } diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs index 209f702..ecc6e64 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs @@ -24,4 +24,10 @@ public interface IMoveableObject /// Направление /// True - объект перемещен, false - перемещение невозможно bool TryMoveObject(MovementDirection direction); + + /// + /// Метод интерфейса для доп.задания + /// + /// + } diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs index d45a96a..ffd5249 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs @@ -64,4 +64,5 @@ public class MoveableLocomotive : IMoveableObject _ => DirectionType.Unknow, }; } + } -- 2.25.1 From 440eb9b3c95aa7a3ec185b1a6288f41e142715a6 Mon Sep 17 00:00:00 2001 From: BoiledMilk123 Date: Sun, 7 Apr 2024 15:18:05 +0400 Subject: [PATCH 5/8] =?UTF-8?q?=D0=92=D0=BD=D1=91=D1=81=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B2=20=D0=BA=D0=BE=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectElectricLocomotive/MovementStrategy/MoveToBorder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToBorder.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToBorder.cs index d4f70a9..33eaad6 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToBorder.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToBorder.cs @@ -17,7 +17,7 @@ public class MoveToBorder : AbstractStrategy } return objParams.RightBorder + GetStep() >= FieldWidth && objParams.DownBorder + GetStep() >= FieldHeight; } - + //; protected override void MoveToTarget() { ObjectParameters? objParams = GetObjectParameters; -- 2.25.1 From 3f11f1c9b8fdaf7b76f0c64edd6a8bc945fcda0f Mon Sep 17 00:00:00 2001 From: BoiledMilk123 Date: Sun, 7 Apr 2024 15:18:20 +0400 Subject: [PATCH 6/8] =?UTF-8?q?=D0=92=D0=BD=D1=91=D1=81=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectElectricLocomotive/MovementStrategy/MoveToBorder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToBorder.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToBorder.cs index 33eaad6..d4f70a9 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToBorder.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToBorder.cs @@ -17,7 +17,7 @@ public class MoveToBorder : AbstractStrategy } return objParams.RightBorder + GetStep() >= FieldWidth && objParams.DownBorder + GetStep() >= FieldHeight; } - //; + protected override void MoveToTarget() { ObjectParameters? objParams = GetObjectParameters; -- 2.25.1 From 45efe4f21e3fb0babebfd5b2df2751354321ee5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D1=81402?= <с402@LAPTOP-GSFF9G8M> Date: Tue, 9 Apr 2024 13:46:56 +0400 Subject: [PATCH 7/8] =?UTF-8?q?=D0=A7=D0=B8=D1=81=D1=82=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/EntityElectricLocomotive.cs | 1 - .../FormCarConfig.Designer.cs | 88 +++++++++++++ .../FormCarConfig.cs | 24 ++++ .../FormCarConfig.resx | 120 ++++++++++++++++++ .../MovementStrategy/IMoveableObject.cs | 6 - .../MovementStrategy/MovableLocomotive.cs | 1 + .../MovementStrategy/MoveToCenter.cs | 1 + .../MovementStrategy/StrategyStatus.cs | 1 - 8 files changed, 234 insertions(+), 8 deletions(-) create mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.Designer.cs create mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.cs create mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.resx diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Entities/EntityElectricLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Entities/EntityElectricLocomotive.cs index 9c0ac12..18602b6 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/Entities/EntityElectricLocomotive.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Entities/EntityElectricLocomotive.cs @@ -30,7 +30,6 @@ public class EntityElectricLocomotive : EntityLocomotive /// /// /// - public EntityElectricLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, bool electricHorns, bool batteryPlacement) : base(speed, weight, bodyColor) { AdditionalColor = additionalColor; diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.Designer.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.Designer.cs new file mode 100644 index 0000000..0446243 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.Designer.cs @@ -0,0 +1,88 @@ +namespace ProjectElectricLocomotive +{ + partial class FormCarConfig + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + groupBoxConfig = new GroupBox(); + labelSimpleObject = new Label(); + label1 = new Label(); + groupBoxConfig.SuspendLayout(); + SuspendLayout(); + // + // groupBoxConfig + // + groupBoxConfig.Controls.Add(label1); + groupBoxConfig.Controls.Add(labelSimpleObject); + groupBoxConfig.Dock = DockStyle.Left; + groupBoxConfig.Location = new Point(0, 0); + groupBoxConfig.Name = "groupBoxConfig"; + groupBoxConfig.Size = new Size(675, 463); + groupBoxConfig.TabIndex = 0; + groupBoxConfig.TabStop = false; + groupBoxConfig.Text = "Параметры"; + // + // labelSimpleObject + // + labelSimpleObject.BorderStyle = BorderStyle.FixedSingle; + labelSimpleObject.Location = new Point(406, 423); + labelSimpleObject.Name = "labelSimpleObject"; + labelSimpleObject.Size = new Size(109, 31); + labelSimpleObject.TabIndex = 0; + labelSimpleObject.Text = "Простой"; + labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter; + // + // label1 + // + label1.BorderStyle = BorderStyle.FixedSingle; + label1.Location = new Point(547, 423); + label1.Name = "label1"; + label1.Size = new Size(109, 31); + label1.TabIndex = 1; + label1.Text = "Простой"; + label1.TextAlign = ContentAlignment.MiddleCenter; + // + // FormCarConfig + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(864, 463); + Controls.Add(groupBoxConfig); + Name = "FormCarConfig"; + Text = "FormCarConfig"; + Load += FormCarConfig_Load; + groupBoxConfig.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private GroupBox groupBoxConfig; + private Label labelSimpleObject; + private Label label1; + } +} \ No newline at end of file diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.cs new file mode 100644 index 0000000..f6b7fca --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ProjectElectricLocomotive; + +public partial class FormCarConfig : Form +{ + public FormCarConfig() + { + InitializeComponent(); + } + + private void FormCarConfig_Load(object sender, EventArgs e) + { + + } +} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.resx b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs index ecc6e64..209f702 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs @@ -24,10 +24,4 @@ public interface IMoveableObject /// Направление /// True - объект перемещен, false - перемещение невозможно bool TryMoveObject(MovementDirection direction); - - /// - /// Метод интерфейса для доп.задания - /// - /// - } diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs index ffd5249..88dbbc8 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs @@ -48,6 +48,7 @@ public class MoveableLocomotive : IMoveableObject } return _locomotive.MoveTransport(GetDirectionType(direction)); } + /// /// Конвертация из MovementDirection в DirectionType /// diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToCenter.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToCenter.cs index 7d3da73..30374fc 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToCenter.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MoveToCenter.cs @@ -39,4 +39,5 @@ public class MoveToCenter : AbstractStrategy else MoveDown(); } } + } diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/StrategyStatus.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/StrategyStatus.cs index 19f2183..90d9a61 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/StrategyStatus.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/StrategyStatus.cs @@ -18,7 +18,6 @@ public enum StrategyStatus /// InProgress, - /// /// Завершено /// -- 2.25.1 From 61295ed307ee370377568f516ec331bfd2252247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D1=81402?= <с402@LAPTOP-GSFF9G8M> Date: Tue, 9 Apr 2024 13:49:49 +0400 Subject: [PATCH 8/8] =?UTF-8?q?=D0=A3=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BD=D1=84=D0=BB=D0=B8=D0=BA?= =?UTF-8?q?=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormCarConfig.Designer.cs | 88 ------------- .../FormCarConfig.cs | 24 ---- .../FormCarConfig.resx | 120 ------------------ 3 files changed, 232 deletions(-) delete mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.Designer.cs delete mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.cs delete mode 100644 ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.resx diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.Designer.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.Designer.cs deleted file mode 100644 index 0446243..0000000 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.Designer.cs +++ /dev/null @@ -1,88 +0,0 @@ -namespace ProjectElectricLocomotive -{ - partial class FormCarConfig - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - groupBoxConfig = new GroupBox(); - labelSimpleObject = new Label(); - label1 = new Label(); - groupBoxConfig.SuspendLayout(); - SuspendLayout(); - // - // groupBoxConfig - // - groupBoxConfig.Controls.Add(label1); - groupBoxConfig.Controls.Add(labelSimpleObject); - groupBoxConfig.Dock = DockStyle.Left; - groupBoxConfig.Location = new Point(0, 0); - groupBoxConfig.Name = "groupBoxConfig"; - groupBoxConfig.Size = new Size(675, 463); - groupBoxConfig.TabIndex = 0; - groupBoxConfig.TabStop = false; - groupBoxConfig.Text = "Параметры"; - // - // labelSimpleObject - // - labelSimpleObject.BorderStyle = BorderStyle.FixedSingle; - labelSimpleObject.Location = new Point(406, 423); - labelSimpleObject.Name = "labelSimpleObject"; - labelSimpleObject.Size = new Size(109, 31); - labelSimpleObject.TabIndex = 0; - labelSimpleObject.Text = "Простой"; - labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter; - // - // label1 - // - label1.BorderStyle = BorderStyle.FixedSingle; - label1.Location = new Point(547, 423); - label1.Name = "label1"; - label1.Size = new Size(109, 31); - label1.TabIndex = 1; - label1.Text = "Простой"; - label1.TextAlign = ContentAlignment.MiddleCenter; - // - // FormCarConfig - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(864, 463); - Controls.Add(groupBoxConfig); - Name = "FormCarConfig"; - Text = "FormCarConfig"; - Load += FormCarConfig_Load; - groupBoxConfig.ResumeLayout(false); - ResumeLayout(false); - } - - #endregion - - private GroupBox groupBoxConfig; - private Label labelSimpleObject; - private Label label1; - } -} \ No newline at end of file diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.cs deleted file mode 100644 index f6b7fca..0000000 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace ProjectElectricLocomotive; - -public partial class FormCarConfig : Form -{ - public FormCarConfig() - { - InitializeComponent(); - } - - private void FormCarConfig_Load(object sender, EventArgs e) - { - - } -} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.resx b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.resx deleted file mode 100644 index af32865..0000000 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormCarConfig.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file -- 2.25.1