diff --git a/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AbstractCompany.cs b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AbstractCompany.cs
new file mode 100644
index 0000000..8aef755
--- /dev/null
+++ b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AbstractCompany.cs
@@ -0,0 +1,117 @@
+using ProjectAirFighter.Drawnings;
+
+namespace ProjectAirFighter.CollectionGenericObjects;
+
+///
+/// Абстракция компании, хранящий коллекцию самолётов
+///
+public abstract class AbstractCompany
+{
+ ///
+ /// Размер места (ширина)
+ ///
+ protected readonly int _placeSizeWidth = 100;
+
+ ///
+ /// Размер места (высота)
+ ///
+ protected readonly int _placeSizeHeight = 100;
+
+ ///
+ /// Ширина окна
+ ///
+ protected readonly int _pictureWidth;
+
+ ///
+ /// Высота окна
+ ///
+ protected readonly int _pictureHeight;
+
+ ///
+ /// Коллекция самолётов
+ ///
+ protected ICollectionGenericObjects? _collection = null;
+
+ ///
+ /// Вычисление максимального количества элементов, который можно разместить в окне
+ ///
+ private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _placeSizeHeight);
+
+ ///
+ /// Конструктор
+ ///
+ /// Ширина окна
+ /// Высота окна
+ /// Коллекция самолётов
+ public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects collection)
+ {
+ _pictureWidth = picWidth;
+ _pictureHeight = picHeight;
+ _collection = collection;
+ _collection.SetMaxCount = GetMaxCount;
+ }
+
+ ///
+ /// Перегрузка оператора сложения для класса
+ ///
+ /// Компания
+ /// Добавляемый объект
+ ///
+ public static bool operator +(AbstractCompany company, DrawningAirCraft aircraft)
+ {
+ return company._collection?.Insert(aircraft) ?? false;
+ }
+
+ ///
+ /// Перегрузка оператора удаления для класса
+ ///
+ /// Компания
+ /// Номер удаляемого объекта
+ ///
+ public static bool operator -(AbstractCompany company, int position)
+ {
+ return company._collection?.Remove(position) ?? false;
+ }
+
+ ///
+ /// Получение случайного объекта из коллекции
+ ///
+ ///
+ public DrawningAirCraft? GetRandomObject()
+ {
+ Random rnd = new();
+ return _collection?.Get(rnd.Next(GetMaxCount));
+ }
+
+ ///
+ /// Вывод всей коллекции
+ ///
+ ///
+ public Bitmap? Show()
+ {
+ Bitmap bitmap = new(_pictureWidth, _pictureHeight);
+ Graphics graphics = Graphics.FromImage(bitmap);
+ DrawBackgound(graphics);
+
+ SetObjectsPosition();
+ for (int i = 0; i < (_collection?.Count ?? 0); ++i)
+ {
+ DrawningAirCraft? obj = _collection?.Get(i);
+ obj?.DrawTransport(graphics);
+ }
+
+ return bitmap;
+ }
+
+ ///
+ /// Вывод заднего фона
+ ///
+ ///
+ protected abstract void DrawBackgound(Graphics g);
+
+ ///
+ /// Расстановка объектов
+ ///
+ protected abstract void SetObjectsPosition();
+}
+
diff --git a/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftSharingService.cs b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftSharingService.cs
new file mode 100644
index 0000000..fe18316
--- /dev/null
+++ b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftSharingService.cs
@@ -0,0 +1,84 @@
+using ProjectAirFighter.Drawnings;
+
+namespace ProjectAirFighter.CollectionGenericObjects;
+
+///
+/// Реализация абстрактной компании - СимбирФлот
+///
+public class AirCraftSharingService : AbstractCompany
+{
+ ///
+ /// Конструктор
+ ///
+ ///
+ ///
+ ///
+ public AirCraftSharingService(int picWidth, int picHeight, ICollectionGenericObjects collection) : base(picWidth, picHeight, collection)
+ {
+ }
+ private int doroga = 40;
+ ///
+ /// Отрисовка хранилища
+ ///
+ /// Графика
+ protected override void DrawBackgound(Graphics g)
+ {
+ Pen pen = new Pen(Color.Black);
+
+ int X_max = (_pictureWidth / _placeSizeWidth);
+ int Y_max = (_pictureHeight / _placeSizeHeight);
+
+ for (int i = 0; i < X_max; i++)
+ {
+ for (int j = 0; j < Y_max; j++)
+ {
+ Point[] angars_1 = new Point[] {
+ new Point { X = i * doroga + i * _placeSizeWidth, Y = j * _placeSizeHeight},
+ new Point { X = _placeSizeWidth + i * doroga + i * _placeSizeWidth, Y = j * _placeSizeHeight}
+ };
+ g.DrawPolygon(pen, angars_1);
+
+ Point[] angars_2 = new Point[] {
+ new Point { X = i * doroga + i * _placeSizeWidth, Y = j * _placeSizeHeight},
+ new Point { X = i * doroga + i * _placeSizeWidth, Y = _placeSizeHeight + j * _placeSizeHeight}
+ };
+ g.DrawPolygon(pen, angars_2);
+
+ Point[] angars_3 = new Point[] {
+ new Point { X = i * doroga + i * _placeSizeWidth, Y = _placeSizeHeight + j * _placeSizeHeight},
+ new Point { X = _placeSizeWidth + i * doroga + i * _placeSizeWidth, Y = _placeSizeHeight + j * _placeSizeHeight}
+ };
+ g.DrawPolygon(pen, angars_3);
+ }
+ }
+ }
+ ///
+ /// Установка объекта в хранилища
+ ///
+ protected override void SetObjectsPosition()
+ {
+ int X_max = (_pictureWidth / _placeSizeWidth);
+ int Y_max = (_pictureHeight / _placeSizeHeight);
+
+ int granicaX = 10;
+ int granicaY = 10;
+ int num_ang = 0;
+
+ for (int j = 0; j < Y_max; j++)
+ {
+ for (int i = 0; i < X_max; i++)
+ {
+
+ if (_collection?.Get(num_ang) == null)
+ {
+ num_ang++;
+ continue;
+ }
+
+ _collection.Get(num_ang)?.SetPictureSize(_pictureWidth, _pictureHeight);
+ _collection.Get(num_ang)?.SetPosition(granicaX + i * _placeSizeWidth + i * doroga, granicaY + j * _placeSizeHeight);
+ num_ang++;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/ICollectionGenericObjects.cs b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/ICollectionGenericObjects.cs
new file mode 100644
index 0000000..b0c6992
--- /dev/null
+++ b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/ICollectionGenericObjects.cs
@@ -0,0 +1,48 @@
+namespace ProjectAirFighter.CollectionGenericObjects;
+
+///
+/// Интерфейс описания действий для набора хранимых объектов
+///
+/// Параметр: ограничение - ссылочный тип
+public interface ICollectionGenericObjects
+ where T : class
+{
+ ///
+ /// Количество объектов в коллекции
+ ///
+ int Count { get; }
+
+ ///
+ /// Установка максимального количества элементов
+ ///
+ int SetMaxCount { set; }
+
+ ///
+ /// Добавление объекта в коллекцию
+ ///
+ /// Добавляемый объект
+ /// true - вставка прошла удачно, false - вставка не удалась
+ bool Insert(T obj);
+
+ ///
+ /// Добавление объекта в коллекцию на конкретную позицию
+ ///
+ /// Добавляемый объект
+ /// Позиция
+ /// true - вставка прошла удачно, false - вставка не удалась
+ bool Insert(T obj, int position);
+
+ ///
+ /// Удаление объекта из коллекции с конкретной позиции
+ ///
+ /// Позиция
+ /// true - удаление прошло удачно, false - удаление не удалось
+ bool Remove(int position);
+
+ ///
+ /// Получение объекта по позиции
+ ///
+ /// Позиция
+ /// Объект
+ T? Get(int position);
+}
diff --git a/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/MassiveGenericObjects.cs
new file mode 100644
index 0000000..e1251b7
--- /dev/null
+++ b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/MassiveGenericObjects.cs
@@ -0,0 +1,97 @@
+namespace ProjectAirFighter.CollectionGenericObjects;
+
+///
+/// Параметризованный набор объектов
+///
+/// Параметр: ограничение - ссылочный тип
+public class MassiveGenericObjects : ICollectionGenericObjects
+ where T : class
+{
+ ///
+ /// Массив объектов, которые храним
+ ///
+ private T?[] _collection;
+
+ public int Count => _collection.Length;
+
+ public int SetMaxCount
+ {
+ set
+ {
+ if (value > 0)
+ {
+ if (_collection.Length > 0)
+ {
+ Array.Resize(ref _collection, value);
+ }
+ else
+ {
+ _collection = new T?[value];
+ }
+ }
+ }
+ }
+
+ ///
+ /// Конструктор
+ ///
+
+ public MassiveGenericObjects()
+ {
+ _collection = Array.Empty();
+ }
+
+ public T? Get(int position)
+ {
+ if (position < 0 || position >= _collection.Length)
+ {
+ return null;
+ }
+
+ return _collection[position];
+ }
+
+ public bool Insert(T obj)
+ {
+ for (int i = 0; i < _collection.Length; i++)
+ {
+ if (_collection[i] == null)
+ {
+ _collection[i] = obj;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public bool Insert(T obj, int position)
+ {
+ for (int i = position; i < Count; i++)
+ {
+ if (_collection[i] == null)
+ {
+ _collection[i] = obj;
+ return false;
+ }
+ }
+ for (int i = position - 1; i >= 0; --i)
+ {
+ if (_collection[i] == null)
+ {
+ _collection[i] = obj;
+ return true;
+ }
+ }
+ return false;
+ }
+ public bool Remove(int position)
+ {
+ if (position < 0 || position >= _collection.Length)
+ {
+ return false;
+ }
+
+ _collection[position] = null;
+ return true;
+ }
+}
diff --git a/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.Designer.cs b/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.Designer.cs
new file mode 100644
index 0000000..abc1f07
--- /dev/null
+++ b/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.Designer.cs
@@ -0,0 +1,173 @@
+namespace ProjectAirFighter
+{
+ partial class FormAirCraftCollection
+ {
+ ///
+ /// 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()
+ {
+ groupBoxTools = new GroupBox();
+ buttonRefresh = new Button();
+ buttonGoToCheck = new Button();
+ buttonRemoveAirCraft = new Button();
+ maskedTextBoxPosition = new MaskedTextBox();
+ buttonAddAirFighter = new Button();
+ buttonAddAirCraft = new Button();
+ comboBoxSelectorCompany = new ComboBox();
+ pictureBox = new PictureBox();
+ groupBoxTools.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
+ SuspendLayout();
+ //
+ // groupBoxTools
+ //
+ groupBoxTools.Controls.Add(buttonRefresh);
+ groupBoxTools.Controls.Add(buttonGoToCheck);
+ groupBoxTools.Controls.Add(buttonRemoveAirCraft);
+ groupBoxTools.Controls.Add(maskedTextBoxPosition);
+ groupBoxTools.Controls.Add(buttonAddAirFighter);
+ groupBoxTools.Controls.Add(buttonAddAirCraft);
+ groupBoxTools.Controls.Add(comboBoxSelectorCompany);
+ groupBoxTools.Dock = DockStyle.Right;
+ groupBoxTools.Location = new Point(828, 0);
+ groupBoxTools.Name = "groupBoxTools";
+ groupBoxTools.Size = new Size(215, 622);
+ groupBoxTools.TabIndex = 0;
+ groupBoxTools.TabStop = false;
+ groupBoxTools.Text = "Инструменты";
+ //
+ // buttonRefresh
+ //
+ buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonRefresh.Location = new Point(17, 536);
+ buttonRefresh.Name = "buttonRefresh";
+ buttonRefresh.Size = new Size(186, 49);
+ buttonRefresh.TabIndex = 6;
+ buttonRefresh.Text = "Обновить";
+ buttonRefresh.UseVisualStyleBackColor = true;
+ buttonRefresh.Click += ButtonRefresh_Click;
+ //
+ // buttonGoToCheck
+ //
+ buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonGoToCheck.Location = new Point(17, 381);
+ buttonGoToCheck.Name = "buttonGoToCheck";
+ buttonGoToCheck.Size = new Size(186, 49);
+ buttonGoToCheck.TabIndex = 5;
+ buttonGoToCheck.Text = "Передать на тесты";
+ buttonGoToCheck.UseVisualStyleBackColor = true;
+ buttonGoToCheck.Click += ButtonGoToCheck_Click;
+ //
+ // buttonRemoveAirCraft
+ //
+ buttonRemoveAirCraft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonRemoveAirCraft.Location = new Point(17, 287);
+ buttonRemoveAirCraft.Name = "buttonRemoveAirCraft";
+ buttonRemoveAirCraft.Size = new Size(186, 49);
+ buttonRemoveAirCraft.TabIndex = 4;
+ buttonRemoveAirCraft.Text = "Удаление самолёта";
+ buttonRemoveAirCraft.UseVisualStyleBackColor = true;
+ buttonRemoveAirCraft.Click += ButtonRemoveAirCraft_Click;
+ //
+ // maskedTextBoxPosition
+ //
+ maskedTextBoxPosition.Location = new Point(17, 222);
+ maskedTextBoxPosition.Mask = "00";
+ maskedTextBoxPosition.Name = "maskedTextBoxPosition";
+ maskedTextBoxPosition.Size = new Size(186, 27);
+ maskedTextBoxPosition.TabIndex = 3;
+ maskedTextBoxPosition.ValidatingType = typeof(int);
+ //
+ // buttonAddAirFighter
+ //
+ buttonAddAirFighter.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonAddAirFighter.Location = new Point(17, 147);
+ buttonAddAirFighter.Name = "buttonAddAirFighter";
+ buttonAddAirFighter.Size = new Size(186, 49);
+ buttonAddAirFighter.TabIndex = 2;
+ buttonAddAirFighter.Text = "Добавление истребителя";
+ buttonAddAirFighter.UseVisualStyleBackColor = true;
+ buttonAddAirFighter.Click += ButtonAddAirFighter_Click;
+ //
+ // buttonAddAirCraft
+ //
+ buttonAddAirCraft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonAddAirCraft.Location = new Point(17, 92);
+ buttonAddAirCraft.Name = "buttonAddAirCraft";
+ buttonAddAirCraft.Size = new Size(186, 49);
+ buttonAddAirCraft.TabIndex = 1;
+ buttonAddAirCraft.Text = "Добавление самолёта";
+ buttonAddAirCraft.UseVisualStyleBackColor = true;
+ buttonAddAirCraft.Click += ButtonAddAirCraft_Click;
+ //
+ // comboBoxSelectorCompany
+ //
+ comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
+ comboBoxSelectorCompany.FormattingEnabled = true;
+ comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
+ comboBoxSelectorCompany.Location = new Point(17, 26);
+ comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
+ comboBoxSelectorCompany.Size = new Size(186, 28);
+ comboBoxSelectorCompany.TabIndex = 0;
+ comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
+ //
+ // pictureBox
+ //
+ pictureBox.Dock = DockStyle.Fill;
+ pictureBox.Location = new Point(0, 0);
+ pictureBox.Name = "pictureBox";
+ pictureBox.Size = new Size(828, 622);
+ pictureBox.TabIndex = 1;
+ pictureBox.TabStop = false;
+ //
+ // FormAirCraftCollection
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(1043, 622);
+ Controls.Add(pictureBox);
+ Controls.Add(groupBoxTools);
+ Name = "FormAirCraftCollection";
+ Text = "Коллекция самолётов";
+ groupBoxTools.ResumeLayout(false);
+ groupBoxTools.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private GroupBox groupBoxTools;
+ private ComboBox comboBoxSelectorCompany;
+ private Button buttonAddAirCraft;
+ private Button buttonAddAirFighter;
+ private PictureBox pictureBox;
+ private Button buttonRemoveAirCraft;
+ private MaskedTextBox maskedTextBoxPosition;
+ private Button buttonRefresh;
+ private Button buttonGoToCheck;
+ }
+}
\ No newline at end of file
diff --git a/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.cs b/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.cs
new file mode 100644
index 0000000..1209648
--- /dev/null
+++ b/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.cs
@@ -0,0 +1,189 @@
+using ProjectAirFighter.CollectionGenericObjects;
+using ProjectAirFighter.Drawnings;
+
+namespace ProjectAirFighter;
+
+///
+/// Форма работы с компанией и ее коллекцией
+///
+public partial class FormAirCraftCollection : Form
+{
+ ///
+ /// Компания
+ ///
+ private AbstractCompany? _company = null;
+
+ ///
+ /// Конструктор
+ ///
+ public FormAirCraftCollection()
+ {
+ InitializeComponent();
+ }
+
+ ///
+ /// Выбор компании
+ ///
+ ///
+ ///
+ private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ switch (comboBoxSelectorCompany.Text)
+ {
+ case "Хранилище":
+ _company = new AirCraftSharingService(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects());
+ break;
+ }
+ }
+
+ ///
+ /// Добавление самолёта
+ ///
+ ///
+ ///
+ private void ButtonAddAirCraft_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirCraft));
+
+ ///
+ /// Добавление истебителя
+ ///
+ ///
+ ///
+ private void ButtonAddAirFighter_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirFighter));
+
+ ///
+ /// Создание объекта класса-перемещения
+ ///
+ /// Тип создаваемого объекта
+ private void CreateObject(string type)
+ {
+ if (_company == null)
+ {
+ return;
+ }
+
+ Random random = new();
+ DrawningAirCraft drawningAirCraft;
+ switch (type)
+ {
+ case nameof(DrawningAirCraft):
+ drawningAirCraft = new DrawningAirCraft(random.Next(100, 300), random.Next(1000, 3000), GetColor(random));
+ break;
+ case nameof(DrawningAirFighter):
+ // TODO вызов диалогового окна для выбора цвета
+ drawningAirCraft = new DrawningAirFighter(random.Next(100, 300), random.Next(1000, 3000),
+ GetColor(random),
+ GetColor(random),
+ Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
+ break;
+ default:
+ return;
+ }
+
+ if (_company + drawningAirCraft)
+ {
+ MessageBox.Show("Объект добавлен");
+ pictureBox.Image = _company.Show();
+ }
+ else
+ {
+ MessageBox.Show("Не удалось добавить объект");
+ }
+ }
+
+ ///
+ /// Получение цвета
+ ///
+ /// Генератор случайных чисел
+ ///
+ private static Color GetColor(Random random)
+ {
+ Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
+ ColorDialog dialog = new();
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ color = dialog.Color;
+ }
+
+ return color;
+ }
+
+ ///
+ /// Удаление объекта
+ ///
+ ///
+ ///
+ private void ButtonRemoveAirCraft_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company == null)
+ {
+ return;
+ }
+
+ if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
+ {
+ return;
+ }
+
+ int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
+ if (_company - pos)
+ {
+ MessageBox.Show("Объект удален");
+ pictureBox.Image = _company.Show();
+ }
+ else
+ {
+ MessageBox.Show("Не удалось удалить объект");
+ }
+ }
+
+ ///
+ /// Передача объекта в другую форму
+ ///
+ ///
+ ///
+ private void ButtonGoToCheck_Click(object sender, EventArgs e)
+ {
+ if (_company == null)
+ {
+ return;
+ }
+
+ DrawningAirCraft? aircraft = null;
+ int counter = 100;
+ while (aircraft == null)
+ {
+ aircraft = _company.GetRandomObject();
+ counter--;
+ if (counter <= 0)
+ {
+ break;
+ }
+ }
+
+ if (aircraft == null)
+ {
+ return;
+ }
+
+ FormAirFighter form = new()
+ {
+ SetAirCraft = aircraft
+ };
+ form.ShowDialog();
+ }
+
+ ///
+ /// Перерисовка коллекции
+ ///
+ ///
+ ///
+ private void ButtonRefresh_Click(object sender, EventArgs e)
+ {
+ if (_company == null)
+ {
+ return;
+ }
+
+ pictureBox.Image = _company.Show();
+ }
+}
diff --git a/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.resx b/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.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/ProjectAirFighter/ProjectAirFighter/FormAirFighter.Designer.cs b/ProjectAirFighter/ProjectAirFighter/FormAirFighter.Designer.cs
index 92391be..23d8a4a 100644
--- a/ProjectAirFighter/ProjectAirFighter/FormAirFighter.Designer.cs
+++ b/ProjectAirFighter/ProjectAirFighter/FormAirFighter.Designer.cs
@@ -29,12 +29,10 @@
private void InitializeComponent()
{
pictureBoxAirFighter = new PictureBox();
- buttonCreateAirFighter = new Button();
buttonLeft = new Button();
buttonUp = new Button();
buttonRight = new Button();
buttonDown = new Button();
- buttonСreateAirCraft = new Button();
comboBoxStrategy = new ComboBox();
buttonStrategyStep = new Button();
((System.ComponentModel.ISupportInitialize)pictureBoxAirFighter).BeginInit();
@@ -49,17 +47,6 @@
pictureBoxAirFighter.TabIndex = 0;
pictureBoxAirFighter.TabStop = false;
//
- // buttonCreateAirFighter
- //
- buttonCreateAirFighter.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
- buttonCreateAirFighter.Location = new Point(31, 470);
- buttonCreateAirFighter.Name = "buttonCreateAirFighter";
- buttonCreateAirFighter.Size = new Size(174, 39);
- buttonCreateAirFighter.TabIndex = 1;
- buttonCreateAirFighter.Text = "Создать истребить\r\n";
- buttonCreateAirFighter.UseVisualStyleBackColor = true;
- buttonCreateAirFighter.Click += ButtonCreateAirFighter_Click;
- //
// buttonLeft
//
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
@@ -108,17 +95,6 @@
buttonDown.UseVisualStyleBackColor = true;
buttonDown.Click += ButtonMove_Click;
//
- // buttonСreateAirCraft
- //
- buttonСreateAirCraft.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
- buttonСreateAirCraft.Location = new Point(242, 470);
- buttonСreateAirCraft.Name = "buttonСreateAirCraft";
- buttonСreateAirCraft.Size = new Size(174, 39);
- buttonСreateAirCraft.TabIndex = 6;
- buttonСreateAirCraft.Text = "Создать самолёт";
- buttonСreateAirCraft.UseVisualStyleBackColor = true;
- buttonСreateAirCraft.Click += buttonСreateAirCraft_Click;
- //
// comboBoxStrategy
//
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
@@ -146,12 +122,10 @@
ClientSize = new Size(800, 521);
Controls.Add(buttonStrategyStep);
Controls.Add(comboBoxStrategy);
- Controls.Add(buttonСreateAirCraft);
Controls.Add(buttonDown);
Controls.Add(buttonRight);
Controls.Add(buttonUp);
Controls.Add(buttonLeft);
- Controls.Add(buttonCreateAirFighter);
Controls.Add(pictureBoxAirFighter);
Name = "FormAirFighter";
Text = "Истребитель";
@@ -163,12 +137,10 @@
#endregion
private PictureBox pictureBoxAirFighter;
- private Button buttonCreateAirFighter;
private Button buttonLeft;
private Button buttonUp;
private Button buttonRight;
private Button buttonDown;
- private Button buttonСreateAirCraft;
private ComboBox comboBoxStrategy;
private Button buttonStrategyStep;
}
diff --git a/ProjectAirFighter/ProjectAirFighter/FormAirFighter.cs b/ProjectAirFighter/ProjectAirFighter/FormAirFighter.cs
index 233fa64..dec64cf 100644
--- a/ProjectAirFighter/ProjectAirFighter/FormAirFighter.cs
+++ b/ProjectAirFighter/ProjectAirFighter/FormAirFighter.cs
@@ -18,6 +18,21 @@ public partial class FormAirFighter : Form
///
private AbstractStrategy? _strategy;
+ ///
+ /// Получение объекта
+ ///
+ public DrawningAirCraft SetAirCraft
+ {
+ set
+ {
+ _drawningAirCraft = value;
+ _drawningAirCraft.SetPictureSize(pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
+ comboBoxStrategy.Enabled = true;
+ _strategy = null;
+ Draw();
+ }
+ }
+
///
/// Конструктор формы
///
@@ -43,50 +58,6 @@ public partial class FormAirFighter : Form
pictureBoxAirFighter.Image = bmp;
}
- ///
- /// Создание объекта класса-перемещения
- ///
- /// Тип создаваемого объекта
- private void CreateObject(string type)
- {
- Random random = new();
- switch (type)
- {
- case nameof(DrawningAirCraft):
- _drawningAirCraft = new DrawningAirCraft(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(DrawningAirFighter):
- _drawningAirCraft = new DrawningAirFighter(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;
- }
- _drawningAirCraft.SetPictureSize(pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
- _drawningAirCraft.SetPosition(random.Next(10, 100), random.Next(10, 100));
- _strategy = null;
- comboBoxStrategy.Enabled = true;
- Draw();
- }
-
- ///
- /// Обработка нажатия кнопки "Создать истребитель"
- ///
- ///
- ///
- private void ButtonCreateAirFighter_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirFighter));
-
- ///
- /// Обработка нажатия кнопки "Создать самолёт"
- ///
- ///
- ///
- private void buttonСreateAirCraft_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirCraft));
-
-
///
/// Перемещение объекта по форме (нажатие кнопок навигации)
///
diff --git a/ProjectAirFighter/ProjectAirFighter/Program.cs b/ProjectAirFighter/ProjectAirFighter/Program.cs
index fc87305..7addb2e 100644
--- a/ProjectAirFighter/ProjectAirFighter/Program.cs
+++ b/ProjectAirFighter/ProjectAirFighter/Program.cs
@@ -11,7 +11,7 @@ namespace ProjectAirFighter
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new FormAirFighter());
+ Application.Run(new FormAirCraftCollection());
}
}
}
\ No newline at end of file