diff --git a/Stormtrooper/Stormtrooper/EntityMilitaryAirplane.cs b/Stormtrooper/Stormtrooper/EntityMilitaryAirplane.cs
index e406587..f70a361 100644
--- a/Stormtrooper/Stormtrooper/EntityMilitaryAirplane.cs
+++ b/Stormtrooper/Stormtrooper/EntityMilitaryAirplane.cs
@@ -10,7 +10,7 @@ namespace Stormtrooper
{
public int Speed { get; private set; }
public int Weight { get; private set; }
- public Color Color { get; private set; }
+ public Color Color { get; set; }
public float Step => Speed * 25 / Weight;
diff --git a/Stormtrooper/Stormtrooper/EntityStormtrooper.cs b/Stormtrooper/Stormtrooper/EntityStormtrooper.cs
index 44c6b41..4018e35 100644
--- a/Stormtrooper/Stormtrooper/EntityStormtrooper.cs
+++ b/Stormtrooper/Stormtrooper/EntityStormtrooper.cs
@@ -11,19 +11,19 @@ namespace Stormtrooper
///
/// Доп цвет
///
- public Color AdvColor { get;private set; }
+ public Color AdvColor { get; set; }
///
/// Наличие рокет
///
- public bool Rockets { get; private set; }
+ public bool Rockets { get; set; }
///
/// Наличие ускорителей
///
- public bool Booster { get; private set; }
+ public bool Booster { get; set; }
///
/// Наличие радара
///
- public bool Radar { get; private set; }
+ public bool Radar { get; set; }
public EntityStormtrooper(int speed, int weight, Color color, Color advColor, bool rockets, bool boosters, bool radar)
: base(speed, weight, color)
diff --git a/Stormtrooper/Stormtrooper/FormAirConfig.Designer.cs b/Stormtrooper/Stormtrooper/FormAirConfig.Designer.cs
new file mode 100644
index 0000000..d412a15
--- /dev/null
+++ b/Stormtrooper/Stormtrooper/FormAirConfig.Designer.cs
@@ -0,0 +1,398 @@
+namespace Stormtrooper
+{
+ partial class FormAirConfig
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.groupBoxConfig = new System.Windows.Forms.GroupBox();
+ this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
+ this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
+ this.labelAdvanced = new System.Windows.Forms.Label();
+ this.labelSimple = new System.Windows.Forms.Label();
+ this.groupBoxColor = new System.Windows.Forms.GroupBox();
+ this.panelGreen = new System.Windows.Forms.Panel();
+ this.panelCyan = new System.Windows.Forms.Panel();
+ this.panelPink = new System.Windows.Forms.Panel();
+ this.panelBlack = new System.Windows.Forms.Panel();
+ this.panelPurple = new System.Windows.Forms.Panel();
+ this.panelBlue = new System.Windows.Forms.Panel();
+ this.panelYellow = new System.Windows.Forms.Panel();
+ this.panelRed = new System.Windows.Forms.Panel();
+ this.checkBoxBoosters = new System.Windows.Forms.CheckBox();
+ this.checkBoxRocket = new System.Windows.Forms.CheckBox();
+ this.checkBoxRadar = new System.Windows.Forms.CheckBox();
+ this.labelWeight = new System.Windows.Forms.Label();
+ this.labelSpeed = new System.Windows.Forms.Label();
+ this.pictureBoxShow = new System.Windows.Forms.PictureBox();
+ this.panelShow = new System.Windows.Forms.Panel();
+ this.labelAdvancedColor = new System.Windows.Forms.Label();
+ this.labelColor = new System.Windows.Forms.Label();
+ this.buttonAdd = new System.Windows.Forms.Button();
+ this.buttonCancel = new System.Windows.Forms.Button();
+ this.groupBoxConfig.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
+ this.groupBoxColor.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxShow)).BeginInit();
+ this.panelShow.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // groupBoxConfig
+ //
+ this.groupBoxConfig.Controls.Add(this.numericUpDownWeight);
+ this.groupBoxConfig.Controls.Add(this.numericUpDownSpeed);
+ this.groupBoxConfig.Controls.Add(this.labelAdvanced);
+ this.groupBoxConfig.Controls.Add(this.labelSimple);
+ this.groupBoxConfig.Controls.Add(this.groupBoxColor);
+ this.groupBoxConfig.Controls.Add(this.checkBoxBoosters);
+ this.groupBoxConfig.Controls.Add(this.checkBoxRocket);
+ this.groupBoxConfig.Controls.Add(this.checkBoxRadar);
+ this.groupBoxConfig.Controls.Add(this.labelWeight);
+ this.groupBoxConfig.Controls.Add(this.labelSpeed);
+ this.groupBoxConfig.Location = new System.Drawing.Point(12, 12);
+ this.groupBoxConfig.Name = "groupBoxConfig";
+ this.groupBoxConfig.Size = new System.Drawing.Size(590, 357);
+ this.groupBoxConfig.TabIndex = 0;
+ this.groupBoxConfig.TabStop = false;
+ this.groupBoxConfig.Text = "Параметры";
+ //
+ // numericUpDownWeight
+ //
+ this.numericUpDownWeight.Location = new System.Drawing.Point(95, 78);
+ this.numericUpDownWeight.Maximum = new decimal(new int[] {
+ 250,
+ 0,
+ 0,
+ 0});
+ this.numericUpDownWeight.Minimum = new decimal(new int[] {
+ 100,
+ 0,
+ 0,
+ 0});
+ this.numericUpDownWeight.Name = "numericUpDownWeight";
+ this.numericUpDownWeight.Size = new System.Drawing.Size(62, 23);
+ this.numericUpDownWeight.TabIndex = 11;
+ this.numericUpDownWeight.Value = new decimal(new int[] {
+ 100,
+ 0,
+ 0,
+ 0});
+ //
+ // numericUpDownSpeed
+ //
+ this.numericUpDownSpeed.Location = new System.Drawing.Point(95, 42);
+ this.numericUpDownSpeed.Maximum = new decimal(new int[] {
+ 2500,
+ 0,
+ 0,
+ 0});
+ this.numericUpDownSpeed.Minimum = new decimal(new int[] {
+ 100,
+ 0,
+ 0,
+ 0});
+ this.numericUpDownSpeed.Name = "numericUpDownSpeed";
+ this.numericUpDownSpeed.Size = new System.Drawing.Size(62, 23);
+ this.numericUpDownSpeed.TabIndex = 10;
+ this.numericUpDownSpeed.Value = new decimal(new int[] {
+ 100,
+ 0,
+ 0,
+ 0});
+ //
+ // labelAdvanced
+ //
+ this.labelAdvanced.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.labelAdvanced.Location = new System.Drawing.Point(410, 192);
+ this.labelAdvanced.Name = "labelAdvanced";
+ this.labelAdvanced.Size = new System.Drawing.Size(115, 32);
+ this.labelAdvanced.TabIndex = 9;
+ this.labelAdvanced.Text = "Продвинутый";
+ this.labelAdvanced.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.labelAdvanced.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label_MouseDown);
+ //
+ // labelSimple
+ //
+ this.labelSimple.AllowDrop = true;
+ this.labelSimple.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.labelSimple.Location = new System.Drawing.Point(289, 192);
+ this.labelSimple.Name = "labelSimple";
+ this.labelSimple.Size = new System.Drawing.Size(115, 32);
+ this.labelSimple.TabIndex = 8;
+ this.labelSimple.Text = "Простой";
+ this.labelSimple.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.labelSimple.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label_MouseDown);
+ //
+ // groupBoxColor
+ //
+ this.groupBoxColor.Controls.Add(this.panelGreen);
+ this.groupBoxColor.Controls.Add(this.panelCyan);
+ this.groupBoxColor.Controls.Add(this.panelPink);
+ this.groupBoxColor.Controls.Add(this.panelBlack);
+ this.groupBoxColor.Controls.Add(this.panelPurple);
+ this.groupBoxColor.Controls.Add(this.panelBlue);
+ this.groupBoxColor.Controls.Add(this.panelYellow);
+ this.groupBoxColor.Controls.Add(this.panelRed);
+ this.groupBoxColor.Location = new System.Drawing.Point(289, 26);
+ this.groupBoxColor.Name = "groupBoxColor";
+ this.groupBoxColor.Size = new System.Drawing.Size(234, 150);
+ this.groupBoxColor.TabIndex = 7;
+ this.groupBoxColor.TabStop = false;
+ this.groupBoxColor.Text = "Цвета";
+ //
+ // panelGreen
+ //
+ this.panelGreen.BackColor = System.Drawing.Color.Lime;
+ this.panelGreen.Location = new System.Drawing.Point(65, 26);
+ this.panelGreen.Name = "panelGreen";
+ this.panelGreen.Size = new System.Drawing.Size(50, 41);
+ this.panelGreen.TabIndex = 1;
+ //
+ // panelCyan
+ //
+ this.panelCyan.BackColor = System.Drawing.Color.Cyan;
+ this.panelCyan.Location = new System.Drawing.Point(9, 89);
+ this.panelCyan.Name = "panelCyan";
+ this.panelCyan.Size = new System.Drawing.Size(50, 41);
+ this.panelCyan.TabIndex = 1;
+ //
+ // panelPink
+ //
+ this.panelPink.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
+ this.panelPink.Location = new System.Drawing.Point(65, 89);
+ this.panelPink.Name = "panelPink";
+ this.panelPink.Size = new System.Drawing.Size(50, 41);
+ this.panelPink.TabIndex = 1;
+ //
+ // panelBlack
+ //
+ this.panelBlack.BackColor = System.Drawing.Color.Black;
+ this.panelBlack.Location = new System.Drawing.Point(121, 89);
+ this.panelBlack.Name = "panelBlack";
+ this.panelBlack.Size = new System.Drawing.Size(50, 41);
+ this.panelBlack.TabIndex = 1;
+ //
+ // panelPurple
+ //
+ this.panelPurple.BackColor = System.Drawing.Color.Purple;
+ this.panelPurple.Location = new System.Drawing.Point(178, 89);
+ this.panelPurple.Name = "panelPurple";
+ this.panelPurple.Size = new System.Drawing.Size(50, 41);
+ this.panelPurple.TabIndex = 1;
+ //
+ // panelBlue
+ //
+ this.panelBlue.BackColor = System.Drawing.Color.Blue;
+ this.panelBlue.Location = new System.Drawing.Point(121, 26);
+ this.panelBlue.Name = "panelBlue";
+ this.panelBlue.Size = new System.Drawing.Size(50, 41);
+ this.panelBlue.TabIndex = 1;
+ //
+ // panelYellow
+ //
+ this.panelYellow.BackColor = System.Drawing.Color.Yellow;
+ this.panelYellow.Location = new System.Drawing.Point(178, 26);
+ this.panelYellow.Name = "panelYellow";
+ this.panelYellow.Size = new System.Drawing.Size(50, 41);
+ this.panelYellow.TabIndex = 1;
+ //
+ // panelRed
+ //
+ this.panelRed.BackColor = System.Drawing.Color.Red;
+ this.panelRed.Location = new System.Drawing.Point(9, 26);
+ this.panelRed.Name = "panelRed";
+ this.panelRed.Size = new System.Drawing.Size(50, 41);
+ this.panelRed.TabIndex = 0;
+ //
+ // checkBoxBoosters
+ //
+ this.checkBoxBoosters.AutoSize = true;
+ this.checkBoxBoosters.Location = new System.Drawing.Point(21, 132);
+ this.checkBoxBoosters.Name = "checkBoxBoosters";
+ this.checkBoxBoosters.Size = new System.Drawing.Size(148, 19);
+ this.checkBoxBoosters.TabIndex = 6;
+ this.checkBoxBoosters.Text = "Наличие ускорителей";
+ this.checkBoxBoosters.UseVisualStyleBackColor = true;
+ this.checkBoxBoosters.CheckedChanged += new System.EventHandler(this.checkBox_CheckedChanged);
+ //
+ // checkBoxRocket
+ //
+ this.checkBoxRocket.AutoSize = true;
+ this.checkBoxRocket.Location = new System.Drawing.Point(21, 157);
+ this.checkBoxRocket.Name = "checkBoxRocket";
+ this.checkBoxRocket.Size = new System.Drawing.Size(108, 19);
+ this.checkBoxRocket.TabIndex = 5;
+ this.checkBoxRocket.Text = "Наличие ракет";
+ this.checkBoxRocket.UseVisualStyleBackColor = true;
+ this.checkBoxRocket.CheckedChanged += new System.EventHandler(this.checkBox_CheckedChanged);
+ //
+ // checkBoxRadar
+ //
+ this.checkBoxRadar.AutoSize = true;
+ this.checkBoxRadar.Location = new System.Drawing.Point(21, 107);
+ this.checkBoxRadar.Name = "checkBoxRadar";
+ this.checkBoxRadar.Size = new System.Drawing.Size(116, 19);
+ this.checkBoxRadar.TabIndex = 4;
+ this.checkBoxRadar.Text = "Наличие радара";
+ this.checkBoxRadar.UseVisualStyleBackColor = true;
+ this.checkBoxRadar.CheckedChanged += new System.EventHandler(this.checkBox_CheckedChanged);
+ //
+ // labelWeight
+ //
+ this.labelWeight.AutoSize = true;
+ this.labelWeight.Location = new System.Drawing.Point(21, 78);
+ this.labelWeight.Name = "labelWeight";
+ this.labelWeight.Size = new System.Drawing.Size(26, 15);
+ this.labelWeight.TabIndex = 1;
+ this.labelWeight.Text = "Вес";
+ //
+ // labelSpeed
+ //
+ this.labelSpeed.AutoSize = true;
+ this.labelSpeed.Location = new System.Drawing.Point(21, 44);
+ this.labelSpeed.Name = "labelSpeed";
+ this.labelSpeed.Size = new System.Drawing.Size(59, 15);
+ this.labelSpeed.TabIndex = 0;
+ this.labelSpeed.Text = "Скорость";
+ //
+ // pictureBoxShow
+ //
+ this.pictureBoxShow.Location = new System.Drawing.Point(38, 68);
+ this.pictureBoxShow.Name = "pictureBoxShow";
+ this.pictureBoxShow.Size = new System.Drawing.Size(481, 221);
+ this.pictureBoxShow.TabIndex = 1;
+ this.pictureBoxShow.TabStop = false;
+ //
+ // panelShow
+ //
+ this.panelShow.AllowDrop = true;
+ this.panelShow.Controls.Add(this.labelAdvancedColor);
+ this.panelShow.Controls.Add(this.labelColor);
+ this.panelShow.Controls.Add(this.pictureBoxShow);
+ this.panelShow.Location = new System.Drawing.Point(658, 22);
+ this.panelShow.Name = "panelShow";
+ this.panelShow.Size = new System.Drawing.Size(558, 292);
+ this.panelShow.TabIndex = 2;
+ this.panelShow.DragDrop += new System.Windows.Forms.DragEventHandler(this.panelShow_DragDrop);
+ this.panelShow.DragEnter += new System.Windows.Forms.DragEventHandler(this.panelShow_DragEnter);
+ //
+ // labelAdvancedColor
+ //
+ this.labelAdvancedColor.AllowDrop = true;
+ this.labelAdvancedColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.labelAdvancedColor.Location = new System.Drawing.Point(320, 16);
+ this.labelAdvancedColor.Name = "labelAdvancedColor";
+ this.labelAdvancedColor.Size = new System.Drawing.Size(164, 39);
+ this.labelAdvancedColor.TabIndex = 3;
+ this.labelAdvancedColor.Text = "Дополнительный цвет";
+ this.labelAdvancedColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.labelAdvancedColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelDopColor_DragDrop);
+ this.labelAdvancedColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter);
+ //
+ // labelColor
+ //
+ this.labelColor.AllowDrop = true;
+ this.labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.labelColor.Location = new System.Drawing.Point(82, 16);
+ this.labelColor.Name = "labelColor";
+ this.labelColor.Size = new System.Drawing.Size(164, 39);
+ this.labelColor.TabIndex = 2;
+ this.labelColor.Text = "Основной цвет";
+ this.labelColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.labelColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelBaseColor_DragDrop);
+ this.labelColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter);
+ //
+ // buttonAdd
+ //
+ this.buttonAdd.Location = new System.Drawing.Point(677, 333);
+ this.buttonAdd.Name = "buttonAdd";
+ this.buttonAdd.Size = new System.Drawing.Size(227, 45);
+ this.buttonAdd.TabIndex = 3;
+ this.buttonAdd.Text = "Добавить";
+ this.buttonAdd.UseVisualStyleBackColor = true;
+ this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.Location = new System.Drawing.Point(978, 333);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(227, 45);
+ this.buttonCancel.TabIndex = 4;
+ this.buttonCancel.Text = "Отменить";
+ this.buttonCancel.UseVisualStyleBackColor = true;
+ //
+ // FormAirConfig
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1244, 390);
+ this.Controls.Add(this.buttonCancel);
+ this.Controls.Add(this.buttonAdd);
+ this.Controls.Add(this.panelShow);
+ this.Controls.Add(this.groupBoxConfig);
+ this.Name = "FormAirConfig";
+ this.Text = "FormAirConfig";
+ this.groupBoxConfig.ResumeLayout(false);
+ this.groupBoxConfig.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
+ this.groupBoxColor.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxShow)).EndInit();
+ this.panelShow.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private GroupBox groupBoxConfig;
+ private Label labelWeight;
+ private Label labelSpeed;
+ private Label labelAdvanced;
+ private Label labelSimple;
+ private GroupBox groupBoxColor;
+ private Panel panelGreen;
+ private Panel panelCyan;
+ private Panel panelPink;
+ private Panel panelBlack;
+ private Panel panelPurple;
+ private Panel panelBlue;
+ private Panel panelYellow;
+ private Panel panelRed;
+ private CheckBox checkBoxBoosters;
+ private CheckBox checkBoxRocket;
+ private CheckBox checkBoxRadar;
+ private PictureBox pictureBoxShow;
+ private Panel panelShow;
+ private Label labelAdvancedColor;
+ private Label labelColor;
+ private NumericUpDown numericUpDownWeight;
+ private NumericUpDown numericUpDownSpeed;
+ private Button buttonAdd;
+ private Button buttonCancel;
+ }
+}
\ No newline at end of file
diff --git a/Stormtrooper/Stormtrooper/FormAirConfig.cs b/Stormtrooper/Stormtrooper/FormAirConfig.cs
new file mode 100644
index 0000000..848478e
--- /dev/null
+++ b/Stormtrooper/Stormtrooper/FormAirConfig.cs
@@ -0,0 +1,141 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Stormtrooper
+{
+ public partial class FormAirConfig : Form
+ {
+ DrawningMilitaryAirplane _airplane = null;
+ private event Action EventAddAirplane;
+ public FormAirConfig()
+ {
+ InitializeComponent();
+ panelBlack.MouseDown += PanelColor_MouseDown;
+ panelPurple.MouseDown += PanelColor_MouseDown;
+ panelPink.MouseDown += PanelColor_MouseDown;
+ panelGreen.MouseDown += PanelColor_MouseDown;
+ panelRed.MouseDown += PanelColor_MouseDown;
+ panelCyan.MouseDown += PanelColor_MouseDown;
+ panelYellow.MouseDown += PanelColor_MouseDown;
+ panelBlue.MouseDown += PanelColor_MouseDown;
+ buttonCancel.Click += (object sender, EventArgs e) => Close();
+ }
+
+ private void DrawAirplane()
+ {
+ Bitmap bmp = new(pictureBoxShow.Width, pictureBoxShow.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _airplane?.SetPosition(200, 70, pictureBoxShow.Width, pictureBoxShow.Height);
+ _airplane?.DrawAirplane(gr);
+ pictureBoxShow.Image = bmp;
+ }
+ public void AddEvent(Action ev)
+ {
+ if (EventAddAirplane == null)
+ {
+ EventAddAirplane = new Action(ev);
+ }
+ else
+ {
+ EventAddAirplane += ev;
+ }
+ }
+
+ private void label_MouseDown(object sender, MouseEventArgs e)
+ {
+ (sender as Label).DoDragDrop((sender as Label).Name, DragDropEffects.Move | DragDropEffects.Copy);
+ }
+ private void PanelColor_MouseDown(object sender, MouseEventArgs e)
+ {
+ (sender as Control).DoDragDrop((sender as Control).BackColor, DragDropEffects.Move | DragDropEffects.Copy);
+ }
+
+ private void labelColor_DragEnter(object sender, DragEventArgs e)
+ {
+ if (e.Data.GetDataPresent(typeof(Color)))
+ {
+ e.Effect = DragDropEffects.Copy;
+ }
+ else
+ {
+ e.Effect = DragDropEffects.None;
+ }
+ }
+ private void labelBaseColor_DragDrop(object sender, DragEventArgs e)
+ {
+ if (_airplane != null)
+ {
+ if (e.Data.GetDataPresent(typeof(Color)))
+ {
+ _airplane.Airplane.Color = (Color)e.Data.GetData(typeof(Color));
+ }
+ DrawAirplane();
+ }
+ }
+ private void labelDopColor_DragDrop(object sender, DragEventArgs e)
+ {
+ if (_airplane != null && _airplane is DrawningStormtrooper stormtrooper)
+ {
+ if (e.Data.GetDataPresent(typeof(Color)))
+ {
+ if(stormtrooper.Airplane is EntityStormtrooper entityStormtrooper)
+ {
+ entityStormtrooper.AdvColor = (Color)e.Data.GetData(typeof(Color));
+ }
+ }
+ DrawAirplane();
+ }
+ }
+
+ private void panelShow_DragEnter(object sender, DragEventArgs e)
+ {
+ if (e.Data.GetDataPresent(DataFormats.Text))
+ {
+ e.Effect = DragDropEffects.Copy;
+ }
+ else
+ {
+ e.Effect = DragDropEffects.None;
+ }
+ }
+
+ private void panelShow_DragDrop(object sender, DragEventArgs e)
+ {
+ switch (e.Data.GetData(DataFormats.Text).ToString())
+ {
+ case "labelSimple":
+ _airplane = new DrawningMilitaryAirplane((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White);
+ break;
+ case "labelAdvanced":
+ _airplane = new DrawningStormtrooper((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black,
+ checkBoxRocket.Checked, checkBoxBoosters.Checked, checkBoxRadar.Checked);
+ break;
+ }
+ DrawAirplane();
+ }
+
+ private void checkBox_CheckedChanged(object sender, EventArgs e)
+ {
+ if(_airplane is DrawningStormtrooper)
+ {
+ _airplane = new DrawningStormtrooper((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, _airplane.Airplane.Color, (_airplane.Airplane as EntityStormtrooper).AdvColor,
+ checkBoxRocket.Checked, checkBoxBoosters.Checked, checkBoxRadar.Checked);
+ DrawAirplane();
+ }
+
+ }
+
+ private void buttonAdd_Click(object sender, EventArgs e)
+ {
+ EventAddAirplane?.Invoke(_airplane);
+ Close();
+ }
+ }
+}
diff --git a/Stormtrooper/Stormtrooper/FormAirConfig.resx b/Stormtrooper/Stormtrooper/FormAirConfig.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/Stormtrooper/Stormtrooper/FormAirConfig.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Stormtrooper/Stormtrooper/FormMapWithSetAirplane.cs b/Stormtrooper/Stormtrooper/FormMapWithSetAirplane.cs
index e19fd65..9442658 100644
--- a/Stormtrooper/Stormtrooper/FormMapWithSetAirplane.cs
+++ b/Stormtrooper/Stormtrooper/FormMapWithSetAirplane.cs
@@ -24,7 +24,6 @@ namespace Stormtrooper
/// Объект от коллекции карт
///
private readonly MapCollection _mapCollection;
- private MapWithSetAirplaneGeneric _mapAirsCollectionGeneric;
public FormMapWithSetAirplane()
{
InitializeComponent();
@@ -78,32 +77,26 @@ namespace Stormtrooper
///
///
private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ var formAirConfig = new FormAirConfig();
+ formAirConfig.AddEvent(AddAirplane);
+ formAirConfig.Show();
+ }
+ private void AddAirplane(DrawningMilitaryAirplane drawningMilitaryAirplane)
{
if (listBoxMap.SelectedIndex == -1)
{
return;
}
- MainForm form = new();
- if (form.ShowDialog() == DialogResult.OK)
+ DrawningObject airplane = new(drawningMilitaryAirplane);
+ if (_mapCollection[listBoxMap.SelectedItem?.ToString() ?? string.Empty] + airplane != -1)
{
- if(form.SelectedAirplane != null)
- {
- DrawningObject airplane = new (form.SelectedAirplane);
- if (_mapCollection[listBoxMap.SelectedItem?.ToString() ?? string.Empty] + airplane != -1)
- {
- MessageBox.Show("Объект добавлен");
- pictureBox.Image = _mapCollection[listBoxMap.SelectedItem?.ToString() ?? string.Empty].ShowSet();
- }
- else
- {
- MessageBox.Show("Не удалось добавить объект");
- }
- }
- else
- {
- MessageBox.Show("Объект не создан");
- }
-
+ MessageBox.Show("Объект добавлен");
+ pictureBox.Image = _mapCollection[listBoxMap.SelectedItem?.ToString() ?? string.Empty].ShowSet();
+ }
+ else
+ {
+ MessageBox.Show("Не удалось добавить объект");
}
}
///
diff --git a/Stormtrooper/Stormtrooper/MapWithSetAirplaneGeneric.cs b/Stormtrooper/Stormtrooper/MapWithSetAirplaneGeneric.cs
index 12424a2..ab561ef 100644
--- a/Stormtrooper/Stormtrooper/MapWithSetAirplaneGeneric.cs
+++ b/Stormtrooper/Stormtrooper/MapWithSetAirplaneGeneric.cs
@@ -167,7 +167,6 @@ namespace Stormtrooper
int currentWidth = width - 1;
int currentHeight = 0;
- int i = 0;
foreach (var air in _setAirs.GetAirs())
{