Compare commits

..

No commits in common. "58872d7938e4bc75edec8d5b13f6ae054caff7e4" and "e9ec3ff774ff491c4368740251f5eda1afe4ee55" have entirely different histories.

View File

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