diff --git a/ProjectBulldozer/ProjectBulldozer/DirectionType.cs b/ProjectBulldozer/ProjectBulldozer/DirectionType.cs
new file mode 100644
index 0000000..26698c2
--- /dev/null
+++ b/ProjectBulldozer/ProjectBulldozer/DirectionType.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectBulldozer;
+
+public enum DirectionType
+{
+ ///
+ /// Вверх
+ ///
+ Up = 1,
+
+ ///
+ /// Вниз
+ ///
+ Down = 2,
+
+ ///
+ /// Влево
+ ///
+ Left = 3,
+
+ ///
+ /// Вправо
+ ///
+ Right = 4,
+
+}
diff --git a/ProjectBulldozer/ProjectBulldozer/DrawningBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/DrawningBulldozer.cs
new file mode 100644
index 0000000..db79465
--- /dev/null
+++ b/ProjectBulldozer/ProjectBulldozer/DrawningBulldozer.cs
@@ -0,0 +1,260 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectBulldozer;
+
+///
+/// Классб отвечающий за прорисовку и перемещение объекта-сущности
+///
+internal class DrawningBulldozer
+{
+ ///
+ /// Класс-сущность
+ ///
+ public EntityBulldozer? EntityBulldozer { get; private set; }
+
+ ///
+ ///Ширина окна
+ ///
+ private int? _pictureWidth;
+
+ ///
+ ///Высота окна
+ ///
+ private int? _pictureHeight;
+
+ ///
+ /// Левая координата прорисовки бульдозера
+ ///
+ private int? _startPosX;
+
+ ///
+ /// Верхнаяя координата прорисовки бульдозера
+ ///
+ private int? _startPosY;
+
+ ///
+ ///Ширина прорисовки бульдозера
+ ///
+ private readonly int _drawningBulldozerWidth = 150;
+
+ ///
+ ///Высота прорисовки бульдозера
+ ///
+ private readonly int _drawningBulldozerHeight = 90;
+
+ ///
+ ///Инициализация свойств
+ ///
+ /// ///Скорость
+ ///Вес
+ ///Основной цвет
+ ///Дополнительный цвет
+ ///Признак наличия отвала
+ ///Признак наличия гусеницы
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool blade, bool caterpillar)
+ //public void Init(EntityBulldozer entityBulldozer)
+ {
+ EntityBulldozer = new EntityBulldozer();
+ EntityBulldozer.Init(speed, weight, bodyColor, additionalColor, blade, caterpillar);
+ _pictureWidth = null;
+ _pictureHeight = null;
+ _startPosX = null;
+ _startPosY = null;
+ }
+
+ ///
+ ///Установка границ поля
+ ///
+ /// Ширина поля
+ /// Высота поля
+ /// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах
+ public bool SetPictureSize(int width, int height)
+ {
+ //проверка, что объект "влезает" в размеры поля. Если влезает, сохраняем границы и корректируем позицию объекта, если она была уже установлена.
+ if (width < _drawningBulldozerWidth || height < _drawningBulldozerHeight)
+ {
+ return false;
+ }
+ else
+ {
+ _pictureWidth = width;
+ _pictureHeight = height;
+ if (_startPosX != null || _startPosY != null)
+ {
+ if (_startPosX < 0)
+ {
+ _startPosX = 0;
+ }
+ if (_startPosX + _drawningBulldozerWidth >= _pictureWidth)
+ {
+ _startPosX = _pictureWidth - _drawningBulldozerWidth;
+ }
+ if (_startPosY < 0)
+ {
+ _startPosY = 0;
+ }
+ if (_startPosY + _drawningBulldozerHeight >= _pictureHeight)
+ {
+ _startPosY = _pictureHeight - _drawningBulldozerHeight;
+ }
+ }
+ }
+
+
+ return true;
+ }
+
+ ///
+ ///Установка позиции
+ ///
+ /// Координата X
+ /// Координата y
+ public void SetPosition(int x, int y)
+ {
+ if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
+ {
+ return;
+ }
+ //если при установке объекта в эти координаты, он будет выходить за границы формы, то надо изменить координаты,
+ //чтобы он оставался в этих границах
+ if (x < 0)
+ {
+ _startPosX = 0;
+ }
+ else if (x + _drawningBulldozerWidth > _pictureWidth)
+ {
+ _startPosX = _pictureWidth - _drawningBulldozerWidth;
+ }
+ else
+ {
+ _startPosX = x;
+ }
+
+ if (y < 0)
+ {
+ _startPosY = 0;
+ }
+ else if (y + _drawningBulldozerHeight > _pictureHeight)
+ {
+ _startPosY = _pictureHeight - _drawningBulldozerHeight;
+ }
+ else
+ {
+ _startPosY = y;
+ }
+ }
+ ///
+ ///Изменение направления перемещения
+ ///
+ /// Направлениие
+ /// true - перемещениие выполнено, false - перемещение невозможно
+ public bool MoveTransport(DirectionType direction)
+ {
+ if (EntityBulldozer == null || !_startPosX.HasValue || !_startPosY.HasValue)
+ {
+ return false;
+ }
+
+ switch (direction)
+ {
+ // влево
+ case DirectionType.Left:
+ if (_startPosX.Value - EntityBulldozer.Step > 0)
+ {
+ _startPosX -= (int)EntityBulldozer.Step;
+ }
+ return true;
+ // вверх
+ case DirectionType.Up:
+ if (_startPosY.Value - EntityBulldozer.Step > 0)
+ {
+ _startPosY -= (int)EntityBulldozer.Step;
+ }
+ return true;
+ // вправо
+ case DirectionType.Right:
+ if (_startPosX.Value + EntityBulldozer.Step + _drawningBulldozerWidth < _pictureWidth)
+ {
+ _startPosX += (int)EntityBulldozer.Step;
+ }
+ return true;
+ // вниз
+ case DirectionType.Down:
+ if (_startPosY.Value + EntityBulldozer.Step + _drawningBulldozerHeight < _pictureHeight)
+ {
+ _startPosY += (int)EntityBulldozer.Step;
+ }
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ ///
+ /// Прорисовка объекта
+ ///
+ ///
+ public void DrawTransport(Graphics g)
+ {
+ if (EntityBulldozer == null || !_startPosX.HasValue || !_startPosY.HasValue)
+ {
+ return;
+ }
+
+ Pen pen = new(Color.Black);
+ Brush bodyBrush = new SolidBrush(EntityBulldozer.BodyColor);
+ Brush additionalBrush = new SolidBrush(EntityBulldozer.AdditionalColor);
+ //BULDOZER
+ //body
+ g.FillRectangle(bodyBrush, _startPosX.Value + 10, _startPosY.Value + 15, _drawningBulldozerWidth - 20, _drawningBulldozerHeight - 30);
+ g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 15, _drawningBulldozerWidth - 20, _drawningBulldozerHeight - 30);
+ //wheels
+ g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value + _drawningBulldozerHeight - 15, 50, 15);
+ g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + _drawningBulldozerHeight - 15, 50, 15);
+ g.FillRectangle(additionalBrush, _startPosX.Value + _drawningBulldozerWidth - 50, _startPosY.Value + _drawningBulldozerHeight - 15, 50, 15);
+ g.DrawRectangle(pen, _startPosX.Value + _drawningBulldozerWidth - 50, _startPosY.Value + _drawningBulldozerHeight - 15, 50, 15);
+ g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value, 50, 15);
+ g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value, 50, 15);
+ g.FillRectangle(additionalBrush, _startPosX.Value + _drawningBulldozerWidth - 50, _startPosY.Value, 50, 15);
+ g.DrawRectangle(pen, _startPosX.Value + _drawningBulldozerWidth - 50, _startPosY.Value, 50, 15);
+ //strange rectangles
+ g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 25, 3, _drawningBulldozerHeight - 50);
+ g.DrawRectangle(pen, _startPosX.Value + 13, _startPosY.Value + 25, 20, 4);
+ g.DrawRectangle(pen, _startPosX.Value + 13, _startPosY.Value + _drawningBulldozerHeight - 29, 20, 4);
+ g.DrawRectangle(pen, _startPosX.Value + 13, _startPosY.Value + 29, 17, _drawningBulldozerHeight - 58);
+ //strange circles
+ g.DrawEllipse(pen, _startPosX.Value + 45, _startPosY.Value + 42, 6, 6);
+ g.DrawEllipse(pen, _startPosX.Value + 45, _startPosY.Value + 30, 6, 6);
+ g.DrawEllipse(pen, _startPosX.Value + 45, _startPosY.Value + 54, 6, 6);
+ //window
+ Brush windowBrush = new SolidBrush(Color.FromArgb(170, 170, 215));
+ g.FillRectangle(windowBrush, _startPosX.Value + 55, _startPosY.Value + 20, _drawningBulldozerWidth - 90, _drawningBulldozerHeight - 40);
+ g.DrawRectangle(pen, _startPosX.Value + 55, _startPosY.Value + 20, _drawningBulldozerWidth - 90, _drawningBulldozerHeight - 40);
+
+ //caterpillar
+ if (EntityBulldozer.Caterpillar)
+ {
+ g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value, _drawningBulldozerWidth, 15);
+ g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value, _drawningBulldozerWidth, 15);
+ g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value + _drawningBulldozerHeight - 15, _drawningBulldozerWidth, 15);
+ g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + _drawningBulldozerHeight - 15, _drawningBulldozerWidth, 15);
+ }
+
+ //blade
+ if (EntityBulldozer.Blade)
+ { //smth like hands?
+ g.FillRectangle(bodyBrush, _startPosX.Value + 75, _startPosY.Value + 3, 75, 15);
+ g.DrawRectangle(pen, _startPosX.Value + 75, _startPosY.Value + 3, 75, 15);
+ g.FillRectangle(bodyBrush, _startPosX.Value + 75, _startPosY.Value + _drawningBulldozerHeight - 18, 75, 15);
+ g.DrawRectangle(pen, _startPosX.Value + 75, _startPosY.Value + _drawningBulldozerHeight - 18, 75, 15);
+ //blade itself
+ g.FillRectangle(bodyBrush, _startPosX.Value + _drawningBulldozerWidth - 25, _startPosY.Value, 25, _drawningBulldozerHeight);
+ g.DrawRectangle(pen, _startPosX.Value + _drawningBulldozerWidth - 25, _startPosY.Value, 25, _drawningBulldozerHeight);
+ g.DrawLine(pen, _startPosX.Value + _drawningBulldozerWidth - 10, _startPosY.Value, _startPosX.Value + _drawningBulldozerWidth - 10, _startPosY.Value + _drawningBulldozerHeight);
+ }
+ }
+}
diff --git a/ProjectBulldozer/ProjectBulldozer/EntityBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/EntityBulldozer.cs
new file mode 100644
index 0000000..4492883
--- /dev/null
+++ b/ProjectBulldozer/ProjectBulldozer/EntityBulldozer.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectBulldozer;
+
+///
+/// Класс-сущность "Бульдозер"
+///
+public class EntityBulldozer
+{
+ ///
+ /// Скорость
+ ///
+ 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 Blade { get; private set; }
+
+ ///
+ /// Признак (опция) наличие гусеницы
+ ///
+ public bool Caterpillar { get; private set; }
+
+ ///
+ /// Шаг перемещения бульдозера
+ ///
+ public double Step => Speed * 100 / Weight;
+
+ ///
+ ///Инициализация полей объекта-класса бульдозера
+ ///
+ ///Скорость
+ ///Вес
+ ///Основной цвет
+ ///Дополнительный цвет
+ ///Признак наличия отвала
+ ///Признак наличия гусеницы
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool blade, bool caterpillar)
+ {
+ Speed = speed;
+ Weight = weight;
+ BodyColor = bodyColor;
+ AdditionalColor = additionalColor;
+ Blade = blade;
+ Caterpillar = caterpillar;
+ }
+}
diff --git a/ProjectBulldozer/ProjectBulldozer/Form1.Designer.cs b/ProjectBulldozer/ProjectBulldozer/Form1.Designer.cs
deleted file mode 100644
index 68de8df..0000000
--- a/ProjectBulldozer/ProjectBulldozer/Form1.Designer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace ProjectBulldozer
-{
- 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
- }
-}
\ No newline at end of file
diff --git a/ProjectBulldozer/ProjectBulldozer/Form1.cs b/ProjectBulldozer/ProjectBulldozer/Form1.cs
deleted file mode 100644
index f8335b4..0000000
--- a/ProjectBulldozer/ProjectBulldozer/Form1.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace ProjectBulldozer
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- }
-}
\ No newline at end of file
diff --git a/ProjectBulldozer/ProjectBulldozer/FormBulldozer.Designer.cs b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.Designer.cs
new file mode 100644
index 0000000..02d6b42
--- /dev/null
+++ b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.Designer.cs
@@ -0,0 +1,137 @@
+namespace ProjectBulldozer
+{
+ partial class FormBulldozer
+ {
+ ///
+ /// 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()
+ {
+ pictureBoxBulldozer = new PictureBox();
+ buttonCreate = new Button();
+ buttonRight = new Button();
+ buttonUp = new Button();
+ buttonLeft = new Button();
+ buttonDown = new Button();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxBulldozer).BeginInit();
+ SuspendLayout();
+ //
+ // pictureBoxBulldozer
+ //
+ pictureBoxBulldozer.Dock = DockStyle.Fill;
+ pictureBoxBulldozer.Location = new Point(0, 0);
+ pictureBoxBulldozer.Name = "pictureBoxBulldozer";
+ pictureBoxBulldozer.Size = new Size(874, 429);
+ pictureBoxBulldozer.SizeMode = PictureBoxSizeMode.AutoSize;
+ pictureBoxBulldozer.TabIndex = 0;
+ pictureBoxBulldozer.TabStop = false;
+ //
+ // buttonCreate
+ //
+ buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
+ buttonCreate.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
+ buttonCreate.Location = new Point(12, 371);
+ buttonCreate.Name = "buttonCreate";
+ buttonCreate.Size = new Size(150, 46);
+ buttonCreate.TabIndex = 1;
+ buttonCreate.Text = "Создать";
+ buttonCreate.UseVisualStyleBackColor = true;
+ buttonCreate.Click += buttonCreate_Click;
+ //
+ // buttonRight
+ //
+ buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonRight.BackgroundImage = Properties.Resources.ArrowR;
+ buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
+ buttonRight.Location = new Point(832, 387);
+ buttonRight.Name = "buttonRight";
+ buttonRight.Size = new Size(30, 30);
+ buttonRight.TabIndex = 2;
+ buttonRight.UseVisualStyleBackColor = true;
+ buttonRight.Click += ButtonMove_Click;
+ //
+ // buttonUp
+ //
+ buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonUp.BackgroundImage = Properties.Resources.ArrowU;
+ buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
+ buttonUp.Location = new Point(796, 351);
+ buttonUp.Name = "buttonUp";
+ buttonUp.Size = new Size(30, 30);
+ buttonUp.TabIndex = 3;
+ buttonUp.UseVisualStyleBackColor = true;
+ buttonUp.Click += ButtonMove_Click;
+ //
+ // buttonLeft
+ //
+ buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonLeft.BackgroundImage = Properties.Resources.ArrowL;
+ buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
+ buttonLeft.Location = new Point(760, 387);
+ buttonLeft.Name = "buttonLeft";
+ buttonLeft.Size = new Size(30, 30);
+ buttonLeft.TabIndex = 4;
+ buttonLeft.UseVisualStyleBackColor = true;
+ buttonLeft.Click += ButtonMove_Click;
+ //
+ // buttonDown
+ //
+ buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonDown.BackgroundImage = Properties.Resources.ArrowD;
+ buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
+ buttonDown.Location = new Point(796, 387);
+ buttonDown.Name = "buttonDown";
+ buttonDown.Size = new Size(30, 30);
+ buttonDown.TabIndex = 5;
+ buttonDown.UseVisualStyleBackColor = true;
+ buttonDown.Click += ButtonMove_Click;
+ //
+ // FormBulldozer
+ //
+ AutoScaleDimensions = new SizeF(13F, 32F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(874, 429);
+ Controls.Add(buttonDown);
+ Controls.Add(buttonLeft);
+ Controls.Add(buttonUp);
+ Controls.Add(buttonRight);
+ Controls.Add(buttonCreate);
+ Controls.Add(pictureBoxBulldozer);
+ Name = "FormBulldozer";
+ Text = "FormBulldozer";
+ ((System.ComponentModel.ISupportInitialize)pictureBoxBulldozer).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private PictureBox pictureBoxBulldozer;
+ private Button buttonCreate;
+ private Button buttonRight;
+ private Button buttonUp;
+ private Button buttonLeft;
+ private Button buttonDown;
+ }
+}
\ No newline at end of file
diff --git a/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs
new file mode 100644
index 0000000..efb7e9c
--- /dev/null
+++ b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs
@@ -0,0 +1,97 @@
+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 ProjectBulldozer
+{
+ public partial class FormBulldozer : Form
+ {
+ private DrawningBulldozer? _drawningBulldozer;
+ //private EntityBulldozer? _entityBulldozer;
+ public FormBulldozer()
+ {
+ InitializeComponent();
+ }
+
+ private void Draw()
+ {
+ if (_drawningBulldozer == null)
+ {
+ return;
+ }
+
+ Bitmap bmp = new(pictureBoxBulldozer.Width, pictureBoxBulldozer.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _drawningBulldozer.DrawTransport(gr);
+ pictureBoxBulldozer.Image = bmp;
+ }
+
+ ///
+ /// Обработка нажатия кнопки "Создать"
+ ///
+ ///
+ ///
+ private void buttonCreate_Click(object sender, EventArgs e)
+ {
+ Random random = new();
+ _drawningBulldozer = new DrawningBulldozer();
+ //_entityBulldozer = new EntityBulldozer();
+ /*_entityBulldozer.Init(random.Next(100, 300), random.Next(1000, 3000),
+ Color.FromArgb(random.Next(170, 256), random.Next(170, 210), random.Next(30, 140)),
+ Color.FromArgb(random.Next(30, 120), random.Next(30, 120), random.Next(30, 120)),
+ Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));*/
+ //_drawningBulldozer.Init(_entityBulldozer);
+ _drawningBulldozer.Init(random.Next(100, 300), random.Next(1000, 3000),
+ Color.FromArgb(random.Next(170, 256), random.Next(170, 256), random.Next(30, 140)),
+ Color.FromArgb(random.Next(30, 120), random.Next(30, 120), random.Next(30, 120)),
+ Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
+ //_drawningBulldozer.Init(150, 2000, Color.FromArgb(240, 200, 50), Color.FromArgb(30, 30, 70), true, false);
+ _drawningBulldozer.SetPictureSize(pictureBoxBulldozer.Width, pictureBoxBulldozer.Height);
+ //_drawningBulldozer.SetPosition(pictureBoxBulldozer.Width - random.Next(150, 250), pictureBoxBulldozer.Height - random.Next(100, 200));
+ _drawningBulldozer.SetPosition(random.Next(10, 100), random.Next(10, 100));
+ Draw();
+ }
+
+ ///
+ /// Перемещение объекта по форме (нажатие кнопок навигации)
+ ///
+ ///
+ ///
+ private void ButtonMove_Click(object sender, EventArgs e)
+ {
+ if (_drawningBulldozer == null)
+ {
+ return;
+ }
+
+ string name = ((Button)sender)?.Name ?? string.Empty;
+ bool result = false;
+ switch (name)
+ {
+ case "buttonUp":
+ result = _drawningBulldozer.MoveTransport(DirectionType.Up);
+ break;
+ case "buttonDown":
+ result = _drawningBulldozer.MoveTransport(DirectionType.Down);
+ break;
+ case "buttonLeft":
+ result = _drawningBulldozer.MoveTransport(DirectionType.Left);
+ break;
+ case "buttonRight":
+ result = _drawningBulldozer.MoveTransport(DirectionType.Right);
+ break;
+ }
+ if (result)
+ {
+ Draw();
+ }
+ }
+
+ }
+}
diff --git a/ProjectBulldozer/ProjectBulldozer/Form1.resx b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.resx
similarity index 93%
rename from ProjectBulldozer/ProjectBulldozer/Form1.resx
rename to ProjectBulldozer/ProjectBulldozer/FormBulldozer.resx
index 1af7de1..af32865 100644
--- a/ProjectBulldozer/ProjectBulldozer/Form1.resx
+++ b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.resx
@@ -1,17 +1,17 @@
-
diff --git a/ProjectBulldozer/ProjectBulldozer/Program.cs b/ProjectBulldozer/ProjectBulldozer/Program.cs
index 4341c6e..ce4d1f0 100644
--- a/ProjectBulldozer/ProjectBulldozer/Program.cs
+++ b/ProjectBulldozer/ProjectBulldozer/Program.cs
@@ -11,7 +11,7 @@ namespace ProjectBulldozer
// 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 FormBulldozer());
}
}
}
\ No newline at end of file
diff --git a/ProjectBulldozer/ProjectBulldozer/ProjectBulldozer.csproj b/ProjectBulldozer/ProjectBulldozer/ProjectBulldozer.csproj
index b57c89e..13ee123 100644
--- a/ProjectBulldozer/ProjectBulldozer/ProjectBulldozer.csproj
+++ b/ProjectBulldozer/ProjectBulldozer/ProjectBulldozer.csproj
@@ -8,4 +8,19 @@
enable
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
\ No newline at end of file
diff --git a/ProjectBulldozer/ProjectBulldozer/Properties/Resources.Designer.cs b/ProjectBulldozer/ProjectBulldozer/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..3741a43
--- /dev/null
+++ b/ProjectBulldozer/ProjectBulldozer/Properties/Resources.Designer.cs
@@ -0,0 +1,103 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace ProjectBulldozer.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("ProjectBulldozer.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 ArrowD {
+ get {
+ object obj = ResourceManager.GetObject("ArrowD", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap ArrowL {
+ get {
+ object obj = ResourceManager.GetObject("ArrowL", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap ArrowR {
+ get {
+ object obj = ResourceManager.GetObject("ArrowR", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap ArrowU {
+ get {
+ object obj = ResourceManager.GetObject("ArrowU", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/ProjectBulldozer/ProjectBulldozer/Properties/Resources.resx b/ProjectBulldozer/ProjectBulldozer/Properties/Resources.resx
new file mode 100644
index 0000000..1bbf8ec
--- /dev/null
+++ b/ProjectBulldozer/ProjectBulldozer/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\ArrowD.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\ArrowL.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\ArrowR.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\ArrowU.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file
diff --git a/ProjectBulldozer/ProjectBulldozer/Resources/ArrowD.png b/ProjectBulldozer/ProjectBulldozer/Resources/ArrowD.png
new file mode 100644
index 0000000..2089d92
Binary files /dev/null and b/ProjectBulldozer/ProjectBulldozer/Resources/ArrowD.png differ
diff --git a/ProjectBulldozer/ProjectBulldozer/Resources/ArrowL.png b/ProjectBulldozer/ProjectBulldozer/Resources/ArrowL.png
new file mode 100644
index 0000000..42f7014
Binary files /dev/null and b/ProjectBulldozer/ProjectBulldozer/Resources/ArrowL.png differ
diff --git a/ProjectBulldozer/ProjectBulldozer/Resources/ArrowR.png b/ProjectBulldozer/ProjectBulldozer/Resources/ArrowR.png
new file mode 100644
index 0000000..bd25dd1
Binary files /dev/null and b/ProjectBulldozer/ProjectBulldozer/Resources/ArrowR.png differ
diff --git a/ProjectBulldozer/ProjectBulldozer/Resources/ArrowU.png b/ProjectBulldozer/ProjectBulldozer/Resources/ArrowU.png
new file mode 100644
index 0000000..24cde44
Binary files /dev/null and b/ProjectBulldozer/ProjectBulldozer/Resources/ArrowU.png differ