diff --git a/AirBomber/AirBomber.csproj b/AirBomber/AirBomber.csproj
index b57c89e..13ee123 100644
--- a/AirBomber/AirBomber.csproj
+++ b/AirBomber/AirBomber.csproj
@@ -8,4 +8,19 @@
enable
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
\ No newline at end of file
diff --git a/AirBomber/AirBomber.sln b/AirBomber/AirBomber.sln
index 2408671..de22c18 100644
--- a/AirBomber/AirBomber.sln
+++ b/AirBomber/AirBomber.sln
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32901.215
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AirBomber", "AirBomber.csproj", "{15C0C31A-A5FF-4CDE-8018-2BD58B8D0687}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AirBomber", "AirBomber.csproj", "{4E086563-17EB-404C-9522-520DE8724E73}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -11,15 +11,15 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {15C0C31A-A5FF-4CDE-8018-2BD58B8D0687}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {15C0C31A-A5FF-4CDE-8018-2BD58B8D0687}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {15C0C31A-A5FF-4CDE-8018-2BD58B8D0687}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {15C0C31A-A5FF-4CDE-8018-2BD58B8D0687}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4E086563-17EB-404C-9522-520DE8724E73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4E086563-17EB-404C-9522-520DE8724E73}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4E086563-17EB-404C-9522-520DE8724E73}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4E086563-17EB-404C-9522-520DE8724E73}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {9564BBD8-86D9-40BD-BE9B-F4281275A166}
+ SolutionGuid = {6D8F316D-DF53-4881-ACA9-0D4697D43D6A}
EndGlobalSection
EndGlobal
diff --git a/AirBomber/DirectionType.cs b/AirBomber/DirectionType.cs
new file mode 100644
index 0000000..fc204b0
--- /dev/null
+++ b/AirBomber/DirectionType.cs
@@ -0,0 +1,27 @@
+namespace AirBomber;
+
+///
+/// Направление перемещения
+///
+public enum DirectionType
+{
+ ///
+ /// Вверх
+ ///
+ Up = 1,
+
+ ///
+ /// Вниз
+ ///
+ Down = 2,
+
+ ///
+ /// Влево
+ ///
+ Left = 3,
+
+ ///
+ /// Вправо
+ ///
+ Right = 4,
+}
diff --git a/AirBomber/DrawningAirBomber.cs b/AirBomber/DrawningAirBomber.cs
new file mode 100644
index 0000000..58ea0b7
--- /dev/null
+++ b/AirBomber/DrawningAirBomber.cs
@@ -0,0 +1,261 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http.Headers;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AirBomber;
+
+///
+/// Класс, отвечающий за отрисовку и перемещение объекта-сущности
+///
+public class DrawningAirBomber
+{
+ ///
+ /// Класс-сущность
+ ///
+ public EntityAirBomber? EntityAirBomber { get; private set; }
+ ///
+ /// Ширина окна отрисовки
+ ///
+ private int? _pictureWidth;
+ ///
+ /// Высота окна отрисовки
+ ///
+ private int? _pictureHeight;
+ ///
+ /// Левая координата отрисовки бомбардировщика
+ ///
+ public int? _startPosX;
+ ///
+ /// Верхняя координата отрисовки бомбардировщика
+ ///
+ private int? _startPosY;
+ ///
+ /// Ширина отрисовки бомбардировщика
+ ///
+ private readonly int _drawningAirBomberWidth = 140;
+ ///
+ /// Высота отрисовки бомбардировщика
+ ///
+ private readonly int _drawningAirBomberHeight = 128;
+ ///
+ ///
+ ///
+ /// Скорость
+ /// Вес
+ /// Основной цвет
+ /// Дополнительный цвет
+ /// Признак наличия бомб
+ /// Признак наличия дополнительный топливных баков
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bombs, bool fuelTanks)
+ {
+ EntityAirBomber = new EntityAirBomber();
+ EntityAirBomber.Init(speed, weight, bodyColor, additionalColor, bombs, fuelTanks);
+ _pictureHeight = null;
+ _pictureHeight = null;
+ _startPosX = null;
+ _startPosY = null;
+ }
+
+ ///
+ /// Установка границ поля
+ ///
+ /// <Ширина/param>
+ /// Высота
+ ///
+ public bool SetPictureSize(int width, int height)
+ {
+ if (_drawningAirBomberHeight > height || _drawningAirBomberWidth > width)
+ return false;
+ _pictureHeight = height;
+ _pictureWidth = width;
+
+ if (_startPosX.HasValue || _startPosY.HasValue)
+ {
+ if (_startPosX + _drawningAirBomberWidth > _pictureWidth)
+ _startPosX = _pictureWidth - _drawningAirBomberWidth;
+ else if (_startPosX < 0)
+ _startPosX = 0;
+ if (_startPosY + _drawningAirBomberHeight > _pictureHeight)
+ _startPosY = _pictureHeight - _drawningAirBomberHeight;
+ else if (_startPosY < 0)
+ _startPosY = 0;
+ }
+ return true;
+ }
+
+ ///
+ /// Установка позиции
+ ///
+ /// Координата X
+ /// Координата Y
+ public void SetPosition(int x, int y)
+ {
+ if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
+ {
+ return;
+ }
+ if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
+ return;
+ if (x + _drawningAirBomberWidth > _pictureWidth) _startPosX = _pictureWidth - _drawningAirBomberWidth;
+ else if (x < 0) _startPosX = 0;
+ else _startPosX = x;
+
+ if (y + _drawningAirBomberHeight > _pictureHeight) _startPosY = _pictureHeight - _drawningAirBomberHeight;
+ else if (y < 0) _startPosY = 0;
+ else _startPosY = y;
+ }
+
+
+ public bool MoveAirBomber(DirectionType direction)
+ {
+ if (EntityAirBomber == null || !_startPosX.HasValue || !_startPosY.HasValue)
+ {
+ return false;
+ }
+
+ switch (direction)
+ {
+ //влево
+ case DirectionType.Left:
+ if (_startPosX.Value - EntityAirBomber.Step > 0)
+ {
+ _startPosX -= (int)EntityAirBomber.Step;
+ }
+ return true;
+ //вверх
+ case DirectionType.Up:
+ if (_startPosY.Value - EntityAirBomber.Step > 0)
+ {
+ _startPosY -= (int)EntityAirBomber.Step;
+ }
+ return true;
+ //вправо
+ case DirectionType.Right :
+ if (_startPosX.Value + EntityAirBomber.Step + _drawningAirBomberWidth < _pictureWidth)
+ {
+ _startPosX += (int)EntityAirBomber.Step;
+ }
+ return true;
+ //вниз
+ case DirectionType.Down:
+ if (_startPosY + EntityAirBomber.Step + _drawningAirBomberHeight < _pictureHeight)
+ {
+ _startPosY += (int)EntityAirBomber.Step;
+ }
+ return true;
+ default:
+ return false;
+ }
+ }
+
+
+
+ ///
+ /// Прорисовка объекта
+ ///
+ ///
+ public void DrawAirBomber(Graphics g)
+ {
+ if (EntityAirBomber == null || !_startPosX.HasValue || !_startPosY.HasValue)
+ {
+ return;
+ }
+ Pen pen = new(Color.Black);
+ Brush additionalBrush = new
+ SolidBrush(EntityAirBomber.AdditionalColor);
+
+ if (EntityAirBomber.FuelTanks)
+ {
+ //Дополнительные топливные баки
+ g.FillEllipse(additionalBrush, _startPosX.Value + 90, _startPosY.Value + 50, 29, 29);
+ g.DrawEllipse(pen, _startPosX.Value + 90, _startPosY.Value + 50, 29, 29);
+
+ g.FillEllipse(additionalBrush, _startPosX.Value + 30, _startPosY.Value + 50, 29, 29);
+ g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 50, 29, 29);
+
+ }
+
+
+
+ Brush brGreen = new SolidBrush(Color.Green);
+ Brush brRed = new SolidBrush(Color.Red);
+ Brush BodyBrush = new SolidBrush(EntityAirBomber.BodyColor);
+
+
+ //Бомбы
+ if (EntityAirBomber.Bombs)
+ {
+ Point[] Bomb1Point = { new Point(_startPosX.Value + 77, _startPosY.Value + 125), new Point(_startPosX.Value + 84, _startPosY.Value + 128), new Point(_startPosX.Value + 84, _startPosY.Value + 120), new Point(_startPosX.Value + 79, _startPosY.Value + 122) };
+ g.FillPolygon(brGreen, Bomb1Point);
+ g.DrawLine(pen, _startPosX.Value + 77, _startPosY.Value + 125, _startPosX.Value + 84, _startPosY.Value + 128);
+ g.DrawLine(pen, _startPosX.Value + 84, _startPosY.Value + 128, _startPosX.Value + 84, _startPosY.Value + 120);
+ g.DrawLine(pen, _startPosX.Value + 84, _startPosY.Value + 120, _startPosX.Value + 79, _startPosY.Value + 122);
+ g.FillRectangle(brGreen, _startPosX.Value + 65, _startPosY.Value + 121, 5, 5);
+ g.DrawRectangle(pen, _startPosX.Value + 65, _startPosY.Value + 121, 5, 5);
+ Point[] BombNose1Point = { new Point(_startPosX.Value + 65, _startPosY.Value + 119), new Point(_startPosX.Value + 60, _startPosY.Value + 123), new Point(_startPosX.Value + 65, _startPosY.Value + 128) };
+ g.FillPolygon(brRed, BombNose1Point);
+
+ Point[] Bomb2Point = { new Point(_startPosX.Value + 77, _startPosY.Value + 3), new Point(_startPosX.Value + 84, _startPosY.Value), new Point(_startPosX.Value + 84, _startPosY.Value + 8), new Point(_startPosX.Value + 79, _startPosY.Value + 6) };
+ g.FillPolygon(brGreen, Bomb2Point);
+ g.DrawLine(pen, _startPosX.Value + 77, _startPosY.Value + 3, _startPosX.Value + 84, _startPosY.Value);
+ g.DrawLine(pen, _startPosX.Value + 84, _startPosY.Value, _startPosX.Value + 84, _startPosY.Value + 8);
+ g.DrawLine(pen, _startPosX.Value + 84, _startPosY.Value + 8, _startPosX.Value + 79, _startPosY.Value + 6);
+ g.FillRectangle(brGreen, _startPosX.Value + 65, _startPosY.Value + 2, 5, 5);
+ g.DrawRectangle(pen, _startPosX.Value + 65, _startPosY.Value + 2, 5, 5);
+ Point[] BombNose2Point = { new Point(_startPosX.Value + 65, _startPosY.Value + 9), new Point(_startPosX.Value + 60, _startPosY.Value + 5), new Point(_startPosX.Value + 65, _startPosY.Value) };
+ g.FillPolygon(brRed, BombNose2Point);
+ }
+
+
+
+
+
+
+ //Корпус
+ Brush brGray = new SolidBrush(Color.Gray);
+ g.FillRectangle(BodyBrush, _startPosX.Value + 20, _startPosY.Value + 55, 120, 18);
+ g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 55, 120, 18);
+ //Нос
+ Brush brBlack = new SolidBrush(Color.Black);
+ Point[] NosePoints = { new Point(_startPosX.Value + 20, _startPosY.Value + 55), new Point(_startPosX.Value, _startPosY.Value + 64), new Point(_startPosX.Value + 20, _startPosY.Value + 73) };
+ g.FillPolygon(brBlack, NosePoints);
+ g.DrawLine(pen, _startPosX.Value + 20, _startPosY.Value + 55, _startPosX.Value, _startPosY.Value + 64);
+ g.DrawLine(pen, _startPosX.Value, _startPosY.Value + 64, _startPosX.Value + 20, _startPosY.Value + 73);
+
+ //Крылья
+
+ Point[] UpperWingPoint = { new Point(_startPosX.Value + 71, _startPosY.Value + 55), new Point(_startPosX.Value + 71, _startPosY.Value + 1), new Point(_startPosX.Value + 77, _startPosY.Value + 1), new Point(_startPosX.Value + 85, _startPosY.Value + 54) };
+ g.FillPolygon(BodyBrush, UpperWingPoint);
+ g.DrawLine(pen, _startPosX.Value + 70, _startPosY.Value + 55, _startPosX.Value + 70, _startPosY.Value);
+ g.DrawLine(pen, _startPosX.Value + 70, _startPosY.Value, _startPosX.Value + 77, _startPosY.Value);
+ g.DrawLine(pen, _startPosX.Value + 77, _startPosY.Value, _startPosX.Value + 85, _startPosY.Value + 55);
+
+
+ Point[] LowerWingPoint = { new Point(_startPosX.Value + 71, _startPosY.Value + 74), new Point(_startPosX.Value + 71, _startPosY.Value + 128), new Point(_startPosX.Value + 77, _startPosY.Value + 128), new Point(_startPosX.Value + 85, _startPosY.Value + 74) };
+ g.FillPolygon(BodyBrush, LowerWingPoint);
+ g.DrawLine(pen, _startPosX.Value + 70, _startPosY.Value + 73, _startPosX.Value + 70, _startPosY.Value + 128);
+ g.DrawLine(pen, _startPosX.Value + 70, _startPosY.Value + 128, _startPosX.Value + 77, _startPosY.Value + 128);
+ g.DrawLine(pen, _startPosX.Value + 77, _startPosY.Value + 128, _startPosX.Value + 85, _startPosY.Value + 73);
+
+
+ //Хвост
+ Point[] UpTailPoint = { new Point(_startPosX.Value + 140, _startPosY.Value + 55), new Point(_startPosX.Value + 140, _startPosY.Value + 27), new Point(_startPosX.Value + 120, _startPosY.Value + 46), new Point(_startPosX.Value + 120, _startPosY.Value + 55) };
+ g.FillPolygon(BodyBrush, UpTailPoint);
+ g.DrawLine(pen, _startPosX.Value + 140, _startPosY.Value + 55, _startPosX.Value + 140, _startPosY.Value + 27);
+ g.DrawLine(pen, _startPosX.Value + 140, _startPosY.Value + 27, _startPosX.Value + 120, _startPosY.Value + 46);
+ g.DrawLine(pen, _startPosX.Value + 120, _startPosY.Value + 46, _startPosX.Value + 120, _startPosY.Value + 55);
+
+ Point[] LowerTailPoint = { new Point(_startPosX.Value + 140, _startPosY.Value + 73), new Point(_startPosX.Value + 140, _startPosY.Value + 102), new Point(_startPosX.Value + 120, _startPosY.Value + 83), new Point(_startPosX.Value + 120, _startPosY.Value + 55) };
+ g.FillPolygon(BodyBrush, LowerTailPoint);
+ g.DrawLine(pen, _startPosX.Value + 140, _startPosY.Value + 73, _startPosX.Value + 140, _startPosY.Value + 102);
+ g.DrawLine(pen, _startPosX.Value + 140, _startPosY.Value + 102, _startPosX.Value + 120, _startPosY.Value + 83);
+ g.DrawLine(pen, _startPosX.Value + 120, _startPosY.Value + 83, _startPosX.Value + 120, _startPosY.Value + 73);
+ g.DrawLine(pen, _startPosX.Value + 140, _startPosY.Value + 73, _startPosX.Value + 100, _startPosY.Value + 73);
+
+ }
+}
+
\ No newline at end of file
diff --git a/AirBomber/EntityAirBomber.cs b/AirBomber/EntityAirBomber.cs
new file mode 100644
index 0000000..d19e4a6
--- /dev/null
+++ b/AirBomber/EntityAirBomber.cs
@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AirBomber
+{
+ public class EntityAirBomber
+ {
+ ///
+ /// Скорость
+ ///
+ 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 Bombs { get; private set; }
+ ///
+ /// Признак (опция) наличия дополнительных топливных баков
+ ///
+ public bool FuelTanks { get; private set; }
+ ///
+ /// Шаг перемещения
+ ///
+ public double Step => Speed * 100 / Weight;
+
+
+ ///
+ ///
+ ///
+ /// Скорость
+ /// Вес
+ /// Основной цвет
+ /// Дополнительный цвет
+ /// Признак наличия бомб
+ /// Признак наличия дополнительных топливных баков
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bombs, bool fuelTanks)
+ {
+ Speed = speed;
+ Weight = weight;
+ BodyColor = bodyColor;
+ AdditionalColor = additionalColor;
+ Bombs = bombs;
+ FuelTanks = fuelTanks;
+ }
+ }
+}
diff --git a/AirBomber/Form1.Designer.cs b/AirBomber/Form1.Designer.cs
deleted file mode 100644
index 185eea6..0000000
--- a/AirBomber/Form1.Designer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace AirBomber
-{
- 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/AirBomber/Form1.cs b/AirBomber/Form1.cs
deleted file mode 100644
index 0ca8021..0000000
--- a/AirBomber/Form1.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace AirBomber
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- }
-}
\ No newline at end of file
diff --git a/AirBomber/FormAirBomber.Designer.cs b/AirBomber/FormAirBomber.Designer.cs
new file mode 100644
index 0000000..f2a4f32
--- /dev/null
+++ b/AirBomber/FormAirBomber.Designer.cs
@@ -0,0 +1,137 @@
+namespace AirBomber
+{
+ partial class FormAirBomber
+ {
+ ///
+ /// 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.buttonCreate = new System.Windows.Forms.Button();
+ this.ButtonRight = new System.Windows.Forms.Button();
+ this.ButtonUp = new System.Windows.Forms.Button();
+ this.ButtonLeft = new System.Windows.Forms.Button();
+ this.ButtonDown = new System.Windows.Forms.Button();
+ this.pictureBoxAirBomber = new System.Windows.Forms.PictureBox();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirBomber)).BeginInit();
+ this.SuspendLayout();
+ //
+ // buttonCreate
+ //
+ this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.buttonCreate.Location = new System.Drawing.Point(12, 575);
+ this.buttonCreate.Name = "buttonCreate";
+ this.buttonCreate.Size = new System.Drawing.Size(128, 33);
+ this.buttonCreate.TabIndex = 0;
+ this.buttonCreate.Text = "Создать";
+ this.buttonCreate.UseVisualStyleBackColor = true;
+ this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
+ //
+ // ButtonRight
+ //
+ this.ButtonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.ButtonRight.BackgroundImage = global::AirBomber.Properties.Resources.arrowRight;
+ this.ButtonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.ButtonRight.Location = new System.Drawing.Point(905, 560);
+ this.ButtonRight.Name = "ButtonRight";
+ this.ButtonRight.Size = new System.Drawing.Size(50, 48);
+ this.ButtonRight.TabIndex = 1;
+ this.ButtonRight.UseVisualStyleBackColor = true;
+ this.ButtonRight.Click += new System.EventHandler(this.ButtonMove_Click);
+ //
+ // ButtonUp
+ //
+ this.ButtonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.ButtonUp.BackgroundImage = global::AirBomber.Properties.Resources.arrowUp;
+ this.ButtonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.ButtonUp.Location = new System.Drawing.Point(849, 506);
+ this.ButtonUp.Name = "ButtonUp";
+ this.ButtonUp.Size = new System.Drawing.Size(50, 48);
+ this.ButtonUp.TabIndex = 2;
+ this.ButtonUp.UseVisualStyleBackColor = true;
+ this.ButtonUp.Click += new System.EventHandler(this.ButtonMove_Click);
+ //
+ // ButtonLeft
+ //
+ this.ButtonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.ButtonLeft.BackgroundImage = global::AirBomber.Properties.Resources.arrowLeft;
+ this.ButtonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.ButtonLeft.Location = new System.Drawing.Point(793, 560);
+ this.ButtonLeft.Name = "ButtonLeft";
+ this.ButtonLeft.Size = new System.Drawing.Size(50, 48);
+ this.ButtonLeft.TabIndex = 3;
+ this.ButtonLeft.UseVisualStyleBackColor = true;
+ this.ButtonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
+ //
+ // ButtonDown
+ //
+ this.ButtonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.ButtonDown.BackgroundImage = global::AirBomber.Properties.Resources.arrowDown;
+ this.ButtonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.ButtonDown.Location = new System.Drawing.Point(849, 560);
+ this.ButtonDown.Name = "ButtonDown";
+ this.ButtonDown.Size = new System.Drawing.Size(50, 48);
+ this.ButtonDown.TabIndex = 4;
+ this.ButtonDown.UseVisualStyleBackColor = true;
+ this.ButtonDown.Click += new System.EventHandler(this.ButtonMove_Click);
+ //
+ // pictureBoxAirBomber
+ //
+ this.pictureBoxAirBomber.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pictureBoxAirBomber.Location = new System.Drawing.Point(0, 0);
+ this.pictureBoxAirBomber.Name = "pictureBoxAirBomber";
+ this.pictureBoxAirBomber.Size = new System.Drawing.Size(967, 621);
+ this.pictureBoxAirBomber.TabIndex = 5;
+ this.pictureBoxAirBomber.TabStop = false;
+ this.pictureBoxAirBomber.Click += new System.EventHandler(this.pictureBoxAirBomber_Click);
+ this.pictureBoxAirBomber.Resize += new System.EventHandler(this.PictureBoxResize);
+ //
+ // FormAirBomber
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(967, 621);
+ this.Controls.Add(this.ButtonDown);
+ this.Controls.Add(this.ButtonLeft);
+ this.Controls.Add(this.ButtonUp);
+ this.Controls.Add(this.ButtonRight);
+ this.Controls.Add(this.buttonCreate);
+ this.Controls.Add(this.pictureBoxAirBomber);
+ this.Name = "FormAirBomber";
+ this.Text = "AirBomber";
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirBomber)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private Button buttonCreate;
+ private Button ButtonRight;
+ private Button ButtonUp;
+ private Button ButtonLeft;
+ private Button ButtonDown;
+ private PictureBox pictureBoxAirBomber;
+ }
+}
\ No newline at end of file
diff --git a/AirBomber/FormAirBomber.cs b/AirBomber/FormAirBomber.cs
new file mode 100644
index 0000000..75237b5
--- /dev/null
+++ b/AirBomber/FormAirBomber.cs
@@ -0,0 +1,81 @@
+namespace AirBomber
+{
+ public partial class FormAirBomber : Form
+ {
+ private DrawningAirBomber _drawingAirBomber;
+ public FormAirBomber()
+ {
+ InitializeComponent();
+ }
+
+
+ private void Draw()
+ {
+ Bitmap bpm = new(pictureBoxAirBomber.Width, pictureBoxAirBomber.Height);
+ Graphics gr = Graphics.FromImage(bpm);
+ _drawingAirBomber.DrawAirBomber(gr);
+ pictureBoxAirBomber.Image = bpm;
+ }
+
+
+
+ private void buttonCreate_Click(object sender, EventArgs e)
+ {
+ Random random = new();
+ _drawingAirBomber = new DrawningAirBomber();
+ _drawingAirBomber.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)));
+ _drawingAirBomber.SetPictureSize(pictureBoxAirBomber.Width, pictureBoxAirBomber.Height);
+ _drawingAirBomber.SetPosition(random.Next(10, 100), random.Next(10, 100));
+
+ Draw();
+ }
+
+ private void pictureBoxAirBomber_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void ButtonUp_Click(object sender, EventArgs e)
+ {
+
+ }
+ private void ButtonMove_Click(object sender, EventArgs e)
+ {
+ if (_drawingAirBomber == null)
+ {
+ return;
+ }
+
+ string name = ((Button)sender)?.Name ?? string.Empty;
+ bool result = false;
+ switch (name)
+ {
+ case "ButtonUp":
+ result = _drawingAirBomber.MoveAirBomber(DirectionType.Up);
+ break;
+ case "ButtonDown":
+ result = _drawingAirBomber.MoveAirBomber(DirectionType.Down);
+ break;
+ case "ButtonLeft":
+ result = _drawingAirBomber.MoveAirBomber(DirectionType.Left);
+ break;
+ case "ButtonRight":
+ result = _drawingAirBomber.MoveAirBomber(DirectionType.Right);
+ break;
+ }
+ if (result)
+ {
+ Draw();
+ }
+ }
+
+ private void PictureBoxResize(object sender, EventArgs e)
+ {
+ _drawingAirBomber?.SetPictureSize(pictureBoxAirBomber.Width, pictureBoxAirBomber.Height);
+ Draw();
+ }
+ }
+}
\ No newline at end of file
diff --git a/AirBomber/FormAirBomber.resx b/AirBomber/FormAirBomber.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/AirBomber/FormAirBomber.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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/AirBomber/Program.cs b/AirBomber/Program.cs
index 34d9512..76b85fe 100644
--- a/AirBomber/Program.cs
+++ b/AirBomber/Program.cs
@@ -11,7 +11,7 @@ namespace AirBomber
// 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 FormAirBomber());
}
}
}
\ No newline at end of file
diff --git a/AirBomber/Properties/Resources.Designer.cs b/AirBomber/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..c458e7e
--- /dev/null
+++ b/AirBomber/Properties/Resources.Designer.cs
@@ -0,0 +1,103 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace AirBomber.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("AirBomber.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 arrowDown {
+ get {
+ object obj = ResourceManager.GetObject("arrowDown", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap arrowLeft {
+ get {
+ object obj = ResourceManager.GetObject("arrowLeft", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap arrowRight {
+ get {
+ object obj = ResourceManager.GetObject("arrowRight", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap arrowUp {
+ get {
+ object obj = ResourceManager.GetObject("arrowUp", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/AirBomber/Form1.resx b/AirBomber/Properties/Resources.resx
similarity index 83%
rename from AirBomber/Form1.resx
rename to AirBomber/Properties/Resources.resx
index 1af7de1..99d105f 100644
--- a/AirBomber/Form1.resx
+++ b/AirBomber/Properties/Resources.resx
@@ -117,4 +117,17 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ ..\Resources\arrowDown1.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\arrowLeft1.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\arrowRight1.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\arrowUp1.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/AirBomber/Resources/arrowDown.jpg b/AirBomber/Resources/arrowDown.jpg
new file mode 100644
index 0000000..f21002e
Binary files /dev/null and b/AirBomber/Resources/arrowDown.jpg differ
diff --git a/AirBomber/Resources/arrowLeft.jpg b/AirBomber/Resources/arrowLeft.jpg
new file mode 100644
index 0000000..61b8dae
Binary files /dev/null and b/AirBomber/Resources/arrowLeft.jpg differ
diff --git a/AirBomber/Resources/arrowRight.jpg b/AirBomber/Resources/arrowRight.jpg
new file mode 100644
index 0000000..b440197
Binary files /dev/null and b/AirBomber/Resources/arrowRight.jpg differ
diff --git a/AirBomber/Resources/arrowUp.jpg b/AirBomber/Resources/arrowUp.jpg
new file mode 100644
index 0000000..e630cea
Binary files /dev/null and b/AirBomber/Resources/arrowUp.jpg differ