Lab5 updated again
This commit is contained in:
parent
101c263285
commit
b053464a5a
@ -13,6 +13,8 @@ namespace ProjectAirBomber.Entities
|
||||
public bool Bombs { get; private set; }
|
||||
public bool Fuel { get; private set; }
|
||||
|
||||
public void ChangeAddColor(Color color) { AdditionalColor = color; }
|
||||
|
||||
public EntityAirBomber(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool bombs, bool fuel)
|
||||
: base(speed, weight, bodyColor)
|
||||
|
@ -16,6 +16,8 @@ namespace ProjectAirBomber.Entities
|
||||
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
|
||||
public void ChangeColor(Color color) {BodyColor = color;}
|
||||
|
||||
public EntityPlane(int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
|
4
AirBomber/AirBomber/FormPlaneConfig.Designer.cs
generated
4
AirBomber/AirBomber/FormPlaneConfig.Designer.cs
generated
@ -143,7 +143,7 @@
|
||||
//
|
||||
// panelPurple
|
||||
//
|
||||
panelPurple.BackColor = Color.FromArgb(192, 0, 192);
|
||||
panelPurple.BackColor = Color.Purple;
|
||||
panelPurple.Location = new Point(321, 103);
|
||||
panelPurple.Name = "panelPurple";
|
||||
panelPurple.Size = new Size(58, 56);
|
||||
@ -151,7 +151,7 @@
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
panelGreen.BackColor = Color.FromArgb(0, 192, 0);
|
||||
panelGreen.BackColor = Color.Green;
|
||||
panelGreen.Location = new Point(133, 26);
|
||||
panelGreen.Name = "panelGreen";
|
||||
panelGreen.Size = new Size(58, 56);
|
||||
|
@ -141,16 +141,7 @@ namespace ProjectAirBomber
|
||||
if (_plane?.EntityPlane == null)
|
||||
return;
|
||||
Color bodyColor = (Color)e.Data.GetData(typeof(Color));
|
||||
if (_plane is DrawingAirBomber)
|
||||
{
|
||||
_plane = new DrawingAirBomber((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, bodyColor, ((EntityAirBomber)_plane.EntityPlane).AdditionalColor, checkBoxBombs.Checked,
|
||||
checkBoxFuel.Checked, _pictureWidth, _pictureHeight);
|
||||
} else
|
||||
{
|
||||
_plane = new DrawingPlane((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, bodyColor, _pictureWidth, _pictureHeight);
|
||||
}
|
||||
_plane.EntityPlane.ChangeColor(bodyColor);
|
||||
DrawPlane();
|
||||
}
|
||||
|
||||
@ -171,22 +162,8 @@ namespace ProjectAirBomber
|
||||
if ((_plane?.EntityPlane == null) || (_plane is DrawingAirBomber == false))
|
||||
return;
|
||||
Color additionalColor = (Color)e.Data.GetData(typeof(Color));
|
||||
_plane = new DrawingAirBomber((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, _plane.EntityPlane.BodyColor, additionalColor, checkBoxBombs.Checked,
|
||||
checkBoxFuel.Checked, _pictureWidth, _pictureHeight);
|
||||
((EntityAirBomber)_plane.EntityPlane).ChangeAddColor(additionalColor);
|
||||
DrawPlane();
|
||||
}
|
||||
|
||||
private void labelAddColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user