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