diff --git a/AirBomber/AirBomber/FormAirBomber.cs b/AirBomber/AirBomber/FormAirBomber.cs index a50d1cf..fa19f00 100644 --- a/AirBomber/AirBomber/FormAirBomber.cs +++ b/AirBomber/AirBomber/FormAirBomber.cs @@ -1,4 +1,6 @@ -namespace AirBomber +using System.Windows.Forms; + +namespace AirBomber { public partial class FormAirBomber : Form { @@ -33,10 +35,19 @@ { Random random = new(); 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)); - //TODO выбор дополнительного цвета + //TODO выбор дополнительного цвета DONE + if (colorDialog.ShowDialog() == DialogResult.OK) + { + dopColor = colorDialog.Color; + } _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); diff --git a/AirBomber/AirBomber/PlanesGenericCollection.cs b/AirBomber/AirBomber/PlanesGenericCollection.cs index 8958b73..5381999 100644 --- a/AirBomber/AirBomber/PlanesGenericCollection.cs +++ b/AirBomber/AirBomber/PlanesGenericCollection.cs @@ -52,7 +52,9 @@ namespace AirBomber public static int operator +(PlanesGenericCollection collect, T? obj) { if (obj == null) + { return -1; + } return collect?._collection.Insert(obj) ?? -1; } @@ -62,14 +64,15 @@ namespace AirBomber /// /// /// - public static T? operator -(PlanesGenericCollection collect, int pos) + public static bool operator -(PlanesGenericCollection collect, int pos) { T? obj = collect._collection.Get(pos); if (obj != null) { collect._collection.Remove(pos); + return true; } - return obj; + return false; } /// /// Получение объекта IMoveableObject diff --git a/AirBomber/AirBomber/SetGeneric.cs b/AirBomber/AirBomber/SetGeneric.cs index 6732b9d..b1b0f54 100644 --- a/AirBomber/AirBomber/SetGeneric.cs +++ b/AirBomber/AirBomber/SetGeneric.cs @@ -88,7 +88,7 @@ namespace AirBomber { return false; } - _places[position - 1] = null; + _places[position] = null; return true; } ///