LabWork05 сделана дома.
This commit is contained in:
parent
1cf95f8b59
commit
b02bce0387
@ -10,7 +10,7 @@ namespace AirBomber
|
|||||||
{
|
{
|
||||||
public int Speed { get; private set; }
|
public int Speed { get; private set; }
|
||||||
public float Weight { get; private set; }
|
public float Weight { get; private set; }
|
||||||
public Color BodyColor { get; private set; }
|
public Color BodyColor { get; set; }
|
||||||
public float Step => Speed * 100 / Weight;
|
public float Step => Speed * 100 / Weight;
|
||||||
|
|
||||||
public EntityAirBomber(int speed, float weight, Color bodyColor)
|
public EntityAirBomber(int speed, float weight, Color bodyColor)
|
||||||
|
@ -8,7 +8,7 @@ namespace AirBomber
|
|||||||
{
|
{
|
||||||
internal class EntityWarplane : EntityAirBomber
|
internal class EntityWarplane : EntityAirBomber
|
||||||
{
|
{
|
||||||
public Color DopColor { get; private set; }
|
public Color DopColor { get; set; }
|
||||||
|
|
||||||
public bool Engines { get; private set; }
|
public bool Engines { get; private set; }
|
||||||
|
|
||||||
|
24
AirBomber/AirBomber/FormAirBomberConfig.Designer.cs
generated
24
AirBomber/AirBomber/FormAirBomberConfig.Designer.cs
generated
@ -51,7 +51,7 @@
|
|||||||
this.labelDopColor = new System.Windows.Forms.Label();
|
this.labelDopColor = new System.Windows.Forms.Label();
|
||||||
this.labelBaseColor = new System.Windows.Forms.Label();
|
this.labelBaseColor = new System.Windows.Forms.Label();
|
||||||
this.buttonOk = new System.Windows.Forms.Button();
|
this.buttonOk = new System.Windows.Forms.Button();
|
||||||
this.button2 = new System.Windows.Forms.Button();
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
this.groupBoxConfig.SuspendLayout();
|
this.groupBoxConfig.SuspendLayout();
|
||||||
this.groupBoxColors.SuspendLayout();
|
this.groupBoxColors.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
||||||
@ -274,6 +274,8 @@
|
|||||||
this.labelDopColor.TabIndex = 10;
|
this.labelDopColor.TabIndex = 10;
|
||||||
this.labelDopColor.Text = "Доп. цвет";
|
this.labelDopColor.Text = "Доп. цвет";
|
||||||
this.labelDopColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
this.labelDopColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelDopColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelDopColor_DragDrop);
|
||||||
|
this.labelDopColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelBaseColor_DragEnter);
|
||||||
//
|
//
|
||||||
// labelBaseColor
|
// labelBaseColor
|
||||||
//
|
//
|
||||||
@ -285,6 +287,8 @@
|
|||||||
this.labelBaseColor.TabIndex = 9;
|
this.labelBaseColor.TabIndex = 9;
|
||||||
this.labelBaseColor.Text = "Цвет";
|
this.labelBaseColor.Text = "Цвет";
|
||||||
this.labelBaseColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
this.labelBaseColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelBaseColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelBaseColor_DragDrop);
|
||||||
|
this.labelBaseColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelBaseColor_DragEnter);
|
||||||
//
|
//
|
||||||
// buttonOk
|
// buttonOk
|
||||||
//
|
//
|
||||||
@ -296,21 +300,21 @@
|
|||||||
this.buttonOk.UseVisualStyleBackColor = true;
|
this.buttonOk.UseVisualStyleBackColor = true;
|
||||||
this.buttonOk.Click += new System.EventHandler(this.ButtonOk_Click);
|
this.buttonOk.Click += new System.EventHandler(this.ButtonOk_Click);
|
||||||
//
|
//
|
||||||
// button2
|
// buttonCancel
|
||||||
//
|
//
|
||||||
this.button2.Location = new System.Drawing.Point(908, 226);
|
this.buttonCancel.Location = new System.Drawing.Point(908, 226);
|
||||||
this.button2.Name = "button2";
|
this.buttonCancel.Name = "buttonCancel";
|
||||||
this.button2.Size = new System.Drawing.Size(105, 38);
|
this.buttonCancel.Size = new System.Drawing.Size(105, 38);
|
||||||
this.button2.TabIndex = 4;
|
this.buttonCancel.TabIndex = 4;
|
||||||
this.button2.Text = "Отмена";
|
this.buttonCancel.Text = "Отмена";
|
||||||
this.button2.UseVisualStyleBackColor = true;
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// FormAirBomberConfig
|
// FormAirBomberConfig
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1055, 279);
|
this.ClientSize = new System.Drawing.Size(1055, 279);
|
||||||
this.Controls.Add(this.button2);
|
this.Controls.Add(this.buttonCancel);
|
||||||
this.Controls.Add(this.buttonOk);
|
this.Controls.Add(this.buttonOk);
|
||||||
this.Controls.Add(this.panelObject);
|
this.Controls.Add(this.panelObject);
|
||||||
this.Controls.Add(this.groupBoxConfig);
|
this.Controls.Add(this.groupBoxConfig);
|
||||||
@ -352,6 +356,6 @@
|
|||||||
private Label labelDopColor;
|
private Label labelDopColor;
|
||||||
private Label labelBaseColor;
|
private Label labelBaseColor;
|
||||||
private Button buttonOk;
|
private Button buttonOk;
|
||||||
private Button button2;
|
private Button buttonCancel;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -27,7 +27,7 @@ namespace AirBomber
|
|||||||
panelPurple.MouseDown += PanelColor_MouseDown;
|
panelPurple.MouseDown += PanelColor_MouseDown;
|
||||||
panelGreen.MouseDown += PanelColor_MouseDown;
|
panelGreen.MouseDown += PanelColor_MouseDown;
|
||||||
|
|
||||||
// TODO buttonCancel.Click with lambda
|
buttonCancel.Click += (object sender, EventArgs e) => { Close(); };
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawAirBomber()
|
private void DrawAirBomber()
|
||||||
@ -70,12 +70,16 @@ namespace AirBomber
|
|||||||
|
|
||||||
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
|
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
// TODO Call method from object _car and set color
|
if (_airBomber == null) return;
|
||||||
|
_airBomber.AirBomber.BodyColor = (Color)e.Data.GetData(typeof(Color));
|
||||||
|
DrawAirBomber();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LabelDopColor_DragDrop(object sender, DragEventArgs e)
|
private void LabelDopColor_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
// TODO Call method from object _car if _car is DrawningSportCar and set dop color
|
if (_airBomber == null || !(_airBomber.AirBomber is EntityWarplane airBomber)) return;
|
||||||
|
airBomber.DopColor = (Color)e.Data.GetData(typeof(Color));
|
||||||
|
DrawAirBomber();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||||
|
@ -57,10 +57,27 @@ namespace AirBomber
|
|||||||
private void ButtonAddAirBomber_Click(object sender, EventArgs e)
|
private void ButtonAddAirBomber_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var formAirBomberConfig = new FormAirBomberConfig();
|
var formAirBomberConfig = new FormAirBomberConfig();
|
||||||
// TODO Call method AddEvent form formCarConfig
|
formAirBomberConfig.AddEvent(AddAirBomber);
|
||||||
formAirBomberConfig.Show();
|
formAirBomberConfig.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AddAirBomber(DrawningBomber airBomber)
|
||||||
|
{
|
||||||
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObjectBomber(airBomber) > -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект добавлен");
|
||||||
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ButtonRemoveAirBomber_Click(object sender, EventArgs e)
|
private void ButtonRemoveAirBomber_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (listBoxMaps.SelectedIndex == -1)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user