движение и выбор цвета
This commit is contained in:
parent
939e4130a9
commit
6952317d59
@ -75,6 +75,7 @@
|
||||
this.buttonLeft.TabIndex = 10;
|
||||
this.buttonLeft.Text = " ";
|
||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
||||
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
@ -87,6 +88,7 @@
|
||||
this.buttonRight.TabIndex = 9;
|
||||
this.buttonRight.Text = " ";
|
||||
this.buttonRight.UseVisualStyleBackColor = true;
|
||||
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
@ -99,6 +101,7 @@
|
||||
this.buttonUp.TabIndex = 8;
|
||||
this.buttonUp.Text = " ";
|
||||
this.buttonUp.UseVisualStyleBackColor = true;
|
||||
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
@ -111,6 +114,7 @@
|
||||
this.buttonDown.TabIndex = 7;
|
||||
this.buttonDown.Text = " ";
|
||||
this.buttonDown.UseVisualStyleBackColor = true;
|
||||
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonShowOnMap
|
||||
//
|
||||
|
@ -141,16 +141,24 @@ namespace WarmlyShip
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
dir = Direction.Up;
|
||||
{
|
||||
dir = Direction.Up;
|
||||
}
|
||||
break;
|
||||
case "buttonDown":
|
||||
dir = Direction.Down;
|
||||
{
|
||||
dir = Direction.Down;
|
||||
}
|
||||
break;
|
||||
case "buttonLeft":
|
||||
dir = Direction.Left;
|
||||
{
|
||||
dir = Direction.Left;
|
||||
}
|
||||
break;
|
||||
case "buttonRight":
|
||||
dir = Direction.Right;
|
||||
{
|
||||
dir = Direction.Right;
|
||||
}
|
||||
break;
|
||||
}
|
||||
pictureBox.Image = _mapShipsCollectionGeneric.MoveObject(dir);
|
||||
|
@ -34,10 +34,16 @@ namespace WarmlyShip
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random rnd = new();
|
||||
_ship = new DrawningShip(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
||||
_ship.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxShip.Width, pictureBoxShip.Height);
|
||||
Color color = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256),
|
||||
rnd.Next(0, 256));
|
||||
ColorDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
_ship = new DrawningShip(rnd.Next(100, 300), rnd.Next(1000, 2000),
|
||||
color);
|
||||
SetData();
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
@ -69,12 +75,27 @@ namespace WarmlyShip
|
||||
private void ButtonCreateModif_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random rnd = new();
|
||||
Color color = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256),
|
||||
rnd.Next(0, 256));
|
||||
ColorDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
Color dopColor = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256),
|
||||
rnd.Next(0, 256));
|
||||
ColorDialog dialogDop = new();
|
||||
if (dialogDop.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
dopColor = dialogDop.Color;
|
||||
}
|
||||
_ship = new DrawningWarmlyShip(rnd.Next(100, 300), rnd.Next(1000, 2000),
|
||||
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
|
||||
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
|
||||
Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
|
||||
color, dopColor,
|
||||
Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0,
|
||||
2)));
|
||||
SetData();
|
||||
Draw();
|
||||
|
||||
}
|
||||
|
||||
private void ButtonSelectShip_Click(object sender, EventArgs e)
|
||||
|
Loading…
Reference in New Issue
Block a user