diff --git a/AntiAircraftGun/AntiAircraftGun/AntiAircraftGun.csproj b/AntiAircraftGun/AntiAircraftGun/AntiAircraftGun.csproj
index e1a0735..70b4ca1 100644
--- a/AntiAircraftGun/AntiAircraftGun/AntiAircraftGun.csproj
+++ b/AntiAircraftGun/AntiAircraftGun/AntiAircraftGun.csproj
@@ -8,4 +8,9 @@
enable
+
+
+
+
+
\ No newline at end of file
diff --git a/AntiAircraftGun/AntiAircraftGun/Entities/EntityAntiAircraftGun.cs b/AntiAircraftGun/AntiAircraftGun/Entities/EntityAntiAircraftGun.cs
index ea0486f..128db0c 100644
--- a/AntiAircraftGun/AntiAircraftGun/Entities/EntityAntiAircraftGun.cs
+++ b/AntiAircraftGun/AntiAircraftGun/Entities/EntityAntiAircraftGun.cs
@@ -5,7 +5,19 @@
public class EntityAntiAircraftGun:EntityGun
{
private EntityGun? EntityGun;
+ ///
+ /// Дополнительный цвет
+ ///
public Color OptionalElementsColor { get; private set; }
+ ///
+ /// Публичный сеттер для дополнительного цвета
+ ///
+ ///
+ public void SetOptionalElemensColor(Color OptionalElementsColor)
+ {
+ this.OptionalElementsColor = OptionalElementsColor;
+ }
+
///
/// Длинна ствола
///
diff --git a/AntiAircraftGun/AntiAircraftGun/Entities/EntityGun.cs b/AntiAircraftGun/AntiAircraftGun/Entities/EntityGun.cs
index 3668ba9..7cb4140 100644
--- a/AntiAircraftGun/AntiAircraftGun/Entities/EntityGun.cs
+++ b/AntiAircraftGun/AntiAircraftGun/Entities/EntityGun.cs
@@ -20,6 +20,15 @@ public class EntityGun
/// Шаг
///
public double Step { get { return Speed * 100 / Weight; } private set { } }
+
+ ///
+ /// Публичный сеттер для основного цвета
+ ///
+ ///
+ public void SetBodyColor(Color bodyColor)
+ {
+ this.BodyColor = bodyColor;
+ }
///
/// Конструктор сущности
///
diff --git a/AntiAircraftGun/AntiAircraftGun/FormGunCollections.Designer.cs b/AntiAircraftGun/AntiAircraftGun/FormGunCollections.Designer.cs
index 5fb1598..e949bf6 100644
--- a/AntiAircraftGun/AntiAircraftGun/FormGunCollections.Designer.cs
+++ b/AntiAircraftGun/AntiAircraftGun/FormGunCollections.Designer.cs
@@ -34,7 +34,6 @@
comboBoxSelectorCompany = new ComboBox();
buttonAddGun = new Button();
buttonRefresh = new Button();
- buttonAddAntiAircraftGun = new Button();
buttonGoToCheck = new Button();
maskedTextBox = new MaskedTextBox();
buttonRemoveGun = new Button();
@@ -71,7 +70,6 @@
panelCompanyTools.Controls.Add(comboBoxSelectorCompany);
panelCompanyTools.Controls.Add(buttonAddGun);
panelCompanyTools.Controls.Add(buttonRefresh);
- panelCompanyTools.Controls.Add(buttonAddAntiAircraftGun);
panelCompanyTools.Controls.Add(buttonGoToCheck);
panelCompanyTools.Controls.Add(maskedTextBox);
panelCompanyTools.Controls.Add(buttonRemoveGun);
@@ -125,17 +123,6 @@
buttonRefresh.UseVisualStyleBackColor = true;
buttonRefresh.Click += ButtonRefresh_Click;
//
- // buttonAddAntiAircraftGun
- //
- buttonAddAntiAircraftGun.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- buttonAddAntiAircraftGun.Location = new Point(9, 145);
- buttonAddAntiAircraftGun.Name = "buttonAddAntiAircraftGun";
- buttonAddAntiAircraftGun.Size = new Size(214, 52);
- buttonAddAntiAircraftGun.TabIndex = 2;
- buttonAddAntiAircraftGun.Text = "Добавление зенитной установки";
- buttonAddAntiAircraftGun.UseVisualStyleBackColor = true;
- buttonAddAntiAircraftGun.Click += ButtonAddAntiAircraftGun_Click;
- //
// buttonGoToCheck
//
buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
@@ -282,7 +269,6 @@
private Button buttonAddGun;
private ComboBox comboBoxSelectorCompany;
private MaskedTextBox maskedTextBox;
- private Button buttonAddAntiAircraftGun;
private PictureBox pictureBox;
private Button buttonRemoveGun;
private Button buttonRefresh;
diff --git a/AntiAircraftGun/AntiAircraftGun/FormGunCollections.cs b/AntiAircraftGun/AntiAircraftGun/FormGunCollections.cs
index 02cf27f..62f866e 100644
--- a/AntiAircraftGun/AntiAircraftGun/FormGunCollections.cs
+++ b/AntiAircraftGun/AntiAircraftGun/FormGunCollections.cs
@@ -29,37 +29,27 @@ public partial class FormGunCollections : Form
panelCompanyTools.Enabled = true;
}
///
- /// Создание объекта класса перемещения
+ /// Добавление установки
///
- /// Тип создаваемого объекта
- private void CreateObj(string type)
+ ///
+ ///
+ private void ButtonAddGun_Click(object sender, EventArgs e)
{
- if (_company == null)
- {
- return;
- }
+ FormGunConfig form = new();
+ // TODO передать метод
+ form.AddEvent(SetGun);
+ form.Show();
+ }
- DrawningGun _drawningGun;
- Random random = new();
- switch (type)
- {
- case nameof(DrawningGun):
- _drawningGun = new DrawningGun(random.Next(100, 300),
- random.Next(1000, 3000), SetColor(random));
- break;
- case nameof(DrawningAntiAircraftGun):
- _drawningGun = new DrawningAntiAircraftGun(random.Next(100, 300),
- random.Next(1000, 3000),
- SetColor(random),
- SetColor(random),
- random.Next(10, 100),
- Convert.ToBoolean(random.Next(0, 2)),
- Convert.ToBoolean(random.Next(0, 2)));
- break;
- default:
- return;
- }
- if (_company + _drawningGun)
+
+ ///
+ /// Добавление автомобиля в коллекцию
+ ///
+ ///
+ private void SetGun(DrawningGun gun)
+ {
+ if (_company == null||gun==null) { return; }
+ if (_company + gun)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _company.Show();
@@ -68,36 +58,7 @@ public partial class FormGunCollections : Form
{
MessageBox.Show("Не удалось добавить объект");
}
- }
- ///
- /// Получение цвета
- ///
- /// Случайные числа
- ///
- private static Color SetColor(Random random)
- {
- Color color = Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255));
- ColorDialog dialog = new();
- if (dialog.ShowDialog() == DialogResult.OK) { color = dialog.Color; }
- return color;
- }
- ///
- /// Добавление установки
- ///
- ///
- ///
- private void ButtonAddGun_Click(object sender, EventArgs e)
- {
- CreateObj(nameof(DrawningGun));
- }
- ///
- /// Добавление зенитной устновки
- ///
- ///
- ///
- private void ButtonAddAntiAircraftGun_Click(object sender, EventArgs e)
- {
- CreateObj(nameof(DrawningAntiAircraftGun));
+
}
///
/// Удаление установки
@@ -114,7 +75,7 @@ public partial class FormGunCollections : Form
{
return;
}
- if (MessageBox.Show("Удалить объект", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; }
+ if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; }
int pos = Convert.ToInt32(maskedTextBox.Text);
if (_company - pos)
{
@@ -209,7 +170,8 @@ public partial class FormGunCollections : Form
///
private void ButtonCollectionDel_Click(object sender, EventArgs e)
{
- if (listBoxCollection.SelectedItem == null || listBoxCollection.SelectedIndex < 0 ) {
+ if (listBoxCollection.SelectedItem == null || listBoxCollection.SelectedIndex < 0)
+ {
MessageBox.Show("Коллекция для удаления не выбрана");
return;
}
diff --git a/AntiAircraftGun/AntiAircraftGun/FormGunConfig.Designer.cs b/AntiAircraftGun/AntiAircraftGun/FormGunConfig.Designer.cs
new file mode 100644
index 0000000..0b1bccf
--- /dev/null
+++ b/AntiAircraftGun/AntiAircraftGun/FormGunConfig.Designer.cs
@@ -0,0 +1,371 @@
+namespace AntiAircraftGun
+{
+ partial class FormGunConfig
+ {
+ ///
+ /// 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()
+ {
+ groupBoxConfig = new GroupBox();
+ labelSimpleOblect = new Label();
+ groupBoxColors = new GroupBox();
+ panelIndigo = new Panel();
+ panelGrey = new Panel();
+ panelBlack = new Panel();
+ panelWhite = new Panel();
+ panelGreen = new Panel();
+ panelBlue = new Panel();
+ panelYellow = new Panel();
+ panelRed = new Panel();
+ checkBoxRadar = new CheckBox();
+ checkBoxHatch = new CheckBox();
+ numericUpDownWeight = new NumericUpDown();
+ numericUpDownSpeed = new NumericUpDown();
+ labelWeight = new Label();
+ labelSpeed = new Label();
+ labelModifiedObject = new Label();
+ labelSimpleObject = new Label();
+ pictureBoxObjects = new PictureBox();
+ buttonAdd = new Button();
+ buttonCancel = new Button();
+ panelObjects = new Panel();
+ labelOptionalColor = new Label();
+ labelBodyColor = new Label();
+ groupBoxConfig.SuspendLayout();
+ groupBoxColors.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxObjects).BeginInit();
+ panelObjects.SuspendLayout();
+ SuspendLayout();
+ //
+ // groupBoxConfig
+ //
+ groupBoxConfig.Controls.Add(labelSimpleOblect);
+ groupBoxConfig.Controls.Add(groupBoxColors);
+ groupBoxConfig.Controls.Add(checkBoxRadar);
+ groupBoxConfig.Controls.Add(checkBoxHatch);
+ groupBoxConfig.Controls.Add(numericUpDownWeight);
+ groupBoxConfig.Controls.Add(numericUpDownSpeed);
+ groupBoxConfig.Controls.Add(labelWeight);
+ groupBoxConfig.Controls.Add(labelSpeed);
+ groupBoxConfig.Controls.Add(labelModifiedObject);
+ groupBoxConfig.Controls.Add(labelSimpleObject);
+ groupBoxConfig.Dock = DockStyle.Left;
+ groupBoxConfig.Location = new Point(0, 0);
+ groupBoxConfig.Name = "groupBoxConfig";
+ groupBoxConfig.Size = new Size(682, 345);
+ groupBoxConfig.TabIndex = 0;
+ groupBoxConfig.TabStop = false;
+ groupBoxConfig.Text = "Параметры";
+ //
+ // labelSimpleOblect
+ //
+ labelSimpleOblect.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ labelSimpleOblect.BorderStyle = BorderStyle.FixedSingle;
+ labelSimpleOblect.Location = new Point(277, 241);
+ labelSimpleOblect.Name = "labelSimpleOblect";
+ labelSimpleOblect.Size = new Size(131, 55);
+ labelSimpleOblect.TabIndex = 10;
+ labelSimpleOblect.Text = "Простой";
+ labelSimpleOblect.TextAlign = ContentAlignment.MiddleCenter;
+ labelSimpleOblect.MouseDown += LabelOblect_MouseDown;
+ //
+ // groupBoxColors
+ //
+ groupBoxColors.Controls.Add(panelIndigo);
+ groupBoxColors.Controls.Add(panelGrey);
+ groupBoxColors.Controls.Add(panelBlack);
+ groupBoxColors.Controls.Add(panelWhite);
+ groupBoxColors.Controls.Add(panelGreen);
+ groupBoxColors.Controls.Add(panelBlue);
+ groupBoxColors.Controls.Add(panelYellow);
+ groupBoxColors.Controls.Add(panelRed);
+ groupBoxColors.Location = new Point(277, 41);
+ groupBoxColors.Name = "groupBoxColors";
+ groupBoxColors.Size = new Size(314, 171);
+ groupBoxColors.TabIndex = 8;
+ groupBoxColors.TabStop = false;
+ groupBoxColors.Text = "Цвета";
+ //
+ // panelIndigo
+ //
+ panelIndigo.BackColor = Color.Indigo;
+ panelIndigo.Location = new Point(233, 91);
+ panelIndigo.Name = "panelIndigo";
+ panelIndigo.Size = new Size(39, 41);
+ panelIndigo.TabIndex = 4;
+ //
+ // panelGrey
+ //
+ panelGrey.BackColor = Color.Gray;
+ panelGrey.Location = new Point(163, 91);
+ panelGrey.Name = "panelGrey";
+ panelGrey.Size = new Size(39, 41);
+ panelGrey.TabIndex = 6;
+ //
+ // panelBlack
+ //
+ panelBlack.BackColor = Color.Black;
+ panelBlack.Location = new Point(92, 91);
+ panelBlack.Name = "panelBlack";
+ panelBlack.Size = new Size(39, 41);
+ panelBlack.TabIndex = 5;
+ //
+ // panelWhite
+ //
+ panelWhite.BackColor = Color.White;
+ panelWhite.Location = new Point(19, 91);
+ panelWhite.Name = "panelWhite";
+ panelWhite.Size = new Size(39, 41);
+ panelWhite.TabIndex = 3;
+ //
+ // panelGreen
+ //
+ panelGreen.BackColor = Color.Green;
+ panelGreen.Location = new Point(233, 37);
+ panelGreen.Name = "panelGreen";
+ panelGreen.Size = new Size(39, 41);
+ panelGreen.TabIndex = 1;
+ //
+ // panelBlue
+ //
+ panelBlue.BackColor = Color.Blue;
+ panelBlue.Location = new Point(163, 37);
+ panelBlue.Name = "panelBlue";
+ panelBlue.Size = new Size(39, 41);
+ panelBlue.TabIndex = 2;
+ //
+ // panelYellow
+ //
+ panelYellow.BackColor = Color.Yellow;
+ panelYellow.Location = new Point(92, 37);
+ panelYellow.Name = "panelYellow";
+ panelYellow.Size = new Size(39, 41);
+ panelYellow.TabIndex = 1;
+ //
+ // panelRed
+ //
+ panelRed.BackColor = Color.Red;
+ panelRed.Location = new Point(19, 37);
+ panelRed.Name = "panelRed";
+ panelRed.Size = new Size(39, 41);
+ panelRed.TabIndex = 0;
+ //
+ // checkBoxRadar
+ //
+ checkBoxRadar.AutoSize = true;
+ checkBoxRadar.Location = new Point(22, 203);
+ checkBoxRadar.Name = "checkBoxRadar";
+ checkBoxRadar.Size = new Size(72, 24);
+ checkBoxRadar.TabIndex = 7;
+ checkBoxRadar.Text = "Радар";
+ checkBoxRadar.UseVisualStyleBackColor = true;
+ //
+ // checkBoxHatch
+ //
+ checkBoxHatch.AutoSize = true;
+ checkBoxHatch.Location = new Point(22, 149);
+ checkBoxHatch.Name = "checkBoxHatch";
+ checkBoxHatch.Size = new Size(60, 24);
+ checkBoxHatch.TabIndex = 6;
+ checkBoxHatch.Text = "Люк";
+ checkBoxHatch.UseVisualStyleBackColor = true;
+ //
+ // numericUpDownWeight
+ //
+ numericUpDownWeight.Location = new Point(104, 92);
+ numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
+ numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
+ numericUpDownWeight.Name = "numericUpDownWeight";
+ numericUpDownWeight.Size = new Size(99, 27);
+ numericUpDownWeight.TabIndex = 5;
+ numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
+ //
+ // numericUpDownSpeed
+ //
+ numericUpDownSpeed.Location = new Point(104, 41);
+ numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
+ numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
+ numericUpDownSpeed.Name = "numericUpDownSpeed";
+ numericUpDownSpeed.Size = new Size(99, 27);
+ numericUpDownSpeed.TabIndex = 4;
+ numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
+ //
+ // labelWeight
+ //
+ labelWeight.AutoSize = true;
+ labelWeight.Location = new Point(22, 94);
+ labelWeight.Name = "labelWeight";
+ labelWeight.Size = new Size(36, 20);
+ labelWeight.TabIndex = 3;
+ labelWeight.Text = "Вес:";
+ //
+ // labelSpeed
+ //
+ labelSpeed.AutoSize = true;
+ labelSpeed.Location = new Point(22, 43);
+ labelSpeed.Name = "labelSpeed";
+ labelSpeed.Size = new Size(76, 20);
+ labelSpeed.TabIndex = 2;
+ labelSpeed.Text = "Скорость:";
+ //
+ // labelModifiedObject
+ //
+ labelModifiedObject.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
+ labelModifiedObject.Location = new Point(460, 241);
+ labelModifiedObject.Name = "labelModifiedObject";
+ labelModifiedObject.Size = new Size(131, 55);
+ labelModifiedObject.TabIndex = 1;
+ labelModifiedObject.Text = "Продвинутый";
+ labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
+ labelModifiedObject.MouseDown += LabelOblect_MouseDown;
+ //
+ // labelSimpleObject
+ //
+ labelSimpleObject.Location = new Point(0, 0);
+ labelSimpleObject.Name = "labelSimpleObject";
+ labelSimpleObject.Size = new Size(100, 23);
+ labelSimpleObject.TabIndex = 9;
+ //
+ // pictureBoxObjects
+ //
+ pictureBoxObjects.Location = new Point(41, 95);
+ pictureBoxObjects.Name = "pictureBoxObjects";
+ pictureBoxObjects.Size = new Size(218, 169);
+ pictureBoxObjects.TabIndex = 0;
+ pictureBoxObjects.TabStop = false;
+ //
+ // buttonAdd
+ //
+ buttonAdd.Location = new Point(731, 304);
+ buttonAdd.Name = "buttonAdd";
+ buttonAdd.Size = new Size(94, 29);
+ buttonAdd.TabIndex = 2;
+ buttonAdd.Text = "Добавить";
+ buttonAdd.UseVisualStyleBackColor = true;
+ buttonAdd.Click += ButtonAdd_Click;
+ //
+ // buttonCancel
+ //
+ buttonCancel.Location = new Point(931, 304);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(94, 29);
+ buttonCancel.TabIndex = 3;
+ buttonCancel.Text = "Отмена";
+ buttonCancel.UseVisualStyleBackColor = true;
+ //
+ // panelObjects
+ //
+ panelObjects.AllowDrop = true;
+ panelObjects.Controls.Add(labelOptionalColor);
+ panelObjects.Controls.Add(labelBodyColor);
+ panelObjects.Controls.Add(pictureBoxObjects);
+ panelObjects.Location = new Point(731, 12);
+ panelObjects.Name = "panelObjects";
+ panelObjects.Size = new Size(294, 284);
+ panelObjects.TabIndex = 4;
+ panelObjects.DragDrop += PanelObjects_DragDrop;
+ panelObjects.DragEnter += PanelObjects_DragEnter;
+ //
+ // labelOptionalColor
+ //
+ labelOptionalColor.AllowDrop = true;
+ labelOptionalColor.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ labelOptionalColor.BorderStyle = BorderStyle.FixedSingle;
+ labelOptionalColor.Location = new Point(164, 14);
+ labelOptionalColor.Name = "labelOptionalColor";
+ labelOptionalColor.Size = new Size(118, 42);
+ labelOptionalColor.TabIndex = 12;
+ labelOptionalColor.Text = "Доп. Цвет";
+ labelOptionalColor.TextAlign = ContentAlignment.MiddleCenter;
+ labelOptionalColor.DragDrop += labelOptionalColor_DragDrop;
+ labelOptionalColor.DragEnter += labelOptionalColor_DragEnter;
+ //
+ // labelBodyColor
+ //
+ labelBodyColor.AllowDrop = true;
+ labelBodyColor.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
+ labelBodyColor.Location = new Point(13, 14);
+ labelBodyColor.Name = "labelBodyColor";
+ labelBodyColor.Size = new Size(113, 42);
+ labelBodyColor.TabIndex = 11;
+ labelBodyColor.Text = "Цвет";
+ labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
+ labelBodyColor.DragDrop += labelBodyColor_DragDrop;
+ labelBodyColor.DragEnter += labelBodyColor_DragEnter;
+ //
+ // FormGunConfig
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(1056, 345);
+ Controls.Add(panelObjects);
+ Controls.Add(buttonCancel);
+ Controls.Add(buttonAdd);
+ Controls.Add(groupBoxConfig);
+ Name = "FormGunConfig";
+ Text = "Создание объекта";
+ groupBoxConfig.ResumeLayout(false);
+ groupBoxConfig.PerformLayout();
+ groupBoxColors.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxObjects).EndInit();
+ panelObjects.ResumeLayout(false);
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private GroupBox groupBoxConfig;
+ private Label labelSimpleObject;
+ private Label labelModifiedObject;
+ private NumericUpDown numericUpDownWeight;
+ private NumericUpDown numericUpDownSpeed;
+ private Label labelWeight;
+ private Label labelSpeed;
+ private CheckBox checkBoxRadar;
+ private CheckBox checkBoxHatch;
+ private GroupBox groupBoxColors;
+ private Panel panelRed;
+ private Panel panelIndigo;
+ private Panel panelGrey;
+ private Panel panelBlack;
+ private Panel panelWhite;
+ private Panel panelGreen;
+ private Panel panelBlue;
+ private Panel panelYellow;
+ private PictureBox pictureBoxObjects;
+ private Button buttonAdd;
+ private Button buttonCancel;
+ private Panel panelObjects;
+ private Label labelSimpleOblect;
+ private Label labelBodyColor;
+ private Label labelOptionalColor;
+ }
+}
\ No newline at end of file
diff --git a/AntiAircraftGun/AntiAircraftGun/FormGunConfig.cs b/AntiAircraftGun/AntiAircraftGun/FormGunConfig.cs
new file mode 100644
index 0000000..8116aab
--- /dev/null
+++ b/AntiAircraftGun/AntiAircraftGun/FormGunConfig.cs
@@ -0,0 +1,154 @@
+using AntiAircraftGun.Drawnings;
+using AntiAircraftGun.Entities;
+
+namespace AntiAircraftGun;
+///
+/// Форма конфигурации объекта
+///
+public partial class FormGunConfig : Form
+{
+ ///
+ /// Объект прорисовки класса
+ ///
+ private DrawningGun? _gun;
+ ///
+ /// Событие для передачи объекта
+ ///
+ private event GunDelegate? _gunDelegate;
+
+ ///
+ /// Конструктор
+ ///
+ public FormGunConfig()
+ {
+ InitializeComponent();
+ panelRed.MouseDown += Panel_MouseDown;
+ panelGreen.MouseDown += Panel_MouseDown;
+ panelBlue.MouseDown += Panel_MouseDown;
+ panelWhite.MouseDown += Panel_MouseDown;
+ panelBlack.MouseDown += Panel_MouseDown;
+ panelGrey.MouseDown += Panel_MouseDown;
+ panelIndigo.MouseDown += Panel_MouseDown;
+ panelYellow.MouseDown += Panel_MouseDown;
+
+ // TODO buttonCancel.Click with lambda
+ buttonCancel.Click += (sender, e) => Close();
+ }
+ ///
+ /// Привязка внешнего метода к союытию
+ ///
+ ///
+ public void AddEvent(GunDelegate gunDelegate)
+ {
+ _gunDelegate += gunDelegate;
+ }
+
+ //
+ /// Прорисовка объекта
+ ///
+ private void DrawObject()
+ {
+ Bitmap bmp = new(pictureBoxObjects.Width, pictureBoxObjects.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _gun?.SetPictureSize(pictureBoxObjects.Width,
+ pictureBoxObjects.Height);
+ _gun?.SetPosition(15, 15);
+ _gun?.DrawTransport(gr);
+ pictureBoxObjects.Image = bmp;
+ }
+ ///
+ /// Передаем информацию при нажатии на Label
+ ///
+ ///
+ ///
+ private void LabelOblect_MouseDown(object sender, MouseEventArgs e)
+ {
+ (sender as Label)?.DoDragDrop((sender as Label)?.Name ?? string.Empty, DragDropEffects.Move | DragDropEffects.Copy);
+ }
+ ///
+ /// Проверка получаемой информации (ее типа на соответствие требуемому)
+ ///
+ ///
+ ///
+ private void PanelObjects_DragEnter(object sender, DragEventArgs e)
+ {
+ e.Effect = e.Data?.GetDataPresent(DataFormats.Text) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
+ }
+ ///
+ /// Действия при приеме перетаскиваемой информации
+ ///
+ ///
+ ///
+ private void PanelObjects_DragDrop(object sender, DragEventArgs e)
+ {
+ switch (e.Data?.GetData(DataFormats.Text)?.ToString())
+ {
+ case "labelSimpleOblect":
+ _gun = new DrawningGun((int)numericUpDownSpeed.Value,
+ (double)numericUpDownWeight.Value, Color.White);
+ break;
+ case "labelModifiedObject":
+ Random random = new Random();
+ _gun = new
+ DrawningAntiAircraftGun((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value,
+ Color.White,
+ Color.Black, random.Next(10, 100),
+ checkBoxHatch.Checked, checkBoxRadar.Checked);
+ break;
+ }
+ DrawObject();
+ }
+
+ private void Panel_MouseDown(object? sender, MouseEventArgs e)
+ {
+ // TODO реализовать выбор цвета
+ (sender as Control)?.DoDragDrop((sender as Control)?.BackColor ?? Color.Black, DragDropEffects.Move | DragDropEffects.Copy);
+ }
+ ///
+ /// Передача объекта
+ ///
+ ///
+ ///
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ if (_gun != null)
+ {
+ _gunDelegate?.Invoke(_gun);
+ Close();
+ }
+ }
+
+ private void labelBodyColor_DragDrop(object sender, DragEventArgs e)
+ {
+ if (_gun != null)
+ {
+ _gun.EntityGun.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
+ DrawObject();
+ }
+ }
+
+ private void labelBodyColor_DragEnter(object? sender, DragEventArgs e)
+ {
+ e.Effect = e.Data?.GetDataPresent(typeof(Color)) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
+ }
+
+ private void labelOptionalColor_DragDrop(object sender, DragEventArgs e)
+ {
+ if (_gun.EntityGun is EntityAntiAircraftGun antiAircraftGun)
+ {
+ antiAircraftGun.SetOptionalElemensColor((Color)e.Data.GetData(typeof(Color)));
+ DrawObject();
+ }
+ }
+
+ private void labelOptionalColor_DragEnter(object sender, DragEventArgs e)
+ {
+ if (_gun is DrawningAntiAircraftGun)
+ {
+ e.Effect = e.Data?.GetDataPresent(typeof(Color)) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
+ }
+ }
+
+
+ // TODO Реализовать логику смены цветов: основного и дополнительного(для продвинутого объекта)
+}
diff --git a/AntiAircraftGun/AntiAircraftGun/FormGunConfig.resx b/AntiAircraftGun/AntiAircraftGun/FormGunConfig.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/AntiAircraftGun/AntiAircraftGun/FormGunConfig.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/AntiAircraftGun/AntiAircraftGun/GunDelegate.cs b/AntiAircraftGun/AntiAircraftGun/GunDelegate.cs
new file mode 100644
index 0000000..603eff4
--- /dev/null
+++ b/AntiAircraftGun/AntiAircraftGun/GunDelegate.cs
@@ -0,0 +1,7 @@
+using AntiAircraftGun.Drawnings;
+namespace AntiAircraftGun;
+///
+/// Делегат для объекта класса прорисовки
+///
+///
+public delegate void GunDelegate(DrawningGun drawningGun);