fix
This commit is contained in:
commit
58872d7938
@ -6,7 +6,7 @@ namespace AntiAircraftGun
|
||||
{
|
||||
public partial class FormAntiAirCraftGun : Form
|
||||
{
|
||||
private BaseDrawingAntiAirCraftGun _drawing;
|
||||
private BaseDrawingAntiAirCraftGun _drawingAntiAirCraftGun;
|
||||
|
||||
private AbstractStrategy? _abstractStrategy;
|
||||
|
||||
@ -20,7 +20,7 @@ namespace AntiAircraftGun
|
||||
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawing == null)
|
||||
if (_drawingAntiAirCraftGun == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -28,29 +28,29 @@ namespace AntiAircraftGun
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
_drawing.MoveTransport(DirectionType.Up);
|
||||
_drawingAntiAirCraftGun.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
_drawing.MoveTransport(DirectionType.Down);
|
||||
_drawingAntiAirCraftGun.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
_drawing.MoveTransport(DirectionType.Left);
|
||||
_drawingAntiAirCraftGun.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
_drawing.MoveTransport(DirectionType.Right);
|
||||
_drawingAntiAirCraftGun.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawing == null)
|
||||
if (_drawingAntiAirCraftGun == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Bitmap bmp = new Bitmap(pictureBoxAntiAircraftGun.Width, pictureBoxAntiAircraftGun.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawing.DrawTransport(gr);
|
||||
_drawingAntiAirCraftGun.DrawTransport(gr);
|
||||
pictureBoxAntiAircraftGun.Image = bmp;
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ namespace AntiAircraftGun
|
||||
pictureBoxAntiAircraftGun.Height
|
||||
);
|
||||
|
||||
_drawing.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
_drawingAntiAirCraftGun.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
|
||||
@ -97,13 +97,13 @@ namespace AntiAircraftGun
|
||||
pictureBoxAntiAircraftGun.Height
|
||||
);
|
||||
|
||||
_drawing.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
_drawingAntiAirCraftGun.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void ButtonStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawing == null)
|
||||
if (_drawingAntiAirCraftGun == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -121,7 +121,7 @@ namespace AntiAircraftGun
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.SetData(new
|
||||
DrawingObjectAntiAirCraftGun(_drawing), pictureBoxAntiAircraftGun.Width,
|
||||
DrawingObjectAntiAirCraftGun(_drawingAntiAirCraftGun), pictureBoxAntiAircraftGun.Width,
|
||||
pictureBoxAntiAircraftGun.Height);
|
||||
comboBoxStrategy.Enabled = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user