diff --git a/ExcavatorDifficult/ExcavatorDifficult/DirectionType.cs b/ExcavatorDifficult/ExcavatorDifficult/DirectionType.cs
new file mode 100644
index 0000000..90ce149
--- /dev/null
+++ b/ExcavatorDifficult/ExcavatorDifficult/DirectionType.cs
@@ -0,0 +1,23 @@
+namespace ExcavatorDifficult;
+///
+/// Направление перемещения
+///
+public enum DirectionType
+{
+ ///
+ /// Вверх
+ ///
+ Up=1,
+ ///
+ /// Вниз
+ ///
+ Down=2,
+ ///
+ /// Влево
+ ///
+ Left=3,
+ ///
+ /// Вправо
+ ///
+ Right=4,
+}
diff --git a/ExcavatorDifficult/ExcavatorDifficult/DrawingExcavator.cs b/ExcavatorDifficult/ExcavatorDifficult/DrawingExcavator.cs
new file mode 100644
index 0000000..827197b
--- /dev/null
+++ b/ExcavatorDifficult/ExcavatorDifficult/DrawingExcavator.cs
@@ -0,0 +1,256 @@
+namespace ExcavatorDifficult;
+
+public class DrawingExcavator
+{
+ ///
+ /// Класс-сущность
+ ///
+ public EntityExcavator? EntityExcavator { get; private set; }
+ public DrawingRink Rink;
+
+ ///
+ /// Ширина окна
+ ///
+ private int? _pictureWidth;
+
+ ///
+ /// Высота окна
+ ///
+ private int? _pictureHeight;
+
+ ///
+ /// Левая координата прорисовки экскаватора
+ ///
+ private int? _startPosX;
+
+ ///
+ /// Верхняя кооридната прорисовки экскаватора
+ ///
+ private int? _startPosY;
+
+ ///
+ /// Ширина прорисовки экскаватора
+ ///
+ private int _drawningExcavatorWidth;
+
+ ///
+ /// Высота прорисовки экскаватора
+ ///
+ private int _drawningExcavatorHeight;
+
+
+
+ ///
+ /// Инициализация свойств
+ ///
+ /// Скорость
+ /// Вес
+ /// Основной цвет
+ /// Дополнительный цвет
+ /// Признак наличия обвеса
+ /// Признак наличия антикрыла
+ /// Признак наличия гоночной полосы
+ public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bucket, bool support, bool bulldozerDump, int width, int height)
+ {
+
+ if (weight < _pictureWidth || height < _pictureHeight)
+ {
+ return false;
+ }
+
+ _drawningExcavatorWidth = 174;
+
+
+ _drawningExcavatorHeight = 80;
+
+ _pictureWidth = width;
+ _pictureHeight = height;
+ EntityExcavator = new EntityExcavator();
+ EntityExcavator.Init(speed, weight, bodyColor, additionalColor, bucket, support, bulldozerDump);
+ Rink = new DrawingRink();
+ return true;
+
+ }
+
+ ///
+ /// Установка границ поля
+ ///
+ /// Ширина поля
+ /// Высота поля
+ /// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах
+
+
+ ///
+ /// Установка позиции
+ ///
+ /// Координата X
+ /// Координата Y
+ public void SetPosition(int x, int y)
+ {
+ if (x < 0)
+ {
+ x = 0;
+ }
+ else if (x > _pictureWidth.Value - _drawningExcavatorWidth)
+ {
+ x = (_pictureWidth.Value - _drawningExcavatorWidth);
+
+ }
+
+ if (y < 0)
+ {
+ y = 0;
+ }
+ else if (y > _pictureHeight.Value - _drawningExcavatorWidth)
+ {
+ y = _pictureHeight.Value - _drawningExcavatorHeight;
+ //return;
+ }
+ _startPosX = x;
+ _startPosY = y;
+
+ }
+
+ ///
+ /// Изменение направления перемещения
+ ///
+ /// Направление
+ /// true - перемещение выполнено, false - перемещение невозможно
+ public bool MoveTransport(DirectionType direction)
+ {
+ if (EntityExcavator == null || !_startPosX.HasValue || !_startPosY.HasValue)
+ {
+ return false;
+ }
+
+ switch (direction)
+ {
+ //влево
+ case DirectionType.Left:
+ if (_startPosX.Value - EntityExcavator.Step > 0)
+ {
+ _startPosX -= (int)EntityExcavator.Step;
+ }
+ return true;
+ //вверх
+ case DirectionType.Up:
+ if (_startPosY.Value - EntityExcavator.Step > 0)
+ {
+ _startPosY -= (int)EntityExcavator.Step;
+ }
+ return true;
+ // вправо
+ case DirectionType.Right:
+ if (_startPosX.Value + _drawningExcavatorWidth + EntityExcavator.Step < _pictureWidth)
+ {
+ _startPosX += (int)EntityExcavator.Step;
+ }
+ return true;
+ //вниз
+ case DirectionType.Down:
+ if (_startPosY.Value + _drawningExcavatorHeight + EntityExcavator.Step < _pictureHeight)
+ {
+ _startPosY += (int)EntityExcavator.Step;
+ }
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ ///
+ /// Прорисовка объекта
+ ///
+ ///
+ public void DrawTransport(Graphics g)
+ {
+ if (EntityExcavator == null || !_startPosX.HasValue || !_startPosY.HasValue)
+ {
+ return;
+ }
+
+ Pen pen = new(Color.Black);
+ Brush additionalBrush = new SolidBrush(EntityExcavator.AdditionalColor);
+ Brush bodybrush = new SolidBrush(EntityExcavator.BodyColor);
+
+
+ //границы экскаватора
+ g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 20, 100, 30);
+ g.DrawRectangle(pen, _startPosX.Value + 30, _startPosY.Value, 10, 20);
+ g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value, 20, 20);
+ g.DrawArc(pen, _startPosX.Value, _startPosY.Value + 45, 30, 40, 130, 100);
+ g.DrawArc(pen, _startPosX.Value + 80, _startPosY.Value + 50, 30, 40, 285, 110);
+ g.DrawLine(pen, _startPosX.Value + 5, _startPosY.Value + 80, _startPosX.Value + 109, _startPosY.Value + 80);
+ //g.DrawEllipse(pen, _startPosX.Value + 5, _startPosY.Value + 53, 25, 25);
+ //g.DrawEllipse(pen, _startPosX.Value + 80, _startPosY.Value + 53, 25, 25);
+ //g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 69, 10, 10);
+ //g.DrawEllipse(pen, _startPosX.Value + 48, _startPosY.Value + 69, 10, 10);
+ //g.DrawEllipse(pen, _startPosX.Value + 65, _startPosY.Value + 69, 10, 10);
+ //g.DrawEllipse(pen, _startPosX.Value + 40, _startPosY.Value + 53, 7, 7);
+ //g.DrawEllipse(pen, _startPosX.Value + 60, _startPosY.Value + 53, 7, 7);
+
+ //заливка кабины и основного железа
+ Brush br = new SolidBrush(Color.Black);
+ g.FillRectangle(bodybrush, _startPosX.Value, _startPosY.Value + 20, 100, 30);
+ g.FillRectangle(bodybrush, _startPosX.Value + 30, _startPosY.Value, 10, 20);
+ g.FillRectangle(bodybrush, _startPosX.Value + 80, _startPosY.Value, 20, 20);
+ //g.FillEllipse(br, _startPosX.Value + 5, _startPosY.Value + 53, 25, 25);
+ //g.FillEllipse(br, _startPosX.Value + 80, _startPosY.Value + 53, 25, 25);
+ //g.FillEllipse(br, _startPosX.Value + 30, _startPosY.Value + 69, 10, 10);
+ //g.FillEllipse(br, _startPosX.Value + 48, _startPosY.Value + 69, 10, 10);
+ //g.FillEllipse(br, _startPosX.Value + 65, _startPosY.Value + 69, 10, 10);
+ //g.FillEllipse(br, _startPosX.Value + 40, _startPosY.Value + 53, 7, 7);
+ //g.FillEllipse(br, _startPosX.Value + 60, _startPosY.Value + 53, 7, 7);
+
+ Rink.DrawRinks(g, _startPosX.Value + 5, _startPosY.Value + 10);
+
+ //фары
+ Brush brfara = new SolidBrush(Color.Blue);
+ g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 27, 10, 10);
+ g.FillRectangle(brfara, _startPosX.Value, _startPosY.Value + 27, 10, 10);
+ //окно
+ g.FillRectangle(brfara, _startPosX.Value + 85, _startPosY.Value + 10, 10, 10);
+
+
+ if (EntityExcavator.Bucket)
+ {
+ Point point1 = new Point(_startPosX.Value + 100, _startPosY.Value);
+ Point point2 = new Point(_startPosX.Value + 180, _startPosY.Value);
+ Point point4 = new Point(_startPosX.Value + 180, _startPosY.Value + 40);
+ Point point5 = new Point(_startPosX.Value + 170, _startPosY.Value + 60);
+ Point point6 = new Point(_startPosX.Value + 150, _startPosY.Value + 60);
+ Point point7 = new Point(_startPosX.Value + 140, _startPosY.Value + 40);
+ Point point8 = new Point(_startPosX.Value + 172, _startPosY.Value + 40);
+ Point point9 = new Point(_startPosX.Value + 172, _startPosY.Value + 10);
+ Point point10 = new Point(_startPosX.Value + 100, _startPosY.Value + 10);
+
+ Point[] Bucket = { point1, point2, point4, point5, point6, point7, point8, point9, point10 };
+ g.FillPolygon(additionalBrush, Bucket);
+ }
+
+ if (EntityExcavator.Support)
+ {
+ Point point1 = new Point(_startPosX.Value + 2, _startPosY.Value + 50);
+ Point point2 = new Point(_startPosX.Value + 12, _startPosY.Value + 80);
+ Point point3 = new Point(_startPosX.Value + 22, _startPosY.Value + 80);
+ Point point4 = new Point(_startPosX.Value + 12, _startPosY.Value + 50);
+ Point[] Support = { point1, point2, point3, point4 };
+ g.FillPolygon(additionalBrush, Support);
+
+ }
+
+ if (EntityExcavator.BulldozerDump)
+ {
+ Point point11 = new Point(_startPosX.Value + 100, _startPosY.Value + 40);
+ Point point12 = new Point(_startPosX.Value + 160, _startPosY.Value + 80);
+ Point point13 = new Point(_startPosX.Value + 130, _startPosY.Value + 80);
+ Point point14 = new Point(_startPosX.Value + 100, _startPosY.Value + 50);
+ Point[] Dump = { point11, point12, point13, point14 };
+ g.FillPolygon(additionalBrush, Dump);
+ }
+
+
+
+
+ }
+}
diff --git a/ExcavatorDifficult/ExcavatorDifficult/DrawingRink.cs b/ExcavatorDifficult/ExcavatorDifficult/DrawingRink.cs
new file mode 100644
index 0000000..689b4aa
--- /dev/null
+++ b/ExcavatorDifficult/ExcavatorDifficult/DrawingRink.cs
@@ -0,0 +1,64 @@
+namespace ExcavatorDifficult;
+
+public class DrawingRink
+{
+ public EntityExcavator? EntityExcavator { get; private set; }
+
+ private NumberOfRink numberOfRink;
+
+ public int KatNum
+ {
+ set
+ {
+ if (value <= 4 || value > 6)
+ {
+ numberOfRink = NumberOfRink.FourRink;
+ }
+ else if (value == 5)
+ {
+ numberOfRink = NumberOfRink.FiveRink;
+ }
+ else if (value == 6)
+ {
+ numberOfRink = NumberOfRink.SixRink;
+ }
+ }
+ }
+
+
+
+
+ public void DrawRinks(Graphics g, int _startPosX, int _startPosY)
+ {
+
+ Brush bodybrush = new SolidBrush(Color.Black);
+
+
+ switch (numberOfRink)
+ {
+ case NumberOfRink.FourRink:
+ g.FillEllipse(bodybrush, _startPosX, _startPosY + 48, 15, 15);
+ g.FillEllipse(bodybrush, _startPosX + 25, _startPosY + 48, 15, 15);
+ g.FillEllipse(bodybrush, _startPosX + 50, _startPosY + 48, 15, 15);
+ g.FillEllipse(bodybrush, _startPosX + 75, _startPosY + 48, 15, 15);
+ break;
+ case NumberOfRink.FiveRink:
+ g.FillEllipse(bodybrush, _startPosX + 5, _startPosY + 48, 15, 15);
+ g.FillEllipse(bodybrush, _startPosX + 25, _startPosY + 48, 15, 15);
+ g.FillEllipse(bodybrush, _startPosX + 45, _startPosY + 48, 15, 15);
+ g.FillEllipse(bodybrush, _startPosX + 65, _startPosY + 48, 15, 15);
+ g.FillEllipse(bodybrush, _startPosX + 85, _startPosY + 48, 15, 15);
+ break;
+ case NumberOfRink.SixRink:
+ g.FillEllipse(bodybrush, _startPosX, _startPosY + 52, 15, 15);
+ g.FillEllipse(bodybrush, _startPosX + 25, _startPosY + 52, 15, 15);
+ g.FillEllipse(bodybrush, _startPosX + 50, _startPosY + 52, 15, 15);
+ g.FillEllipse(bodybrush, _startPosX + 75, _startPosY + 52, 15, 15);
+ g.FillEllipse(bodybrush, _startPosX + 15, _startPosY + 40, 15, 15);
+ g.FillEllipse(bodybrush, _startPosX + 60, _startPosY + 40, 15, 15);
+ break;
+
+ }
+
+ }
+}
diff --git a/ExcavatorDifficult/ExcavatorDifficult/EntityExcavator.cs b/ExcavatorDifficult/ExcavatorDifficult/EntityExcavator.cs
new file mode 100644
index 0000000..cd2b6c9
--- /dev/null
+++ b/ExcavatorDifficult/ExcavatorDifficult/EntityExcavator.cs
@@ -0,0 +1,68 @@
+namespace ExcavatorDifficult;
+
+public class EntityExcavator
+{
+ ///
+ /// Скорость
+ ///
+ public int Speed { get; private set; }
+
+ ///
+ /// Вес
+ ///
+ public double Weight { get; private set; }
+
+ ///
+ /// Основной цвет
+ ///
+ public Color BodyColor { get; private set; }
+
+ ///
+ /// Дополнительный цвет (для опциональных элементов)
+ ///
+ public Color AdditionalColor { get; private set; }
+
+ ///
+ /// Признак (опция) наличия ковша
+ ///
+ public bool Bucket { get; private set; }
+
+ ///
+ /// Признак (опция) наличие опоры
+ ///
+ public bool Support { get; private set; }
+
+ ///
+ /// Признак (опция) наличие бульдозерного отвала
+ ///
+ public bool BulldozerDump { get; private set; }
+
+ ///
+ /// Шаг перемещения автомобиля
+ ///
+ public double Step => Speed * 100 / Weight;
+
+ ///
+ /// Инициализация полей объекта-класса экскаватора
+ ///
+ /// Скорость
+ /// Вес автомобиля
+ /// Основной цвет
+ /// Дополнительный цвет
+ /// Признак наличия ковша
+ /// Признак наличия опоры
+ /// Признак наличия бульдозерного обвеса
+
+
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bucket, bool support, bool bulldozerDump)
+ {
+ Speed = speed;
+ Weight = weight;
+ BodyColor = bodyColor;
+ AdditionalColor = additionalColor;
+ Bucket = bucket;
+ Support = support;
+ BulldozerDump = bulldozerDump;
+
+ }
+}
diff --git a/ExcavatorDifficult/ExcavatorDifficult/ExcavatorDifficult.csproj b/ExcavatorDifficult/ExcavatorDifficult/ExcavatorDifficult.csproj
index 663fdb8..f46417f 100644
--- a/ExcavatorDifficult/ExcavatorDifficult/ExcavatorDifficult.csproj
+++ b/ExcavatorDifficult/ExcavatorDifficult/ExcavatorDifficult.csproj
@@ -8,4 +8,23 @@
enable
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ExcavatorDifficult/ExcavatorDifficult/Form1.Designer.cs b/ExcavatorDifficult/ExcavatorDifficult/Form1.Designer.cs
deleted file mode 100644
index 62d6e38..0000000
--- a/ExcavatorDifficult/ExcavatorDifficult/Form1.Designer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace ExcavatorDifficult
-{
- partial class Form1
- {
- ///
- /// 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()
- {
- this.components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
- this.Text = "Form1";
- }
-
- #endregion
- }
-}
diff --git a/ExcavatorDifficult/ExcavatorDifficult/Form1.cs b/ExcavatorDifficult/ExcavatorDifficult/Form1.cs
deleted file mode 100644
index 0f16e60..0000000
--- a/ExcavatorDifficult/ExcavatorDifficult/Form1.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace ExcavatorDifficult
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/ExcavatorDifficult/ExcavatorDifficult/FormExcavator.Designer.cs b/ExcavatorDifficult/ExcavatorDifficult/FormExcavator.Designer.cs
new file mode 100644
index 0000000..670c9e5
--- /dev/null
+++ b/ExcavatorDifficult/ExcavatorDifficult/FormExcavator.Designer.cs
@@ -0,0 +1,142 @@
+namespace ExcavatorDifficult
+{
+ partial class FormExcavator
+ {
+ ///
+ /// 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()
+ {
+ pictureBoxExcavator = new PictureBox();
+ buttonCreate = new Button();
+ buttonUp = new Button();
+ buttonRight = new Button();
+ buttonDown = new Button();
+ buttonLeft = new Button();
+ numericUpDownrinkExcavator = new NumericUpDown();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxExcavator).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownrinkExcavator).BeginInit();
+ SuspendLayout();
+ //
+ // pictureBoxExcavator
+ //
+ pictureBoxExcavator.Dock = DockStyle.Fill;
+ pictureBoxExcavator.Location = new Point(0, 0);
+ pictureBoxExcavator.Name = "pictureBoxExcavator";
+ pictureBoxExcavator.Size = new Size(800, 450);
+ pictureBoxExcavator.TabIndex = 0;
+ pictureBoxExcavator.TabStop = false;
+ //
+ // buttonCreate
+ //
+ buttonCreate.Location = new Point(26, 409);
+ buttonCreate.Name = "buttonCreate";
+ buttonCreate.Size = new Size(94, 29);
+ buttonCreate.TabIndex = 1;
+ buttonCreate.Text = "Создать";
+ buttonCreate.UseVisualStyleBackColor = true;
+ buttonCreate.Click += ButtonCreat_Click;
+ //
+ // buttonUp
+ //
+ buttonUp.BackgroundImage = Properties.Resources.Up;
+ buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonUp.Location = new Point(690, 355);
+ buttonUp.Name = "buttonUp";
+ buttonUp.Size = new Size(41, 36);
+ buttonUp.TabIndex = 2;
+ buttonUp.UseVisualStyleBackColor = true;
+ buttonUp.Click += ButtonMove_Click;
+ //
+ // buttonRight
+ //
+ buttonRight.BackgroundImage = Properties.Resources.Right;
+ buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonRight.Location = new Point(737, 397);
+ buttonRight.Name = "buttonRight";
+ buttonRight.Size = new Size(41, 36);
+ buttonRight.TabIndex = 3;
+ buttonRight.UseVisualStyleBackColor = true;
+ buttonRight.Click += ButtonMove_Click;
+ //
+ // buttonDown
+ //
+ buttonDown.BackgroundImage = Properties.Resources.Down;
+ buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonDown.Location = new Point(690, 397);
+ buttonDown.Name = "buttonDown";
+ buttonDown.Size = new Size(41, 36);
+ buttonDown.TabIndex = 4;
+ buttonDown.UseVisualStyleBackColor = true;
+ buttonDown.Click += ButtonMove_Click;
+ //
+ // buttonLeft
+ //
+ buttonLeft.BackgroundImage = Properties.Resources.Left;
+ buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonLeft.Location = new Point(643, 397);
+ buttonLeft.Name = "buttonLeft";
+ buttonLeft.Size = new Size(41, 36);
+ buttonLeft.TabIndex = 5;
+ buttonLeft.UseVisualStyleBackColor = true;
+ buttonLeft.Click += ButtonMove_Click;
+ //
+ // numericUpDownrinkExcavator
+ //
+ numericUpDownrinkExcavator.Location = new Point(126, 411);
+ numericUpDownrinkExcavator.Margin = new Padding(3, 4, 3, 4);
+ numericUpDownrinkExcavator.Name = "numericUpDownrinkExcavator";
+ numericUpDownrinkExcavator.Size = new Size(150, 27);
+ numericUpDownrinkExcavator.TabIndex = 6;
+ //
+ // FormExcavator
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Controls.Add(numericUpDownrinkExcavator);
+ Controls.Add(buttonLeft);
+ Controls.Add(buttonDown);
+ Controls.Add(buttonRight);
+ Controls.Add(buttonUp);
+ Controls.Add(buttonCreate);
+ Controls.Add(pictureBoxExcavator);
+ Name = "FormExcavator";
+ Text = "FormExcavator";
+ ((System.ComponentModel.ISupportInitialize)pictureBoxExcavator).EndInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownrinkExcavator).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private PictureBox pictureBoxExcavator;
+ private Button buttonCreate;
+ private Button buttonUp;
+ private Button buttonRight;
+ private Button buttonDown;
+ private Button buttonLeft;
+ private NumericUpDown numericUpDownrinkExcavator;
+ }
+}
\ No newline at end of file
diff --git a/ExcavatorDifficult/ExcavatorDifficult/FormExcavator.cs b/ExcavatorDifficult/ExcavatorDifficult/FormExcavator.cs
new file mode 100644
index 0000000..4fe02db
--- /dev/null
+++ b/ExcavatorDifficult/ExcavatorDifficult/FormExcavator.cs
@@ -0,0 +1,87 @@
+namespace ExcavatorDifficult
+{
+ public partial class FormExcavator : Form
+ {
+
+ ///
+ /// поле объект для прорисовки объекта
+ ///
+ private DrawingExcavator? _drawingExcavator;
+
+ public FormExcavator()
+ {
+ InitializeComponent();
+ }
+
+ ///
+ /// метод прорисовки экскаватора
+ ///
+
+ private void Draw()
+ {
+ if (_drawingExcavator == null)
+ {
+ return;
+ }
+
+ Bitmap bmp = new(pictureBoxExcavator.Width, pictureBoxExcavator.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _drawingExcavator.DrawTransport(gr);
+ pictureBoxExcavator.Image = bmp;
+ }
+
+ ///
+ /// обработка кнопки создать
+ ///
+ ///
+ ///
+ private void ButtonCreat_Click(object sender, EventArgs e)
+ {
+ Random random = new();
+ _drawingExcavator = new DrawingExcavator();
+ _drawingExcavator.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)), Convert.ToBoolean(random.Next(0, 2)),
+ pictureBoxExcavator.Width, pictureBoxExcavator.Height);
+ _drawingExcavator.SetPosition(random.Next(10, 100), random.Next(10, 100));
+ _drawingExcavator.Rink.KatNum=(int)numericUpDownrinkExcavator.Value;
+
+ Draw();
+ }
+
+ ///
+ /// перемещение объекта
+ ///
+ ///
+ ///
+ private void ButtonMove_Click(object sender, EventArgs e)
+ {
+ if (_drawingExcavator == null)
+ {
+ return;
+ }
+
+ string name = ((Button)sender)?.Name ?? string.Empty;
+
+ switch (name)
+ {
+ case "buttonUp":
+ _drawingExcavator.MoveTransport(DirectionType.Up);
+ break;
+ case "buttonDown":
+ _drawingExcavator.MoveTransport(DirectionType.Down);
+ break;
+ case "buttonLeft":
+ _drawingExcavator.MoveTransport(DirectionType.Left);
+ break;
+ case "buttonRight":
+ _drawingExcavator.MoveTransport(DirectionType.Right);
+ break;
+ }
+
+ Draw();
+ }
+ }
+}
+
diff --git a/ExcavatorDifficult/ExcavatorDifficult/Form1.resx b/ExcavatorDifficult/ExcavatorDifficult/FormExcavator.resx
similarity index 93%
rename from ExcavatorDifficult/ExcavatorDifficult/Form1.resx
rename to ExcavatorDifficult/ExcavatorDifficult/FormExcavator.resx
index 1af7de1..af32865 100644
--- a/ExcavatorDifficult/ExcavatorDifficult/Form1.resx
+++ b/ExcavatorDifficult/ExcavatorDifficult/FormExcavator.resx
@@ -1,17 +1,17 @@
-
diff --git a/ExcavatorDifficult/ExcavatorDifficult/NumberOfRink.cs b/ExcavatorDifficult/ExcavatorDifficult/NumberOfRink.cs
new file mode 100644
index 0000000..2003a3b
--- /dev/null
+++ b/ExcavatorDifficult/ExcavatorDifficult/NumberOfRink.cs
@@ -0,0 +1,22 @@
+namespace ExcavatorDifficult;
+///
+/// Количество катков
+///
+public enum NumberOfRink
+{
+ ///
+ /// 4 катка
+ ///
+ FourRink,
+ ///
+ /// 5 катков
+ ///
+ FiveRink,
+ ///
+ /// 6 катков
+ ///
+ SixRink
+
+}
+
+
\ No newline at end of file
diff --git a/ExcavatorDifficult/ExcavatorDifficult/Program.cs b/ExcavatorDifficult/ExcavatorDifficult/Program.cs
index dbca9b6..29ad8ca 100644
--- a/ExcavatorDifficult/ExcavatorDifficult/Program.cs
+++ b/ExcavatorDifficult/ExcavatorDifficult/Program.cs
@@ -11,7 +11,7 @@ namespace ExcavatorDifficult
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
+ Application.Run(new FormExcavator());
}
}
}
\ No newline at end of file
diff --git a/ExcavatorDifficult/ExcavatorDifficult/Properties/Resources.Designer.cs b/ExcavatorDifficult/ExcavatorDifficult/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..f25c4bb
--- /dev/null
+++ b/ExcavatorDifficult/ExcavatorDifficult/Properties/Resources.Designer.cs
@@ -0,0 +1,103 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace ExcavatorDifficult.Properties {
+ using System;
+
+
+ ///
+ /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
+ ///
+ // Этот класс создан автоматически классом StronglyTypedResourceBuilder
+ // с помощью такого средства, как ResGen или Visual Studio.
+ // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
+ // с параметром /str или перестройте свой проект VS.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ExcavatorDifficult.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Перезаписывает свойство CurrentUICulture текущего потока для всех
+ /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Down {
+ get {
+ object obj = ResourceManager.GetObject("Down", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Left {
+ get {
+ object obj = ResourceManager.GetObject("Left", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Right {
+ get {
+ object obj = ResourceManager.GetObject("Right", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Up {
+ get {
+ object obj = ResourceManager.GetObject("Up", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/ExcavatorDifficult/ExcavatorDifficult/Properties/Resources.resx b/ExcavatorDifficult/ExcavatorDifficult/Properties/Resources.resx
new file mode 100644
index 0000000..929184e
--- /dev/null
+++ b/ExcavatorDifficult/ExcavatorDifficult/Properties/Resources.resx
@@ -0,0 +1,133 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+
+ ..\Resources\Up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Down.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Right.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file
diff --git a/ExcavatorDifficult/ExcavatorDifficult/Resources/Down.bmp b/ExcavatorDifficult/ExcavatorDifficult/Resources/Down.bmp
new file mode 100644
index 0000000..9a978c3
Binary files /dev/null and b/ExcavatorDifficult/ExcavatorDifficult/Resources/Down.bmp differ
diff --git a/ExcavatorDifficult/ExcavatorDifficult/Resources/Left.png b/ExcavatorDifficult/ExcavatorDifficult/Resources/Left.png
new file mode 100644
index 0000000..f20b33f
Binary files /dev/null and b/ExcavatorDifficult/ExcavatorDifficult/Resources/Left.png differ
diff --git a/ExcavatorDifficult/ExcavatorDifficult/Resources/Right.bmp b/ExcavatorDifficult/ExcavatorDifficult/Resources/Right.bmp
new file mode 100644
index 0000000..75b6203
Binary files /dev/null and b/ExcavatorDifficult/ExcavatorDifficult/Resources/Right.bmp differ
diff --git a/ExcavatorDifficult/ExcavatorDifficult/Resources/Up.png b/ExcavatorDifficult/ExcavatorDifficult/Resources/Up.png
new file mode 100644
index 0000000..14c6eab
Binary files /dev/null and b/ExcavatorDifficult/ExcavatorDifficult/Resources/Up.png differ