Доработка

This commit is contained in:
malimova 2023-10-16 11:36:12 +04:00
parent 9cadd9bb31
commit 4bf485c19e
3 changed files with 20 additions and 6 deletions

View File

@ -1,4 +1,6 @@
namespace AirBomber using System.Windows.Forms;
namespace AirBomber
{ {
public partial class FormAirBomber : Form public partial class FormAirBomber : Form
{ {
@ -33,10 +35,19 @@
{ {
Random random = new(); Random random = new();
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)); Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
//TODO выбор основного цвета ColorDialog colorDialog = new ColorDialog();
//TODO выбор основного цвета DONE
if (colorDialog.ShowDialog() == DialogResult.OK)
{
color = colorDialog.Color;
}
Color dopColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)); Color dopColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
//TODO выбор дополнительного цвета //TODO выбор дополнительного цвета DONE
if (colorDialog.ShowDialog() == DialogResult.OK)
{
dopColor = colorDialog.Color;
}
_drawningAirPlane = new DrawningAirBomber(random.Next(100, 300), random.Next(1000, 3000), color, dopColor, _drawningAirPlane = new DrawningAirBomber(random.Next(100, 300), random.Next(1000, 3000), color, dopColor,
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), pictureBoxAirBomber.Width, pictureBoxAirBomber.Height); Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), pictureBoxAirBomber.Width, pictureBoxAirBomber.Height);

View File

@ -52,7 +52,9 @@ namespace AirBomber
public static int operator +(PlanesGenericCollection<T, U> collect, T? obj) public static int operator +(PlanesGenericCollection<T, U> collect, T? obj)
{ {
if (obj == null) if (obj == null)
{
return -1; return -1;
}
return collect?._collection.Insert(obj) ?? -1; return collect?._collection.Insert(obj) ?? -1;
} }
@ -62,14 +64,15 @@ namespace AirBomber
/// <param name="collect"></param> /// <param name="collect"></param>
/// <param name="pos"></param> /// <param name="pos"></param>
/// <returns></returns> /// <returns></returns>
public static T? operator -(PlanesGenericCollection<T, U> collect, int pos) public static bool operator -(PlanesGenericCollection<T, U> collect, int pos)
{ {
T? obj = collect._collection.Get(pos); T? obj = collect._collection.Get(pos);
if (obj != null) if (obj != null)
{ {
collect._collection.Remove(pos); collect._collection.Remove(pos);
return true;
} }
return obj; return false;
} }
/// <summary> /// <summary>
/// Получение объекта IMoveableObject /// Получение объекта IMoveableObject

View File

@ -88,7 +88,7 @@ namespace AirBomber
{ {
return false; return false;
} }
_places[position - 1] = null; _places[position] = null;
return true; return true;
} }
/// <summary> /// <summary>