From 343dbf9f6d1a5a51f3481be859e39755950e0208 Mon Sep 17 00:00:00 2001 From: artur-kalimullin <144933634+artur-kalimullin@users.noreply.github.com> Date: Wed, 13 Mar 2024 14:10:53 +0400 Subject: [PATCH 1/3] =?UTF-8?q?=D0=9A=D0=BE=D0=B4=20=D0=B1=D0=B5=D0=B7=20?= =?UTF-8?q?=D0=A2=D0=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractCompany.cs | 117 +++++++++++ .../AirCraftSharingService.cs | 84 ++++++++ .../ICollectionGenericObjects.cs | 48 +++++ .../MassiveGenericObjects.cs | 97 +++++++++ .../FormAirCraftCollection.Designer.cs | 173 ++++++++++++++++ .../FormAirCraftCollection.cs | 189 ++++++++++++++++++ .../FormAirCraftCollection.resx | 120 +++++++++++ .../FormAirFighter.Designer.cs | 28 --- .../ProjectAirFighter/FormAirFighter.cs | 59 ++---- .../ProjectAirFighter/Program.cs | 2 +- 10 files changed, 844 insertions(+), 73 deletions(-) create mode 100644 ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AbstractCompany.cs create mode 100644 ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftSharingService.cs create mode 100644 ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/ICollectionGenericObjects.cs create mode 100644 ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/MassiveGenericObjects.cs create mode 100644 ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.Designer.cs create mode 100644 ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.cs create mode 100644 ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.resx 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 -- 2.25.1 From a1f80b6ca7af184981c53768fb94f667c2a481e8 Mon Sep 17 00:00:00 2001 From: artur-kalimullin <144933634+artur-kalimullin@users.noreply.github.com> Date: Tue, 19 Mar 2024 15:19:07 +0400 Subject: [PATCH 2/3] =?UTF-8?q?=D0=9A=D0=BE=D0=BC=D0=BF=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractCompany.cs | 10 +- .../CollectionGenericObjects/AirCraftAngar.cs | 62 ++++++++++ .../AirCraftSharingService.cs | 84 -------------- .../ICollectionGenericObjects.cs | 11 +- .../MassiveGenericObjects.cs | 107 +++++++++++------- .../Drawnings/DrawningAirFighter.cs | 2 +- .../FormAirCraftCollection.Designer.cs | 4 +- .../FormAirCraftCollection.cs | 10 +- 8 files changed, 146 insertions(+), 144 deletions(-) create mode 100644 ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftAngar.cs delete mode 100644 ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftSharingService.cs diff --git a/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AbstractCompany.cs b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AbstractCompany.cs index 8aef755..1cca3fd 100644 --- a/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AbstractCompany.cs +++ b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AbstractCompany.cs @@ -15,7 +15,7 @@ public abstract class AbstractCompany /// /// Размер места (высота) /// - protected readonly int _placeSizeHeight = 100; + protected readonly int _placeSizeHeight = 86; /// /// Ширина окна @@ -57,9 +57,9 @@ public abstract class AbstractCompany /// Компания /// Добавляемый объект /// - public static bool operator +(AbstractCompany company, DrawningAirCraft aircraft) + public static int operator +(AbstractCompany company, DrawningAirCraft aircraft) { - return company._collection?.Insert(aircraft) ?? false; + return company._collection.Insert(aircraft); } /// @@ -68,9 +68,9 @@ public abstract class AbstractCompany /// Компания /// Номер удаляемого объекта /// - public static bool operator -(AbstractCompany company, int position) + public static DrawningAirCraft? operator -(AbstractCompany company, int position) { - return company._collection?.Remove(position) ?? false; + return company._collection?.Remove(position); } /// diff --git a/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftAngar.cs b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftAngar.cs new file mode 100644 index 0000000..b4ced2c --- /dev/null +++ b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftAngar.cs @@ -0,0 +1,62 @@ +using ProjectAirFighter.Drawnings; + +namespace ProjectAirFighter.CollectionGenericObjects; + +/// +/// Реализация абстрактной компании - СимбирФлот +/// +public class AirCraftAngar : AbstractCompany +{ + /// + /// Конструктор + /// + /// + /// + /// + public AirCraftAngar(int picWidth, int picHeight, ICollectionGenericObjects collection) : base(picWidth, picHeight, collection) + { + } + /// + /// Отрисовка хранилища + /// + /// Графика + int pamat_i = 0; + protected override void DrawBackgound(Graphics g) + { + Pen pen = new(Color.Black, 4); + for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++) + { + pamat_i = i; + for (int j = 0; j < _pictureHeight / _placeSizeHeight; j++) + { + g.DrawLine(pen, new(_placeSizeWidth * i, _placeSizeHeight * j), new((int)(_placeSizeWidth * (i + 0.5f)), _placeSizeHeight * j)); + g.DrawLine(pen, new(_placeSizeWidth * i, _placeSizeHeight * j), new(_placeSizeWidth * i, _placeSizeHeight * (j + 1))); + } + g.DrawLine(pen, new(_placeSizeWidth * i, _placeSizeHeight * (_pictureHeight / _placeSizeHeight)), new((int)(_placeSizeWidth * (i + 0.5f)), _placeSizeHeight * (_pictureHeight / _placeSizeHeight))); + } + + + } + /// + /// Установка объекта в Ангар + /// + protected override void SetObjectsPosition() + { + int currentIndex = -1; + for (int j = 0 ; j < _pictureHeight / _placeSizeHeight; j++) + { + for (int i = pamat_i; i >= 0; i--) + { + currentIndex++; + if (_collection?.Get(currentIndex) == null) continue; + + _collection.Get(currentIndex)?.SetPictureSize(_pictureWidth, _pictureHeight); + _collection.Get(currentIndex)?.SetPosition(i * _placeSizeWidth + 5, j * _placeSizeHeight + 5); + } + } + } +} + + + + diff --git a/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftSharingService.cs b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftSharingService.cs deleted file mode 100644 index fe18316..0000000 --- a/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftSharingService.cs +++ /dev/null @@ -1,84 +0,0 @@ -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 index b0c6992..e5c620d 100644 --- a/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/ICollectionGenericObjects.cs +++ b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/ICollectionGenericObjects.cs @@ -1,5 +1,9 @@ namespace ProjectAirFighter.CollectionGenericObjects; +/// +/// Интерфейс описания действий для набора хранимых объектов +/// +/// Параметр: ограничение - ссылочный тип /// /// Интерфейс описания действий для набора хранимых объектов /// @@ -22,7 +26,7 @@ public interface ICollectionGenericObjects /// /// Добавляемый объект /// true - вставка прошла удачно, false - вставка не удалась - bool Insert(T obj); + int Insert(T obj); /// /// Добавление объекта в коллекцию на конкретную позицию @@ -30,14 +34,14 @@ public interface ICollectionGenericObjects /// Добавляемый объект /// Позиция /// true - вставка прошла удачно, false - вставка не удалась - bool Insert(T obj, int position); + int Insert(T obj, int position); /// /// Удаление объекта из коллекции с конкретной позиции /// /// Позиция /// true - удаление прошло удачно, false - удаление не удалось - bool Remove(int position); + T? Remove(int position); /// /// Получение объекта по позиции @@ -46,3 +50,4 @@ public interface ICollectionGenericObjects /// Объект T? Get(int position); } + diff --git a/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/MassiveGenericObjects.cs index e1251b7..db6fef0 100644 --- a/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/MassiveGenericObjects.cs +++ b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/MassiveGenericObjects.cs @@ -43,55 +43,74 @@ public class MassiveGenericObjects : ICollectionGenericObjects public T? Get(int position) { - if (position < 0 || position >= _collection.Length) + if (position >= 0 && position < Count) + { + return _collection[position]; + } + + return null; + } + + public int Insert(T obj) + { + return Insert(obj, 0); + } + + public int Insert(T obj, int position) + { + + if (position < 0 || position >= Count) + { + return -1; + } + + if (_collection[position] != null) + { + bool pushed = false; + for (int index = position + 1; index < Count; index++) + { + if (_collection[index] == null) + { + position = index; + pushed = true; + break; + } + } + + if (!pushed) + { + for (int index = position - 1; index >= 0; index--) + { + if (_collection[index] == null) + { + position = index; + pushed = true; + break; + } + } + } + + if (!pushed) + { + return position; + } + } + + _collection[position] = obj; + return position; + } + + public T? Remove(int position) + { + if (position < 0 || position >= Count) { 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; - } + if (_collection[position] == null) return null; + T? temp = _collection[position]; _collection[position] = null; - return true; + return temp; } } diff --git a/ProjectAirFighter/ProjectAirFighter/Drawnings/DrawningAirFighter.cs b/ProjectAirFighter/ProjectAirFighter/Drawnings/DrawningAirFighter.cs index 745fcff..c082092 100644 --- a/ProjectAirFighter/ProjectAirFighter/Drawnings/DrawningAirFighter.cs +++ b/ProjectAirFighter/ProjectAirFighter/Drawnings/DrawningAirFighter.cs @@ -16,7 +16,7 @@ public class DrawningAirFighter : DrawningAirCraft /// Дополнительный цвет /// Признак наличия ПГО /// Признак наличия ракет - public DrawningAirFighter(int speed, double weight, Color bodyColor, Color additionalColor, bool pgo, bool rockets) : base(76, 80) + public DrawningAirFighter(int speed, double weight, Color bodyColor, Color additionalColor, bool pgo, bool rockets) : base(66, 74) { EntityAirCraft = new EntityAirFighter(speed, weight, bodyColor, additionalColor, pgo, rockets); } diff --git a/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.Designer.cs b/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.Designer.cs index abc1f07..0df1b57 100644 --- a/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.Designer.cs +++ b/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.Designer.cs @@ -118,7 +118,7 @@ buttonAddAirCraft.Name = "buttonAddAirCraft"; buttonAddAirCraft.Size = new Size(186, 49); buttonAddAirCraft.TabIndex = 1; - buttonAddAirCraft.Text = "Добавление самолёта"; + buttonAddAirCraft.Text = "Добавление военного самолёта"; buttonAddAirCraft.UseVisualStyleBackColor = true; buttonAddAirCraft.Click += ButtonAddAirCraft_Click; // @@ -127,7 +127,7 @@ comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxSelectorCompany.FormattingEnabled = true; - comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" }); + comboBoxSelectorCompany.Items.AddRange(new object[] { "Ангар" }); comboBoxSelectorCompany.Location = new Point(17, 26); comboBoxSelectorCompany.Name = "comboBoxSelectorCompany"; comboBoxSelectorCompany.Size = new Size(186, 28); diff --git a/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.cs b/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.cs index 1209648..6906aa9 100644 --- a/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.cs +++ b/ProjectAirFighter/ProjectAirFighter/FormAirCraftCollection.cs @@ -30,8 +30,8 @@ public partial class FormAirCraftCollection : Form { switch (comboBoxSelectorCompany.Text) { - case "Хранилище": - _company = new AirCraftSharingService(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects()); + case "Ангар": + _company = new AirCraftAngar(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects()); break; } } @@ -79,14 +79,14 @@ public partial class FormAirCraftCollection : Form return; } - if (_company + drawningAirCraft) + if (_company + drawningAirCraft != -1) { MessageBox.Show("Объект добавлен"); pictureBox.Image = _company.Show(); } else { - MessageBox.Show("Не удалось добавить объект"); + _ = MessageBox.Show(drawningAirCraft.ToString()); } } @@ -125,7 +125,7 @@ public partial class FormAirCraftCollection : Form } int pos = Convert.ToInt32(maskedTextBoxPosition.Text); - if (_company - pos) + if (_company - pos != null) { MessageBox.Show("Объект удален"); pictureBox.Image = _company.Show(); -- 2.25.1 From 9daa025f96f693ae5635e71e26dac4de321d4e8a Mon Sep 17 00:00:00 2001 From: artur-kalimullin <144933634+artur-kalimullin@users.noreply.github.com> Date: Tue, 26 Mar 2024 22:44:58 +0400 Subject: [PATCH 3/3] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D0=B2=D1=81=D1=82=D0=B0=D0=B2=D0=BA=D0=B8?= =?UTF-8?q?=20=D0=BE=D0=B1=D1=8C=D0=B5=D0=BA=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CollectionGenericObjects/AirCraftAngar.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftAngar.cs b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftAngar.cs index b4ced2c..a2c59ad 100644 --- a/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftAngar.cs +++ b/ProjectAirFighter/ProjectAirFighter/CollectionGenericObjects/AirCraftAngar.cs @@ -21,6 +21,7 @@ public class AirCraftAngar : AbstractCompany /// /// Графика int pamat_i = 0; + int pamat_j = 0; protected override void DrawBackgound(Graphics g) { Pen pen = new(Color.Black, 4); @@ -29,6 +30,7 @@ public class AirCraftAngar : AbstractCompany pamat_i = i; for (int j = 0; j < _pictureHeight / _placeSizeHeight; j++) { + pamat_j = j; g.DrawLine(pen, new(_placeSizeWidth * i, _placeSizeHeight * j), new((int)(_placeSizeWidth * (i + 0.5f)), _placeSizeHeight * j)); g.DrawLine(pen, new(_placeSizeWidth * i, _placeSizeHeight * j), new(_placeSizeWidth * i, _placeSizeHeight * (j + 1))); } @@ -43,7 +45,7 @@ public class AirCraftAngar : AbstractCompany protected override void SetObjectsPosition() { int currentIndex = -1; - for (int j = 0 ; j < _pictureHeight / _placeSizeHeight; j++) + for (int j = pamat_j; j >= 0; j--) { for (int i = pamat_i; i >= 0; i--) { -- 2.25.1