Окончательные изменения
This commit is contained in:
parent
d60f81c6f7
commit
3290b58955
@ -40,7 +40,13 @@ namespace AirFighter
|
||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random rnd = new Random();
|
||||
_airFighter = new DrawningAirFighter(rnd.Next(200, 500), rnd.Next(2000, 5000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
||||
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;
|
||||
}
|
||||
_airFighter = new DrawningAirFighter(rnd.Next(200, 500), rnd.Next(2000, 5000), color);
|
||||
SetData();
|
||||
Draw();
|
||||
}
|
||||
@ -87,8 +93,20 @@ namespace AirFighter
|
||||
private void ButtonUpgrade_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random rnd = new();
|
||||
_airFighter = new DrawningUpgradeAirFighter(rnd.Next(300, 600), rnd.Next(2000, 5000), 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 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;
|
||||
}
|
||||
_airFighter = new DrawningUpgradeAirFighter(rnd.Next(300, 600), rnd.Next(2000, 5000), color,
|
||||
dopColor, Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
|
||||
SetData();
|
||||
Draw();
|
||||
}
|
||||
|
@ -129,10 +129,10 @@ namespace AirFighter
|
||||
{
|
||||
for (; j > i; j--)
|
||||
{
|
||||
var car = _setAirFighters.Get(j);
|
||||
if (car != null)
|
||||
var airFighter = _setAirFighters.Get(j);
|
||||
if (airFighter != null)
|
||||
{
|
||||
_setAirFighters.Insert(car, i);
|
||||
_setAirFighters.Insert(airFighter, i);
|
||||
_setAirFighters.Remove(j);
|
||||
break;
|
||||
}
|
||||
|
@ -57,29 +57,7 @@ namespace AirFighter
|
||||
/// <returns></returns>
|
||||
public int Insert(T airFighter)
|
||||
{
|
||||
if (!CheckNullPosition(0))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
T temp = airFighter;
|
||||
for(int i = 0; i < _places.Length; i++)
|
||||
{
|
||||
if (_places[i] == null)
|
||||
{
|
||||
_places[i] = temp;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
T temp2 = _places[i];
|
||||
_places[i] = temp;
|
||||
temp = temp2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return Insert(airFighter, 0);
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление объекта в набор на конкретную позицию
|
||||
@ -89,6 +67,10 @@ namespace AirFighter
|
||||
/// <returns></returns>
|
||||
public int Insert(T airFighter, int position)
|
||||
{
|
||||
if(airFighter == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (_places[position] == null)
|
||||
{
|
||||
_places[position] = airFighter;
|
||||
@ -97,19 +79,19 @@ namespace AirFighter
|
||||
{
|
||||
if(CheckNullPosition(position + 1))
|
||||
{
|
||||
T temp = airFighter;
|
||||
T tempMain = airFighter;
|
||||
for (int i = position; i < _places.Length; i++)
|
||||
{
|
||||
if (_places[i] == null)
|
||||
{
|
||||
_places[i] = temp;
|
||||
_places[i] = tempMain;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
T temp2 = _places[i];
|
||||
_places[i] = temp;
|
||||
temp = temp2;
|
||||
_places[i] = tempMain;
|
||||
tempMain = temp2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user