изменение
This commit is contained in:
parent
915ad90162
commit
eb8186c60a
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
public class EntityAirBomber : EntityBomber
|
public class EntityAirBomber : EntityBomber
|
||||||
{
|
{
|
||||||
public Color DopColor { get; private set; }
|
public Color DopColor { get; set; }
|
||||||
public bool Toplivo { get; private set; }
|
public bool Toplivo { get; private set; }
|
||||||
public bool Rocket { get; private set; }
|
public bool Rocket { get; private set; }
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace AirBomber.Entities
|
|||||||
{
|
{
|
||||||
public int Speed { get; private set; }
|
public int Speed { get; private set; }
|
||||||
public double Weight { get; private set; }
|
public double Weight { get; private set; }
|
||||||
public Color BodyColor { get; private set; }
|
public Color BodyColor { get; set; }
|
||||||
public double Step => (double)Speed * 100 / Weight;
|
public double Step => (double)Speed * 100 / Weight;
|
||||||
|
|
||||||
public EntityBomber(int speed, double weight, Color bodycolor)
|
public EntityBomber(int speed, double weight, Color bodycolor)
|
||||||
|
@ -64,24 +64,28 @@ namespace AirBomber
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var obj = _bomber[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
var formBomberConfig = new FormBomberConfig();
|
||||||
if (obj == null)
|
|
||||||
|
formBomberConfig.AddEvent(bomber =>
|
||||||
{
|
{
|
||||||
return;
|
if (listBoxStorages.SelectedIndex != -1)
|
||||||
}
|
|
||||||
FormAirBomber form = new();
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (obj + form.SelectedBomber != 1)
|
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
var obj = _bomber[listBoxStorages.SelectedItem?.ToString() ?? string.Empty];
|
||||||
PicBoxBomberCollection.Image = obj.ShowBomber();
|
if (obj != null)
|
||||||
|
{
|
||||||
|
if (obj + bomber != 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект добавлен");
|
||||||
|
PicBoxBomberCollection.Image = obj.ShowBomber();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
});
|
||||||
{
|
formBomberConfig.Show();
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonRemoveBomber_Click(object sender, EventArgs e)
|
private void ButtonRemoveBomber_Click(object sender, EventArgs e)
|
||||||
|
296
AirBomber/FormBomberConfig.Designer.cs
generated
296
AirBomber/FormBomberConfig.Designer.cs
generated
@ -29,35 +29,35 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
groupBox1 = new GroupBox();
|
groupBox1 = new GroupBox();
|
||||||
weight = new Label();
|
hardLabel = new Label();
|
||||||
speed = new Label();
|
easyLabel = new Label();
|
||||||
SpeedNumericUpDown = new NumericUpDown();
|
|
||||||
WeightNumericUpDown = new NumericUpDown();
|
|
||||||
bakCheckBox = new CheckBox();
|
|
||||||
rocketCheckBox = new CheckBox();
|
|
||||||
colorGroupBox = new GroupBox();
|
colorGroupBox = new GroupBox();
|
||||||
redPanel = new Panel();
|
|
||||||
greenPanel = new Panel();
|
|
||||||
bluePanel = new Panel();
|
|
||||||
yellowPanel = new Panel();
|
|
||||||
purplePanel = new Panel();
|
purplePanel = new Panel();
|
||||||
blackPanel = new Panel();
|
blackPanel = new Panel();
|
||||||
greyPanel = new Panel();
|
greyPanel = new Panel();
|
||||||
whitePanel = new Panel();
|
whitePanel = new Panel();
|
||||||
easyLabel = new Label();
|
yellowPanel = new Panel();
|
||||||
hardLabel = new Label();
|
bluePanel = new Panel();
|
||||||
|
greenPanel = new Panel();
|
||||||
|
redPanel = new Panel();
|
||||||
|
rocketCheckBox = new CheckBox();
|
||||||
|
bakCheckBox = new CheckBox();
|
||||||
|
WeightNumericUpDown = new NumericUpDown();
|
||||||
|
SpeedNumericUpDown = new NumericUpDown();
|
||||||
|
weight = new Label();
|
||||||
|
speed = new Label();
|
||||||
PanelColor = new Panel();
|
PanelColor = new Panel();
|
||||||
pictureBox1 = new PictureBox();
|
|
||||||
labelColor = new Label();
|
|
||||||
labelDopColor = new Label();
|
labelDopColor = new Label();
|
||||||
|
labelColor = new Label();
|
||||||
|
pictureBoxConfig = new PictureBox();
|
||||||
AddButton = new Button();
|
AddButton = new Button();
|
||||||
buttonStop = new Button();
|
buttonStop = new Button();
|
||||||
groupBox1.SuspendLayout();
|
groupBox1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)SpeedNumericUpDown).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)WeightNumericUpDown).BeginInit();
|
|
||||||
colorGroupBox.SuspendLayout();
|
colorGroupBox.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)WeightNumericUpDown).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)SpeedNumericUpDown).BeginInit();
|
||||||
PanelColor.SuspendLayout();
|
PanelColor.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureBoxConfig).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
@ -78,59 +78,27 @@
|
|||||||
groupBox1.TabStop = false;
|
groupBox1.TabStop = false;
|
||||||
groupBox1.Text = "Параметры";
|
groupBox1.Text = "Параметры";
|
||||||
//
|
//
|
||||||
// weight
|
// hardLabel
|
||||||
//
|
//
|
||||||
weight.AutoSize = true;
|
hardLabel.BorderStyle = BorderStyle.FixedSingle;
|
||||||
weight.Location = new Point(15, 84);
|
hardLabel.Location = new Point(421, 228);
|
||||||
weight.Name = "weight";
|
hardLabel.Name = "hardLabel";
|
||||||
weight.Size = new Size(40, 20);
|
hardLabel.Size = new Size(127, 47);
|
||||||
weight.TabIndex = 1;
|
hardLabel.TabIndex = 8;
|
||||||
weight.Text = "Вес: ";
|
hardLabel.Text = "Продвинутый";
|
||||||
|
hardLabel.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
hardLabel.MouseDown += LableObject_MouseDown;
|
||||||
//
|
//
|
||||||
// speed
|
// easyLabel
|
||||||
//
|
//
|
||||||
speed.AutoSize = true;
|
easyLabel.BorderStyle = BorderStyle.FixedSingle;
|
||||||
speed.Location = new Point(15, 41);
|
easyLabel.Location = new Point(266, 228);
|
||||||
speed.Name = "speed";
|
easyLabel.Name = "easyLabel";
|
||||||
speed.Size = new Size(80, 20);
|
easyLabel.Size = new Size(116, 47);
|
||||||
speed.TabIndex = 0;
|
easyLabel.TabIndex = 7;
|
||||||
speed.Text = "Скорость: ";
|
easyLabel.Text = "Простой";
|
||||||
//
|
easyLabel.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
// SpeedNumericUpDown
|
easyLabel.MouseDown += LableObject_MouseDown;
|
||||||
//
|
|
||||||
SpeedNumericUpDown.Location = new Point(113, 34);
|
|
||||||
SpeedNumericUpDown.Name = "SpeedNumericUpDown";
|
|
||||||
SpeedNumericUpDown.Size = new Size(83, 27);
|
|
||||||
SpeedNumericUpDown.TabIndex = 2;
|
|
||||||
SpeedNumericUpDown.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
|
||||||
//
|
|
||||||
// WeightNumericUpDown
|
|
||||||
//
|
|
||||||
WeightNumericUpDown.Location = new Point(113, 82);
|
|
||||||
WeightNumericUpDown.Name = "WeightNumericUpDown";
|
|
||||||
WeightNumericUpDown.Size = new Size(83, 27);
|
|
||||||
WeightNumericUpDown.TabIndex = 3;
|
|
||||||
WeightNumericUpDown.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
|
||||||
//
|
|
||||||
// bakCheckBox
|
|
||||||
//
|
|
||||||
bakCheckBox.AutoSize = true;
|
|
||||||
bakCheckBox.Location = new Point(15, 152);
|
|
||||||
bakCheckBox.Name = "bakCheckBox";
|
|
||||||
bakCheckBox.Size = new Size(199, 24);
|
|
||||||
bakCheckBox.TabIndex = 4;
|
|
||||||
bakCheckBox.Text = "Признак наличия баков";
|
|
||||||
bakCheckBox.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// rocketCheckBox
|
|
||||||
//
|
|
||||||
rocketCheckBox.AutoSize = true;
|
|
||||||
rocketCheckBox.Location = new Point(15, 200);
|
|
||||||
rocketCheckBox.Name = "rocketCheckBox";
|
|
||||||
rocketCheckBox.Size = new Size(196, 24);
|
|
||||||
rocketCheckBox.TabIndex = 5;
|
|
||||||
rocketCheckBox.Text = "Признак наличия ракет";
|
|
||||||
rocketCheckBox.UseVisualStyleBackColor = true;
|
|
||||||
//
|
//
|
||||||
// colorGroupBox
|
// colorGroupBox
|
||||||
//
|
//
|
||||||
@ -149,38 +117,6 @@
|
|||||||
colorGroupBox.TabStop = false;
|
colorGroupBox.TabStop = false;
|
||||||
colorGroupBox.Text = "Цвета";
|
colorGroupBox.Text = "Цвета";
|
||||||
//
|
//
|
||||||
// redPanel
|
|
||||||
//
|
|
||||||
redPanel.BackColor = Color.Red;
|
|
||||||
redPanel.Location = new Point(18, 37);
|
|
||||||
redPanel.Name = "redPanel";
|
|
||||||
redPanel.Size = new Size(50, 50);
|
|
||||||
redPanel.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// greenPanel
|
|
||||||
//
|
|
||||||
greenPanel.BackColor = Color.FromArgb(0, 192, 0);
|
|
||||||
greenPanel.Location = new Point(97, 37);
|
|
||||||
greenPanel.Name = "greenPanel";
|
|
||||||
greenPanel.Size = new Size(50, 50);
|
|
||||||
greenPanel.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// bluePanel
|
|
||||||
//
|
|
||||||
bluePanel.BackColor = Color.Blue;
|
|
||||||
bluePanel.Location = new Point(174, 37);
|
|
||||||
bluePanel.Name = "bluePanel";
|
|
||||||
bluePanel.Size = new Size(50, 50);
|
|
||||||
bluePanel.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// yellowPanel
|
|
||||||
//
|
|
||||||
yellowPanel.BackColor = Color.Yellow;
|
|
||||||
yellowPanel.Location = new Point(250, 37);
|
|
||||||
yellowPanel.Name = "yellowPanel";
|
|
||||||
yellowPanel.Size = new Size(50, 50);
|
|
||||||
yellowPanel.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// purplePanel
|
// purplePanel
|
||||||
//
|
//
|
||||||
purplePanel.BackColor = Color.Purple;
|
purplePanel.BackColor = Color.Purple;
|
||||||
@ -188,6 +124,7 @@
|
|||||||
purplePanel.Name = "purplePanel";
|
purplePanel.Name = "purplePanel";
|
||||||
purplePanel.Size = new Size(50, 50);
|
purplePanel.Size = new Size(50, 50);
|
||||||
purplePanel.TabIndex = 3;
|
purplePanel.TabIndex = 3;
|
||||||
|
purplePanel.MouseClick += PanelColor_MouseDown;
|
||||||
//
|
//
|
||||||
// blackPanel
|
// blackPanel
|
||||||
//
|
//
|
||||||
@ -196,6 +133,7 @@
|
|||||||
blackPanel.Name = "blackPanel";
|
blackPanel.Name = "blackPanel";
|
||||||
blackPanel.Size = new Size(50, 50);
|
blackPanel.Size = new Size(50, 50);
|
||||||
blackPanel.TabIndex = 4;
|
blackPanel.TabIndex = 4;
|
||||||
|
blackPanel.MouseClick += PanelColor_MouseDown;
|
||||||
//
|
//
|
||||||
// greyPanel
|
// greyPanel
|
||||||
//
|
//
|
||||||
@ -204,6 +142,7 @@
|
|||||||
greyPanel.Name = "greyPanel";
|
greyPanel.Name = "greyPanel";
|
||||||
greyPanel.Size = new Size(50, 50);
|
greyPanel.Size = new Size(50, 50);
|
||||||
greyPanel.TabIndex = 5;
|
greyPanel.TabIndex = 5;
|
||||||
|
greyPanel.MouseClick += PanelColor_MouseDown;
|
||||||
//
|
//
|
||||||
// whitePanel
|
// whitePanel
|
||||||
//
|
//
|
||||||
@ -212,55 +151,111 @@
|
|||||||
whitePanel.Name = "whitePanel";
|
whitePanel.Name = "whitePanel";
|
||||||
whitePanel.Size = new Size(50, 50);
|
whitePanel.Size = new Size(50, 50);
|
||||||
whitePanel.TabIndex = 2;
|
whitePanel.TabIndex = 2;
|
||||||
|
whitePanel.MouseClick += PanelColor_MouseDown;
|
||||||
//
|
//
|
||||||
// easyLabel
|
// yellowPanel
|
||||||
//
|
//
|
||||||
easyLabel.BorderStyle = BorderStyle.FixedSingle;
|
yellowPanel.BackColor = Color.Yellow;
|
||||||
easyLabel.Location = new Point(266, 228);
|
yellowPanel.Location = new Point(250, 37);
|
||||||
easyLabel.Name = "easyLabel";
|
yellowPanel.Name = "yellowPanel";
|
||||||
easyLabel.Size = new Size(116, 47);
|
yellowPanel.Size = new Size(50, 50);
|
||||||
easyLabel.TabIndex = 7;
|
yellowPanel.TabIndex = 1;
|
||||||
easyLabel.Text = "Простой";
|
yellowPanel.MouseClick += PanelColor_MouseDown;
|
||||||
easyLabel.TextAlign = ContentAlignment.MiddleCenter;
|
|
||||||
//
|
//
|
||||||
// hardLabel
|
// bluePanel
|
||||||
//
|
//
|
||||||
hardLabel.BorderStyle = BorderStyle.FixedSingle;
|
bluePanel.BackColor = Color.Blue;
|
||||||
hardLabel.Location = new Point(421, 228);
|
bluePanel.Location = new Point(174, 37);
|
||||||
hardLabel.Name = "hardLabel";
|
bluePanel.Name = "bluePanel";
|
||||||
hardLabel.Size = new Size(127, 47);
|
bluePanel.Size = new Size(50, 50);
|
||||||
hardLabel.TabIndex = 8;
|
bluePanel.TabIndex = 1;
|
||||||
hardLabel.Text = "Продвинутый";
|
bluePanel.MouseClick += PanelColor_MouseDown;
|
||||||
hardLabel.TextAlign = ContentAlignment.MiddleCenter;
|
//
|
||||||
|
// greenPanel
|
||||||
|
//
|
||||||
|
greenPanel.BackColor = Color.FromArgb(0, 192, 0);
|
||||||
|
greenPanel.Location = new Point(97, 37);
|
||||||
|
greenPanel.Name = "greenPanel";
|
||||||
|
greenPanel.Size = new Size(50, 50);
|
||||||
|
greenPanel.TabIndex = 1;
|
||||||
|
greenPanel.MouseClick += PanelColor_MouseDown;
|
||||||
|
//
|
||||||
|
// redPanel
|
||||||
|
//
|
||||||
|
redPanel.BackColor = Color.Red;
|
||||||
|
redPanel.Location = new Point(18, 37);
|
||||||
|
redPanel.Name = "redPanel";
|
||||||
|
redPanel.Size = new Size(50, 50);
|
||||||
|
redPanel.TabIndex = 0;
|
||||||
|
redPanel.MouseClick += PanelColor_MouseDown;
|
||||||
|
//
|
||||||
|
// rocketCheckBox
|
||||||
|
//
|
||||||
|
rocketCheckBox.AutoSize = true;
|
||||||
|
rocketCheckBox.Location = new Point(15, 200);
|
||||||
|
rocketCheckBox.Name = "rocketCheckBox";
|
||||||
|
rocketCheckBox.Size = new Size(196, 24);
|
||||||
|
rocketCheckBox.TabIndex = 5;
|
||||||
|
rocketCheckBox.Text = "Признак наличия ракет";
|
||||||
|
rocketCheckBox.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// bakCheckBox
|
||||||
|
//
|
||||||
|
bakCheckBox.AutoSize = true;
|
||||||
|
bakCheckBox.Location = new Point(15, 152);
|
||||||
|
bakCheckBox.Name = "bakCheckBox";
|
||||||
|
bakCheckBox.Size = new Size(199, 24);
|
||||||
|
bakCheckBox.TabIndex = 4;
|
||||||
|
bakCheckBox.Text = "Признак наличия баков";
|
||||||
|
bakCheckBox.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// WeightNumericUpDown
|
||||||
|
//
|
||||||
|
WeightNumericUpDown.Location = new Point(113, 82);
|
||||||
|
WeightNumericUpDown.Name = "WeightNumericUpDown";
|
||||||
|
WeightNumericUpDown.Size = new Size(83, 27);
|
||||||
|
WeightNumericUpDown.TabIndex = 3;
|
||||||
|
WeightNumericUpDown.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// SpeedNumericUpDown
|
||||||
|
//
|
||||||
|
SpeedNumericUpDown.Location = new Point(113, 34);
|
||||||
|
SpeedNumericUpDown.Name = "SpeedNumericUpDown";
|
||||||
|
SpeedNumericUpDown.Size = new Size(83, 27);
|
||||||
|
SpeedNumericUpDown.TabIndex = 2;
|
||||||
|
SpeedNumericUpDown.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// weight
|
||||||
|
//
|
||||||
|
weight.AutoSize = true;
|
||||||
|
weight.Location = new Point(15, 84);
|
||||||
|
weight.Name = "weight";
|
||||||
|
weight.Size = new Size(40, 20);
|
||||||
|
weight.TabIndex = 1;
|
||||||
|
weight.Text = "Вес: ";
|
||||||
|
//
|
||||||
|
// speed
|
||||||
|
//
|
||||||
|
speed.AutoSize = true;
|
||||||
|
speed.Location = new Point(15, 41);
|
||||||
|
speed.Name = "speed";
|
||||||
|
speed.Size = new Size(80, 20);
|
||||||
|
speed.TabIndex = 0;
|
||||||
|
speed.Text = "Скорость: ";
|
||||||
//
|
//
|
||||||
// PanelColor
|
// PanelColor
|
||||||
//
|
//
|
||||||
PanelColor.AllowDrop = true;
|
PanelColor.AllowDrop = true;
|
||||||
PanelColor.Controls.Add(labelDopColor);
|
PanelColor.Controls.Add(labelDopColor);
|
||||||
PanelColor.Controls.Add(labelColor);
|
PanelColor.Controls.Add(labelColor);
|
||||||
PanelColor.Controls.Add(pictureBox1);
|
PanelColor.Controls.Add(pictureBoxConfig);
|
||||||
PanelColor.Location = new Point(654, 12);
|
PanelColor.Location = new Point(654, 12);
|
||||||
PanelColor.Name = "PanelColor";
|
PanelColor.Name = "PanelColor";
|
||||||
PanelColor.Size = new Size(304, 275);
|
PanelColor.Size = new Size(304, 275);
|
||||||
PanelColor.TabIndex = 2;
|
PanelColor.TabIndex = 2;
|
||||||
//
|
PanelColor.DragDrop += PanelObject_DragDrop;
|
||||||
// pictureBox1
|
PanelColor.DragEnter += PanelObject_DragEnter;
|
||||||
//
|
PanelColor.MouseDown += PanelColor_MouseDown;
|
||||||
pictureBox1.Location = new Point(12, 54);
|
|
||||||
pictureBox1.Name = "pictureBox1";
|
|
||||||
pictureBox1.Size = new Size(284, 209);
|
|
||||||
pictureBox1.TabIndex = 0;
|
|
||||||
pictureBox1.TabStop = false;
|
|
||||||
//
|
|
||||||
// labelColor
|
|
||||||
//
|
|
||||||
labelColor.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
labelColor.Location = new Point(12, 12);
|
|
||||||
labelColor.Name = "labelColor";
|
|
||||||
labelColor.Size = new Size(134, 34);
|
|
||||||
labelColor.TabIndex = 1;
|
|
||||||
labelColor.Text = "Цвет";
|
|
||||||
labelColor.TextAlign = ContentAlignment.MiddleCenter;
|
|
||||||
//
|
//
|
||||||
// labelDopColor
|
// labelDopColor
|
||||||
//
|
//
|
||||||
@ -271,6 +266,30 @@
|
|||||||
labelDopColor.TabIndex = 2;
|
labelDopColor.TabIndex = 2;
|
||||||
labelDopColor.Text = "Доп. цвет";
|
labelDopColor.Text = "Доп. цвет";
|
||||||
labelDopColor.TextAlign = ContentAlignment.MiddleCenter;
|
labelDopColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelDopColor.DragDrop += labelAddBoxColor_DragDrop;
|
||||||
|
labelDopColor.DragEnter += LabelColor_DragEnter;
|
||||||
|
labelDopColor.MouseDown += LableObject_MouseDown;
|
||||||
|
//
|
||||||
|
// labelColor
|
||||||
|
//
|
||||||
|
labelColor.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
labelColor.Location = new Point(12, 12);
|
||||||
|
labelColor.Name = "labelColor";
|
||||||
|
labelColor.Size = new Size(134, 34);
|
||||||
|
labelColor.TabIndex = 1;
|
||||||
|
labelColor.Text = "Цвет";
|
||||||
|
labelColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelColor.DragDrop += LabelBaseColor_DragDrop;
|
||||||
|
labelColor.DragEnter += LabelColor_DragEnter;
|
||||||
|
labelColor.MouseDown += LableObject_MouseDown;
|
||||||
|
//
|
||||||
|
// pictureBoxConfig
|
||||||
|
//
|
||||||
|
pictureBoxConfig.Location = new Point(12, 54);
|
||||||
|
pictureBoxConfig.Name = "pictureBoxConfig";
|
||||||
|
pictureBoxConfig.Size = new Size(284, 209);
|
||||||
|
pictureBoxConfig.TabIndex = 0;
|
||||||
|
pictureBoxConfig.TabStop = false;
|
||||||
//
|
//
|
||||||
// AddButton
|
// AddButton
|
||||||
//
|
//
|
||||||
@ -280,6 +299,7 @@
|
|||||||
AddButton.TabIndex = 3;
|
AddButton.TabIndex = 3;
|
||||||
AddButton.Text = "Добавить";
|
AddButton.Text = "Добавить";
|
||||||
AddButton.UseVisualStyleBackColor = true;
|
AddButton.UseVisualStyleBackColor = true;
|
||||||
|
AddButton.Click += AddButton_Click;
|
||||||
//
|
//
|
||||||
// buttonStop
|
// buttonStop
|
||||||
//
|
//
|
||||||
@ -303,11 +323,11 @@
|
|||||||
Text = "FormBomberConfig";
|
Text = "FormBomberConfig";
|
||||||
groupBox1.ResumeLayout(false);
|
groupBox1.ResumeLayout(false);
|
||||||
groupBox1.PerformLayout();
|
groupBox1.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)SpeedNumericUpDown).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)WeightNumericUpDown).EndInit();
|
|
||||||
colorGroupBox.ResumeLayout(false);
|
colorGroupBox.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)WeightNumericUpDown).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)SpeedNumericUpDown).EndInit();
|
||||||
PanelColor.ResumeLayout(false);
|
PanelColor.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureBoxConfig).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +354,7 @@
|
|||||||
private Panel PanelColor;
|
private Panel PanelColor;
|
||||||
private Label labelDopColor;
|
private Label labelDopColor;
|
||||||
private Label labelColor;
|
private Label labelColor;
|
||||||
private PictureBox pictureBox1;
|
private PictureBox pictureBoxConfig;
|
||||||
private Button AddButton;
|
private Button AddButton;
|
||||||
private Button buttonStop;
|
private Button buttonStop;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using System;
|
using AirBomber.DrawningObjects;
|
||||||
|
using AirBomber.Entities;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@ -12,9 +14,132 @@ namespace AirBomber
|
|||||||
{
|
{
|
||||||
public partial class FormBomberConfig : Form
|
public partial class FormBomberConfig : Form
|
||||||
{
|
{
|
||||||
|
private event Action<DrawningBomber>? EventAddBomber;
|
||||||
|
DrawningBomber? _bomber = null;
|
||||||
|
|
||||||
public FormBomberConfig()
|
public FormBomberConfig()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
redPanel.MouseDown += PanelColor_MouseDown;
|
||||||
|
greenPanel.MouseDown += PanelColor_MouseDown;
|
||||||
|
bluePanel.MouseDown += PanelColor_MouseDown;
|
||||||
|
yellowPanel.MouseDown += PanelColor_MouseDown;
|
||||||
|
whitePanel.MouseDown += PanelColor_MouseDown;
|
||||||
|
greyPanel.MouseDown += PanelColor_MouseDown;
|
||||||
|
blackPanel.MouseDown += PanelColor_MouseDown;
|
||||||
|
purplePanel.MouseDown += PanelColor_MouseDown;
|
||||||
|
buttonStop.Click += (sender, e) => Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawBomber()
|
||||||
|
{
|
||||||
|
Bitmap bmp = new(pictureBoxConfig.Width, pictureBoxConfig.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_bomber?.SetPosition(5, 5);
|
||||||
|
_bomber?.DrawBomber(gr);
|
||||||
|
pictureBoxConfig.Image = bmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddEvent(Action<DrawningBomber> ev)
|
||||||
|
{
|
||||||
|
if (EventAddBomber == null)
|
||||||
|
{
|
||||||
|
EventAddBomber = new Action<DrawningBomber>(ev);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EventAddBomber += ev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LableObject_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||||
|
{
|
||||||
|
case "easyLabel":
|
||||||
|
_bomber = new DrawningBomber((int)SpeedNumericUpDown.Value,
|
||||||
|
(int)WeightNumericUpDown.Value, Color.White, pictureBoxConfig.Width,
|
||||||
|
pictureBoxConfig.Height);
|
||||||
|
break;
|
||||||
|
case "hardLabel":
|
||||||
|
_bomber = new DrawningAirBomber((int)SpeedNumericUpDown.Value,
|
||||||
|
(int)WeightNumericUpDown.Value, Color.Red, Color.Black,
|
||||||
|
rocketCheckBox.Checked, bakCheckBox.Checked, pictureBoxConfig.Width,
|
||||||
|
pictureBoxConfig.Height);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DrawBomber();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
EventAddBomber?.Invoke(_bomber);
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_bomber != null)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(typeof(Color)))
|
||||||
|
{
|
||||||
|
_bomber.EntityBomber.BodyColor = (Color)e.Data.GetData(typeof(Color));
|
||||||
|
}
|
||||||
|
DrawBomber();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LabelColor_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_bomber != null && _bomber.EntityBomber is EntityAirBomber entityAirBomber)
|
||||||
|
{
|
||||||
|
labelDopColor.AllowDrop = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
labelDopColor.AllowDrop = false;
|
||||||
|
|
||||||
|
if (e.Data.GetDataPresent(typeof(Color)))
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void labelAddBoxColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_bomber != null && _bomber.EntityBomber is EntityAirBomber entityAirBomber)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(typeof(Color)))
|
||||||
|
{
|
||||||
|
entityAirBomber.DopColor = (Color)e.Data.GetData(typeof(Color));
|
||||||
|
}
|
||||||
|
DrawBomber();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user