diff --git a/AircraftCarrier/AircraftCarrier/AircraftsGenericCollection.cs b/AircraftCarrier/AircraftCarrier/AircraftsGenericCollection.cs index d4976a9..5c73147 100644 --- a/AircraftCarrier/AircraftCarrier/AircraftsGenericCollection.cs +++ b/AircraftCarrier/AircraftCarrier/AircraftsGenericCollection.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using AircraftCarrier.DrawningObjects; using AircraftCarrier.MovementStrategy; using static System.Windows.Forms.VisualStyles.VisualStyleElement; - namespace AircraftCarrier.Generics { internal class AircraftsGenericCollection @@ -18,9 +17,9 @@ namespace AircraftCarrier.Generics /// Высота окна прорисовки private readonly int _pictureHeight; /// Размер занимаемого объектом места (ширина) - private readonly int _placeSizeWidth = 210; + private readonly int _placeSizeWidth = 170; /// Размер занимаемого объектом места (высота) - private readonly int _placeSizeHeight = 90; + private readonly int _placeSizeHeight = 50; /// Набор объектов private readonly SetGeneric _collection; /// Конструктор @@ -33,7 +32,7 @@ namespace AircraftCarrier.Generics _collection = new SetGeneric(width * height); } /// Перегрузка оператора сложения - public static int operator + (AircraftsGenericCollection collect, T? + public static int operator +(AircraftsGenericCollection collect, T? obj) { if (obj == null) @@ -43,7 +42,7 @@ namespace AircraftCarrier.Generics return collect._collection.Insert(obj); } /// Перегрузка оператора вычитания - public static bool operator - (AircraftsGenericCollection collect, int pos) + public static bool operator -(AircraftsGenericCollection collect, int pos) { T? obj = collect._collection.Get(pos); if (obj != null) @@ -94,7 +93,7 @@ namespace AircraftCarrier.Generics if (aircraft != null) { - aircraft.SetPosition(i % inRow * _placeSizeWidth+3, (_collection.Count / inRow - 1 - i / inRow) * _placeSizeHeight+20); + aircraft.SetPosition(i % inRow * _placeSizeWidth+3, (_collection.Count / inRow - 1 - i / inRow) * _placeSizeHeight + 5); aircraft.DrawTransport(g); } } diff --git a/AircraftCarrier/AircraftCarrier/DrawningAircraft.cs b/AircraftCarrier/AircraftCarrier/DrawningAircraft.cs index f13d823..4e9190b 100644 --- a/AircraftCarrier/AircraftCarrier/DrawningAircraft.cs +++ b/AircraftCarrier/AircraftCarrier/DrawningAircraft.cs @@ -5,7 +5,6 @@ using System.Text; using System.Threading.Tasks; using AircraftCarrier.Entities; using AircraftCarrier.MovementStrategy; - namespace AircraftCarrier.DrawningObjects { /// Класс, отвечающий за прорисовку и перемещение объекта-сущности @@ -29,11 +28,7 @@ namespace AircraftCarrier.DrawningObjects public int GetWidth => _AircraftWidth; /// Высота объекта public int GetHeight => _AircraftHeight; - /// Проверка, что объект может переместится по указанному направлению - /// Направление - /// true - можно переместится по указанному направлению public IMoveableObject GetMoveableObject => new DrawningObjectAircraft(this); - public bool CanMove(Direction direction) { if (EntityAircraft == null) @@ -54,7 +49,6 @@ namespace AircraftCarrier.DrawningObjects }; } /// Изменение направления перемещения - /// Направление public void MoveTransport(Direction direction) { if (!CanMove(direction) || EntityAircraft == null) @@ -82,11 +76,6 @@ namespace AircraftCarrier.DrawningObjects } } /// Конструктор - /// Скорость - /// Вес - /// Основной цвет - /// Ширина картинки - /// Высота картинки public DrawningAircraft(int speed, double weight, Color bodyColor, int width, int height) { @@ -99,13 +88,6 @@ namespace AircraftCarrier.DrawningObjects EntityAircraft = new EntityAircraft(speed, weight, bodyColor); } /// Конструктор - /// Скорость - /// Вес - /// Основной цвет - /// Ширина картинки - /// Высота картинки - /// Ширина прорисовки автомобиля - /// Высота прорисовки автомобиля protected DrawningAircraft(int speed, double weight, Color bodyColor,int width, int height, int AircraftWidth, int AircraftHeight) { diff --git a/AircraftCarrier/AircraftCarrier/FormAircraftCarrier.cs b/AircraftCarrier/AircraftCarrier/FormAircraftCarrier.cs index 62492b7..0d6d11e 100644 --- a/AircraftCarrier/AircraftCarrier/FormAircraftCarrier.cs +++ b/AircraftCarrier/AircraftCarrier/FormAircraftCarrier.cs @@ -1,7 +1,6 @@ using AircraftCarrier.DrawningObjects; using AircraftCarrier.MovementStrategy; using System; - namespace AircraftCarrier { public partial class FormAircraftCarrier : Form @@ -126,7 +125,6 @@ namespace AircraftCarrier comboBoxStrategy.Enabled = true; _abstractStrategy = null; } - } private void buttonSelectAircraft_Click(object sender, EventArgs e) { diff --git a/AircraftCarrier/AircraftCarrier/FormAircraftCollection.cs b/AircraftCarrier/AircraftCarrier/FormAircraftCollection.cs index 63f30fd..1f3e5a4 100644 --- a/AircraftCarrier/AircraftCarrier/FormAircraftCollection.cs +++ b/AircraftCarrier/AircraftCarrier/FormAircraftCollection.cs @@ -20,7 +20,6 @@ namespace AircraftCarrier InitializeComponent(); _Aircrafts = new AircraftsGenericCollection(PictureBoxCollection.Width, PictureBoxCollection.Height); } - private void ButtonAddAircraft_Click(object sender, EventArgs e) { FormAircraftCarrier form = new(); @@ -38,7 +37,6 @@ namespace AircraftCarrier } } - private void ButtonRemoveAircraft_Click(object sender, EventArgs e) { if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) @@ -56,7 +54,6 @@ namespace AircraftCarrier MessageBox.Show("Не удалось удалить объект"); } } - private void ButtonRefreshCollection_Click(object sender, EventArgs e) { PictureBoxCollection.Image = _Aircrafts.ShowAircraft();