Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 301bc52fb3 | |||
| aae359ed8b | |||
| fb0a1ac0fd | |||
| ab47d675ec | |||
| 1f06635803 |
@@ -30,7 +30,7 @@ public abstract class AbstractCompany
|
||||
/// <summary>
|
||||
/// Коллекция автомобилей
|
||||
/// </summary>
|
||||
protected ICollectionGenericObjects<DrawningPlane>? _collection = null;
|
||||
protected ICollectionGenericObjects<DrawningMilitaryAircraft>? _collection = null;
|
||||
|
||||
/// <summary>
|
||||
/// Вычисление максимального количества элементов, который можно разместить в окне
|
||||
@@ -43,7 +43,7 @@ public abstract class AbstractCompany
|
||||
/// <param name="picWidth">Ширина окна</param>
|
||||
/// <param name="picHeight">Высота окна</param>
|
||||
/// <param name="collection">Коллекция автомобилей</param>
|
||||
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningPlane> collection)
|
||||
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningMilitaryAircraft> collection)
|
||||
{
|
||||
_pictureWidth = picWidth;
|
||||
_pictureHeight = picHeight;
|
||||
@@ -55,11 +55,11 @@ public abstract class AbstractCompany
|
||||
/// Перегрузка оператора сложения для класса
|
||||
/// </summary>
|
||||
/// <param name="company">Компания</param>
|
||||
/// <param name="plane">Добавляемый объект</param>
|
||||
/// <param name="militaryAircraft">Добавляемый объект</param>
|
||||
/// <returns></returns>
|
||||
public static int operator +(AbstractCompany company, DrawningPlane plane)
|
||||
public static int operator +(AbstractCompany company, DrawningMilitaryAircraft militaryAircraft)
|
||||
{
|
||||
return company._collection.Insert(plane);
|
||||
return company._collection.Insert(militaryAircraft);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -68,7 +68,7 @@ public abstract class AbstractCompany
|
||||
/// <param name="company">Компания</param>
|
||||
/// <param name="position">Номер удаляемого объекта</param>
|
||||
/// <returns></returns>
|
||||
public static DrawningPlane operator -(AbstractCompany company, int position)
|
||||
public static DrawningMilitaryAircraft operator -(AbstractCompany company, int position)
|
||||
{
|
||||
return company._collection.Remove(position);
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public abstract class AbstractCompany
|
||||
/// Получение случайного объекта из коллекции
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DrawningPlane? GetRandomObject()
|
||||
public DrawningMilitaryAircraft? GetRandomObject()
|
||||
{
|
||||
Random rnd = new();
|
||||
return _collection?.Get(rnd.Next(GetMaxCount));
|
||||
@@ -96,7 +96,7 @@ public abstract class AbstractCompany
|
||||
SetObjectsPosition();
|
||||
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
|
||||
{
|
||||
DrawningPlane? obj = _collection?.Get(i);
|
||||
DrawningMilitaryAircraft? obj = _collection?.Get(i);
|
||||
obj?.DrawTransport(graphics);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class Angar : AbstractCompany
|
||||
/// <param name="picWidth"></param>
|
||||
/// <param name="picHeight"></param>
|
||||
/// <param name="collection"></param>
|
||||
public Angar(int picWidth, int picHeight, ICollectionGenericObjects<DrawningPlane> collection) : base(picWidth, picHeight, collection)
|
||||
public Angar(int picWidth, int picHeight, ICollectionGenericObjects<DrawningMilitaryAircraft> collection) : base(picWidth, picHeight, collection)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace ProjectAirFighter.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Тип коллекции
|
||||
/// </summary>
|
||||
public enum CollectionType
|
||||
{
|
||||
/// <summary>
|
||||
/// Неопределено
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Массив
|
||||
/// </summary>
|
||||
Massive = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Список
|
||||
/// </summary>
|
||||
List = 2
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
namespace ProjectAirFighter.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Параметризованный набор объектов
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Параметр: ограничение - ссылочный тип</typeparam>
|
||||
public class ListGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
where T : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Список объектов, которые храним
|
||||
/// </summary>
|
||||
private readonly List<T?> _collection;
|
||||
|
||||
/// <summary>
|
||||
/// Максимально допустимое число объектов в списке
|
||||
/// </summary>
|
||||
private int _maxCount;
|
||||
|
||||
public int Count => _collection.Count;
|
||||
|
||||
public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } }
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public ListGenericObjects()
|
||||
{
|
||||
_collection = new();
|
||||
}
|
||||
|
||||
public T? Get(int position)
|
||||
{
|
||||
if (position >= Count || position < 0) return null;
|
||||
return _collection[position];
|
||||
}
|
||||
|
||||
public int Insert(T obj)
|
||||
{
|
||||
if (Count + 1 > _maxCount) return -1;
|
||||
_collection.Add(obj);
|
||||
return Count;
|
||||
}
|
||||
|
||||
public int Insert(T obj, int position)
|
||||
{
|
||||
if (Count + 1 > _maxCount) return -1;
|
||||
if (position < 0 || position > Count) return -1;
|
||||
_collection.Insert(position, obj);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public T? Remove(int position)
|
||||
{
|
||||
if (position < 0 || position > Count) return null;
|
||||
T? pos = _collection[position];
|
||||
_collection.RemoveAt(position);
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,6 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
|
||||
public T? Get(int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
if (position >= _collection.Length || position < 0)
|
||||
{ return null; }
|
||||
return _collection[position];
|
||||
@@ -50,7 +49,6 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
|
||||
public int Insert(T obj)
|
||||
{
|
||||
// TODO вставка в свободное место набора
|
||||
int index = 0;
|
||||
while (index < _collection.Length)
|
||||
{
|
||||
@@ -67,11 +65,6 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
|
||||
public int Insert(T obj, int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
// TODO проверка, что элемент массива по этой позиции пустой, если нет, то
|
||||
// ищется свободное место после этой позиции и идет вставка туда
|
||||
// если нет после, ищем до
|
||||
// TODO вставка
|
||||
if (position >= _collection.Length || position < 0)
|
||||
{ return -1; }
|
||||
|
||||
@@ -104,8 +97,6 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
|
||||
public T? Remove(int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
// TODO удаление объекта из массива, присвоив элементу массива значение null
|
||||
if (position >= _collection.Length || position < 0)
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
namespace ProjectAirFighter.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-хранилище коллекций
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class StorageCollection<T>
|
||||
where T : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Словарь (хранилище) с коллекциями
|
||||
/// </summary>
|
||||
readonly Dictionary<string, ICollectionGenericObjects<T>> _storages;
|
||||
|
||||
/// <summary>
|
||||
/// Возвращение списка названий коллекций
|
||||
/// </summary>
|
||||
public List<string> Keys => _storages.Keys.ToList();
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public StorageCollection()
|
||||
{
|
||||
_storages = new Dictionary<string, ICollectionGenericObjects<T>>(); //вот тут какое-то свойство
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавление коллекции в хранилище
|
||||
/// </summary>
|
||||
/// <param name="name">Название коллекции</param>
|
||||
/// <param name="collectionType">тип коллекции</param>
|
||||
public void AddCollection(string name, CollectionType collectionType)
|
||||
{
|
||||
if (name == null || _storages.ContainsKey(name)) { return; }
|
||||
switch (collectionType)
|
||||
|
||||
{
|
||||
case CollectionType.None:
|
||||
return;
|
||||
case CollectionType.Massive:
|
||||
_storages[name] = new MassiveGenericObjects<T>();
|
||||
return;
|
||||
case CollectionType.List:
|
||||
_storages[name] = new ListGenericObjects<T>();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаление коллекции
|
||||
/// </summary>
|
||||
/// <param name="name">Название коллекции</param>
|
||||
public void DelCollection(string name)
|
||||
{
|
||||
if (_storages.ContainsKey(name))
|
||||
_storages.Remove(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Доступ к коллекции
|
||||
/// </summary>
|
||||
/// <param name="name">Название коллекции</param>
|
||||
/// <returns></returns>
|
||||
public ICollectionGenericObjects<T>? this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (name == null || !_storages.ContainsKey(name)) { return null; }
|
||||
return _storages[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace ProjectAirFighter.Drawnings;
|
||||
/// <summary>
|
||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||
/// </summary>
|
||||
public class DrawningAirFighter : DrawningPlane
|
||||
public class DrawningAirFighter : DrawningMilitaryAircraft
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
@@ -19,22 +19,22 @@ public class DrawningAirFighter : DrawningPlane
|
||||
/// <param name="rockets">Признак наличия ракет</param>
|
||||
public DrawningAirFighter (int speed, double weight, Color bodyColor, Color additionalColor, bool wings, bool rockets) : base (70, 70)
|
||||
{
|
||||
EntityPlane = new EntityAirFighter(speed, weight, bodyColor, additionalColor, wings, rockets);
|
||||
EntityMilitaryAircraft = new EntityAirFighter(speed, weight, bodyColor, additionalColor, wings, rockets);
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityPlane == null || EntityPlane is not EntityAirFighter planeFighter || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
if (EntityMilitaryAircraft == null || EntityMilitaryAircraft is not EntityAirFighter militaryAircraftFighter || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Pen pen = new(Color.Black);
|
||||
Brush additionalBrush = new SolidBrush(planeFighter.AdditionalColor);
|
||||
Brush additionalBrush = new SolidBrush(militaryAircraftFighter.AdditionalColor);
|
||||
|
||||
base.DrawTransport(g);
|
||||
|
||||
if (planeFighter.Wings)
|
||||
if (militaryAircraftFighter.Wings)
|
||||
{
|
||||
Point wings1 = new Point(_startPosX.Value + 45, _startPosY.Value + 30);
|
||||
Point wings2 = new Point(_startPosX.Value + 45, _startPosY.Value + 15);
|
||||
@@ -53,7 +53,7 @@ public class DrawningAirFighter : DrawningPlane
|
||||
g.DrawPolygon(pen, DownWing);
|
||||
}
|
||||
|
||||
if (planeFighter.Rockets)
|
||||
if (militaryAircraftFighter.Rockets)
|
||||
{
|
||||
Point rocket1 = new Point(_startPosX.Value + 40, _startPosY.Value + 5);
|
||||
Point rocket2 = new Point(_startPosX.Value + 15, _startPosY.Value + 5);
|
||||
|
||||
@@ -5,12 +5,12 @@ namespace ProjectAirFighter.Drawnings;
|
||||
/// <summary>
|
||||
/// Класс, отвечающий за прорисовку и перемещение базового объекта-сущности
|
||||
/// </summary>
|
||||
public class DrawningPlane
|
||||
public class DrawningMilitaryAircraft
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-сущность
|
||||
/// </summary>
|
||||
public EntityPlane? EntityPlane { get; protected set; }
|
||||
public EntityMilitaryAircraft? EntityMilitaryAircraft { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ширина окна
|
||||
@@ -35,12 +35,12 @@ public class DrawningPlane
|
||||
/// <summary>
|
||||
/// Ширина прорисовки самолёта
|
||||
/// </summary>
|
||||
private readonly int _drawningFighterWidth = 70;
|
||||
private readonly int _drawningMilitaryAircraftWidth = 70;
|
||||
|
||||
/// <summary>
|
||||
/// Высота прорисовки самолёта
|
||||
/// </summary>
|
||||
private readonly int _drawningFighterHeight = 70;
|
||||
private readonly int _drawningMilitaryAircraftHeight = 70;
|
||||
|
||||
/// <summary>
|
||||
/// Координата X объекта
|
||||
@@ -55,17 +55,17 @@ public class DrawningPlane
|
||||
/// <summary>
|
||||
/// Ширина объекта
|
||||
/// </summary>
|
||||
public int GetWidth => _drawningFighterWidth;
|
||||
public int GetWidth => _drawningMilitaryAircraftWidth;
|
||||
|
||||
/// <summary>
|
||||
/// Высота объекта
|
||||
/// </summary>
|
||||
public int GetHeight => _drawningFighterHeight;
|
||||
public int GetHeight => _drawningMilitaryAircraftHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Пустой конструктор
|
||||
/// </summary>
|
||||
private DrawningPlane()
|
||||
private DrawningMilitaryAircraft()
|
||||
{
|
||||
_pictureWidth = null;
|
||||
_pictureHeight = null;
|
||||
@@ -79,9 +79,9 @@ public class DrawningPlane
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
public DrawningPlane (int speed, double weight, Color bodyColor) : this()
|
||||
public DrawningMilitaryAircraft (int speed, double weight, Color bodyColor) : this()
|
||||
{
|
||||
EntityPlane = new EntityPlane(speed, weight, bodyColor);
|
||||
EntityMilitaryAircraft = new EntityMilitaryAircraft(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -89,15 +89,15 @@ public class DrawningPlane
|
||||
/// </summary>
|
||||
/// <param name="drawningCarWidth">Ширина прорисовки самолёта</param>
|
||||
/// <param name="drawningCarHeight">Высота прорисовки самолёта</param>
|
||||
protected DrawningPlane(int drawningFighterWidth, int drawningFighterHeight) : this()
|
||||
protected DrawningMilitaryAircraft(int drawningMilitaryAircraftWidth, int drawningMilitaryAircraftHeight) : this()
|
||||
{
|
||||
_drawningFighterWidth = drawningFighterWidth;
|
||||
_drawningFighterHeight = drawningFighterHeight;
|
||||
_drawningMilitaryAircraftWidth = drawningMilitaryAircraftWidth;
|
||||
_drawningMilitaryAircraftHeight = drawningMilitaryAircraftHeight;
|
||||
}
|
||||
|
||||
public bool SetPictureSize(int width, int height)
|
||||
{
|
||||
if (_drawningFighterWidth < width && _drawningFighterHeight < height)
|
||||
if (_drawningMilitaryAircraftWidth < width && _drawningMilitaryAircraftHeight < height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
@@ -118,9 +118,9 @@ public class DrawningPlane
|
||||
return;
|
||||
}
|
||||
|
||||
if (x + _drawningFighterWidth > _pictureWidth)
|
||||
if (x + _drawningMilitaryAircraftWidth > _pictureWidth)
|
||||
{
|
||||
_startPosX = _pictureWidth - _drawningFighterWidth;
|
||||
_startPosX = _pictureWidth - _drawningMilitaryAircraftWidth;
|
||||
}
|
||||
else if (x < 0)
|
||||
{
|
||||
@@ -130,9 +130,9 @@ public class DrawningPlane
|
||||
{
|
||||
_startPosX = x;
|
||||
}
|
||||
if (y + _drawningFighterHeight > _pictureHeight)
|
||||
if (y + _drawningMilitaryAircraftHeight > _pictureHeight)
|
||||
{
|
||||
_startPosY = _pictureHeight - _drawningFighterHeight;
|
||||
_startPosY = _pictureHeight - _drawningMilitaryAircraftHeight;
|
||||
}
|
||||
else if (y < 0)
|
||||
{
|
||||
@@ -146,7 +146,7 @@ public class DrawningPlane
|
||||
|
||||
public bool MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (EntityPlane == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
if (EntityMilitaryAircraft == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -154,27 +154,27 @@ public class DrawningPlane
|
||||
switch (direction)
|
||||
{
|
||||
case DirectionType.Left:
|
||||
if (_startPosX.Value - EntityPlane.Step > 0)
|
||||
if (_startPosX.Value - EntityMilitaryAircraft.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)EntityPlane.Step;
|
||||
_startPosX -= (int)EntityMilitaryAircraft.Step;
|
||||
}
|
||||
return true;
|
||||
case DirectionType.Up:
|
||||
if (_startPosY.Value - EntityPlane.Step > 0)
|
||||
if (_startPosY.Value - EntityMilitaryAircraft.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)EntityPlane.Step;
|
||||
_startPosY -= (int)EntityMilitaryAircraft.Step;
|
||||
}
|
||||
return true;
|
||||
case DirectionType.Right:
|
||||
if (_startPosX.Value + _drawningFighterWidth + EntityPlane.Step < _pictureWidth)
|
||||
if (_startPosX.Value + _drawningMilitaryAircraftWidth + EntityMilitaryAircraft.Step < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)EntityPlane.Step;
|
||||
_startPosX += (int)EntityMilitaryAircraft.Step;
|
||||
}
|
||||
return true;
|
||||
case DirectionType.Down:
|
||||
if (_startPosY.Value + _drawningFighterHeight + EntityPlane.Step < _pictureHeight)
|
||||
if (_startPosY.Value + _drawningMilitaryAircraftHeight + EntityMilitaryAircraft.Step < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)EntityPlane.Step;
|
||||
_startPosY += (int)EntityMilitaryAircraft.Step;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
@@ -184,13 +184,13 @@ public class DrawningPlane
|
||||
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityPlane == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
if (EntityMilitaryAircraft == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Pen pen = new(Color.Black);
|
||||
Brush br = new SolidBrush(EntityPlane.BodyColor);
|
||||
Brush br = new SolidBrush(EntityMilitaryAircraft.BodyColor);
|
||||
|
||||
g.FillRectangle(br, _startPosX.Value + 10, _startPosY.Value + 30, 60, 10);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 30, 60, 10);
|
||||
@@ -3,7 +3,7 @@
|
||||
/// <summary>
|
||||
/// Класс-сущность "Истребитель"
|
||||
/// </summary>
|
||||
public class EntityAirFighter : EntityPlane
|
||||
public class EntityAirFighter : EntityMilitaryAircraft
|
||||
{
|
||||
public Color AdditionalColor { get; private set; }
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
namespace ProjectAirFighter.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-сущность "Истребитель"
|
||||
/// Класс-сущность "Военный самолёт"
|
||||
/// </summary>
|
||||
public class EntityPlane
|
||||
public class EntityMilitaryAircraft
|
||||
{
|
||||
public int Speed { get; private set; }
|
||||
|
||||
@@ -20,7 +20,7 @@ public class EntityPlane
|
||||
/// <param name="weight">Вес автомобиля</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
|
||||
public EntityPlane (int speed, double weight, Color bodyColor)
|
||||
public EntityMilitaryAircraft (int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
173
AirFighter/AirFighter/FormAirCollection.Designer.cs
generated
173
AirFighter/AirFighter/FormAirCollection.Designer.cs
generated
@@ -1,173 +0,0 @@
|
||||
namespace ProjectAirFighter
|
||||
{
|
||||
partial class FormAirCollection
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
groupBoxTools = new GroupBox();
|
||||
buttonRefresh = new Button();
|
||||
buttonGoToCheck = new Button();
|
||||
buttonRemoveAir = new Button();
|
||||
maskedTextBoxPosition = new MaskedTextBox();
|
||||
buttonAddAirFighter = new Button();
|
||||
buttonAddAir = new Button();
|
||||
comboBoxSelectorCompany = new ComboBox();
|
||||
pictureBox = new PictureBox();
|
||||
groupBoxTools.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxTools
|
||||
//
|
||||
groupBoxTools.Controls.Add(buttonRefresh);
|
||||
groupBoxTools.Controls.Add(buttonGoToCheck);
|
||||
groupBoxTools.Controls.Add(buttonRemoveAir);
|
||||
groupBoxTools.Controls.Add(maskedTextBoxPosition);
|
||||
groupBoxTools.Controls.Add(buttonAddAirFighter);
|
||||
groupBoxTools.Controls.Add(buttonAddAir);
|
||||
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
||||
groupBoxTools.Dock = DockStyle.Right;
|
||||
groupBoxTools.Location = new Point(594, 0);
|
||||
groupBoxTools.Name = "groupBoxTools";
|
||||
groupBoxTools.Size = new Size(206, 450);
|
||||
groupBoxTools.TabIndex = 0;
|
||||
groupBoxTools.TabStop = false;
|
||||
groupBoxTools.Text = "Инструменты";
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonRefresh.Location = new Point(6, 395);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(197, 29);
|
||||
buttonRefresh.TabIndex = 7;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += buttonRefresh_Click;
|
||||
//
|
||||
// buttonGoToCheck
|
||||
//
|
||||
buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonGoToCheck.Location = new Point(6, 328);
|
||||
buttonGoToCheck.Name = "buttonGoToCheck";
|
||||
buttonGoToCheck.Size = new Size(197, 29);
|
||||
buttonGoToCheck.TabIndex = 6;
|
||||
buttonGoToCheck.Text = "Передать на тесты";
|
||||
buttonGoToCheck.UseVisualStyleBackColor = true;
|
||||
buttonGoToCheck.Click += buttonGoToCheck_Click;
|
||||
//
|
||||
// buttonRemoveAir
|
||||
//
|
||||
buttonRemoveAir.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonRemoveAir.Location = new Point(5, 211);
|
||||
buttonRemoveAir.Name = "buttonRemoveAir";
|
||||
buttonRemoveAir.Size = new Size(197, 29);
|
||||
buttonRemoveAir.TabIndex = 5;
|
||||
buttonRemoveAir.Text = "Удаление самолёта";
|
||||
buttonRemoveAir.UseVisualStyleBackColor = true;
|
||||
buttonRemoveAir.Click += buttonRemoveAir_Click;
|
||||
//
|
||||
// maskedTextBoxPosition
|
||||
//
|
||||
maskedTextBoxPosition.Location = new Point(6, 161);
|
||||
maskedTextBoxPosition.Mask = "00";
|
||||
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||
maskedTextBoxPosition.Size = new Size(194, 27);
|
||||
maskedTextBoxPosition.TabIndex = 4;
|
||||
maskedTextBoxPosition.ValidatingType = typeof(int);
|
||||
//
|
||||
// buttonAddAirFighter
|
||||
//
|
||||
buttonAddAirFighter.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonAddAirFighter.Location = new Point(6, 103);
|
||||
buttonAddAirFighter.Name = "buttonAddAirFighter";
|
||||
buttonAddAirFighter.Size = new Size(197, 31);
|
||||
buttonAddAirFighter.TabIndex = 2;
|
||||
buttonAddAirFighter.Text = "Добавление истребителя";
|
||||
buttonAddAirFighter.UseVisualStyleBackColor = true;
|
||||
buttonAddAirFighter.Click += buttonAddAirFighter_Click;
|
||||
//
|
||||
// buttonAddAir
|
||||
//
|
||||
buttonAddAir.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonAddAir.Location = new Point(6, 68);
|
||||
buttonAddAir.Name = "buttonAddAir";
|
||||
buttonAddAir.Size = new Size(197, 29);
|
||||
buttonAddAir.TabIndex = 1;
|
||||
buttonAddAir.Text = "Добавление самолёта";
|
||||
buttonAddAir.UseVisualStyleBackColor = true;
|
||||
buttonAddAir.Click += buttonAddAir_Click;
|
||||
//
|
||||
// comboBoxSelectorCompany
|
||||
//
|
||||
comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxSelectorCompany.FormattingEnabled = true;
|
||||
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
||||
comboBoxSelectorCompany.Location = new Point(6, 26);
|
||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||
comboBoxSelectorCompany.Size = new Size(194, 28);
|
||||
comboBoxSelectorCompany.TabIndex = 0;
|
||||
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged;
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
pictureBox.Dock = DockStyle.Fill;
|
||||
pictureBox.Location = new Point(0, 0);
|
||||
pictureBox.Name = "pictureBox";
|
||||
pictureBox.Size = new Size(594, 450);
|
||||
pictureBox.TabIndex = 3;
|
||||
pictureBox.TabStop = false;
|
||||
//
|
||||
// FormAirCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(pictureBox);
|
||||
Controls.Add(groupBoxTools);
|
||||
Name = "FormAirCollection";
|
||||
Text = "Коллекция самолётов";
|
||||
groupBoxTools.ResumeLayout(false);
|
||||
groupBoxTools.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxTools;
|
||||
private ComboBox comboBoxSelectorCompany;
|
||||
private Button buttonAddAir;
|
||||
private Button buttonAddAirFighter;
|
||||
private PictureBox pictureBox;
|
||||
private MaskedTextBox maskedTextBoxPosition;
|
||||
private Button buttonRemoveAir;
|
||||
private Button buttonRefresh;
|
||||
private Button buttonGoToCheck;
|
||||
}
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
using ProjectAirFighter.CollectionGenericObjects;
|
||||
using ProjectAirFighter.Drawnings;
|
||||
|
||||
namespace ProjectAirFighter;
|
||||
|
||||
public partial class FormAirCollection : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Компания
|
||||
/// </summary>
|
||||
private AbstractCompany? _company = null;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public FormAirCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Выбор компании
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void comboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
switch (comboBoxSelectorCompany.Text)
|
||||
{
|
||||
case "Хранилище":
|
||||
_company = new Angar(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningPlane>());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавление самолёта
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonAddAir_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningPlane));
|
||||
|
||||
/// <summary>
|
||||
/// Добавление истребителя
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonAddAirFighter_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirFighter));
|
||||
|
||||
private void CreateObject(string type)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Random random = new();
|
||||
DrawningPlane drawningFighter;
|
||||
switch (type)
|
||||
{
|
||||
case nameof(DrawningPlane):
|
||||
drawningFighter = new DrawningPlane(random.Next(100, 300), random.Next(1000, 3000), GetColor(random));
|
||||
break;
|
||||
case nameof(DrawningAirFighter):
|
||||
drawningFighter = new DrawningAirFighter(random.Next(100, 300), random.Next(1000, 3000),
|
||||
GetColor(random), GetColor(random),
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (_company + drawningFighter != -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение цвета
|
||||
/// </summary>
|
||||
/// <param name="random">Генератор случайных чисел</param>
|
||||
/// <returns></returns>
|
||||
private static Color GetColor(Random random)
|
||||
{
|
||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Удаление объекта
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonRemoveAir_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||
if (_company - pos != null)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Передача объекта в другую форму
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonGoToCheck_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DrawningPlane? plane = null;
|
||||
int counter = 100;
|
||||
while (plane == null)
|
||||
{
|
||||
plane = _company.GetRandomObject();
|
||||
counter--;
|
||||
if (counter <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (plane == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FormAirFighter form = new()
|
||||
{
|
||||
SetAir = plane
|
||||
};
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перерисовка коллекции
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace ProjectAirFighter;
|
||||
|
||||
public partial class FormAirFighter : Form
|
||||
{
|
||||
private DrawningPlane? _drawningFighter;
|
||||
private DrawningMilitaryAircraft? _drawningMilitaryAircraft;
|
||||
|
||||
private AbstractStrategy? _strategy;
|
||||
|
||||
@@ -15,12 +15,12 @@ public partial class FormAirFighter : Form
|
||||
_strategy = null;
|
||||
}
|
||||
|
||||
public DrawningPlane SetAir
|
||||
public DrawningMilitaryAircraft SetAir
|
||||
{
|
||||
set
|
||||
{
|
||||
_drawningFighter = value;
|
||||
_drawningFighter.SetPictureSize(pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
||||
_drawningMilitaryAircraft = value;
|
||||
_drawningMilitaryAircraft.SetPictureSize(pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_strategy = null;
|
||||
Draw();
|
||||
@@ -29,20 +29,20 @@ public partial class FormAirFighter : Form
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawningFighter == null)
|
||||
if (_drawningMilitaryAircraft == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Bitmap bmp = new(pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningFighter.DrawTransport(gr);
|
||||
_drawningMilitaryAircraft.DrawTransport(gr);
|
||||
pictureBoxAirFighter.Image = bmp;
|
||||
}
|
||||
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningFighter == null)
|
||||
if (_drawningMilitaryAircraft == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -52,16 +52,16 @@ public partial class FormAirFighter : Form
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
result = _drawningFighter.MoveTransport(DirectionType.Up);
|
||||
result = _drawningMilitaryAircraft.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
result = _drawningFighter.MoveTransport(DirectionType.Down);
|
||||
result = _drawningMilitaryAircraft.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
result = _drawningFighter.MoveTransport(DirectionType.Left);
|
||||
result = _drawningMilitaryAircraft.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
result = _drawningFighter.MoveTransport(DirectionType.Right);
|
||||
result = _drawningMilitaryAircraft.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public partial class FormAirFighter : Form
|
||||
|
||||
private void ButtonStrategyStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningFighter == null)
|
||||
if (_drawningMilitaryAircraft == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public partial class FormAirFighter : Form
|
||||
{
|
||||
return;
|
||||
}
|
||||
_strategy.SetData(new MoveableAir(_drawningFighter), pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
||||
_strategy.SetData(new MoveableMilitaryAircraft(_drawningMilitaryAircraft), pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
||||
}
|
||||
|
||||
if (_strategy == null)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pplanes.
|
||||
name/value pmilitaryAircrafts.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
|
||||
299
AirFighter/AirFighter/FormMilitaryAircraftCollection.Designer.cs
generated
Normal file
299
AirFighter/AirFighter/FormMilitaryAircraftCollection.Designer.cs
generated
Normal file
@@ -0,0 +1,299 @@
|
||||
namespace ProjectAirFighter
|
||||
{
|
||||
partial class FormMilitaryAircraftCollection
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
groupBoxTools = new GroupBox();
|
||||
panelCompanyTools = new Panel();
|
||||
buttonCreateCompany = new Button();
|
||||
comboBoxSelectorCompany = new ComboBox();
|
||||
buttonRefresh = new Button();
|
||||
buttonAddMilitaryAircraft = new Button();
|
||||
buttonGoToCheck = new Button();
|
||||
buttonAddAirFighter = new Button();
|
||||
buttonRemoveAir = new Button();
|
||||
maskedTextBoxPosition = new MaskedTextBox();
|
||||
panelStorage = new Panel();
|
||||
buttonCollectionDel = new Button();
|
||||
listBoxCollection = new ListBox();
|
||||
buttonCollectionAdd = new Button();
|
||||
radioButtonList = new RadioButton();
|
||||
radioButtonMassive = new RadioButton();
|
||||
textBoxCollectionName = new TextBox();
|
||||
labelCollectionName = new Label();
|
||||
pictureBox = new PictureBox();
|
||||
groupBoxTools.SuspendLayout();
|
||||
panelCompanyTools.SuspendLayout();
|
||||
panelStorage.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||
//
|
||||
// groupBoxTools
|
||||
//
|
||||
groupBoxTools.Controls.Add(panelCompanyTools);
|
||||
groupBoxTools.Controls.Add(panelStorage);
|
||||
groupBoxTools.Dock = DockStyle.Right;
|
||||
groupBoxTools.Location = new Point(712, 0);
|
||||
groupBoxTools.Name = "groupBoxTools";
|
||||
groupBoxTools.Size = new Size(206, 602);
|
||||
groupBoxTools.TabIndex = 0;
|
||||
groupBoxTools.TabStop = false;
|
||||
groupBoxTools.Text = "Инструменты";
|
||||
//
|
||||
// panelCompanyTools
|
||||
//
|
||||
panelCompanyTools.Controls.Add(buttonCreateCompany);
|
||||
panelCompanyTools.Controls.Add(comboBoxSelectorCompany);
|
||||
panelCompanyTools.Controls.Add(buttonRefresh);
|
||||
panelCompanyTools.Controls.Add(buttonAddMilitaryAircraft);
|
||||
panelCompanyTools.Controls.Add(buttonGoToCheck);
|
||||
panelCompanyTools.Controls.Add(buttonAddAirFighter);
|
||||
panelCompanyTools.Controls.Add(buttonRemoveAir);
|
||||
panelCompanyTools.Controls.Add(maskedTextBoxPosition);
|
||||
panelCompanyTools.Dock = DockStyle.Fill;
|
||||
panelCompanyTools.Location = new Point(3, 293);
|
||||
panelCompanyTools.Name = "panelCompanyTools";
|
||||
panelCompanyTools.Size = new Size(200, 306);
|
||||
panelCompanyTools.TabIndex = 10;
|
||||
//
|
||||
// buttonCreateCompany
|
||||
//
|
||||
buttonCreateCompany.Location = new Point(11, 55);
|
||||
buttonCreateCompany.Name = "buttonCreateCompany";
|
||||
buttonCreateCompany.Size = new Size(182, 27);
|
||||
buttonCreateCompany.TabIndex = 9;
|
||||
buttonCreateCompany.Text = "Создать компанию";
|
||||
buttonCreateCompany.UseVisualStyleBackColor = true;
|
||||
buttonCreateCompany.Click += buttonCreateCompany_Click;
|
||||
//
|
||||
// comboBoxSelectorCompany
|
||||
//
|
||||
comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxSelectorCompany.FormattingEnabled = true;
|
||||
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
||||
comboBoxSelectorCompany.Location = new Point(7, 21);
|
||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||
comboBoxSelectorCompany.Size = new Size(182, 28);
|
||||
comboBoxSelectorCompany.TabIndex = 0;
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonRefresh.Location = new Point(9, 268);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(179, 29);
|
||||
buttonRefresh.TabIndex = 7;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += buttonRefresh_Click;
|
||||
//
|
||||
// buttonAddMilitaryAircraft
|
||||
//
|
||||
buttonAddMilitaryAircraft.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonAddMilitaryAircraft.Location = new Point(4, 99);
|
||||
buttonAddMilitaryAircraft.Name = "buttonAddMilitaryAircraft";
|
||||
buttonAddMilitaryAircraft.Size = new Size(193, 29);
|
||||
buttonAddMilitaryAircraft.TabIndex = 1;
|
||||
buttonAddMilitaryAircraft.Text = "Добавление самолёта";
|
||||
buttonAddMilitaryAircraft.UseVisualStyleBackColor = true;
|
||||
buttonAddMilitaryAircraft.Click += buttonAddAir_Click;
|
||||
//
|
||||
// buttonGoToCheck
|
||||
//
|
||||
buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonGoToCheck.Location = new Point(5, 227);
|
||||
buttonGoToCheck.Name = "buttonGoToCheck";
|
||||
buttonGoToCheck.Size = new Size(194, 29);
|
||||
buttonGoToCheck.TabIndex = 6;
|
||||
buttonGoToCheck.Text = "Передать на тесты";
|
||||
buttonGoToCheck.UseVisualStyleBackColor = true;
|
||||
buttonGoToCheck.Click += buttonGoToCheck_Click;
|
||||
//
|
||||
// buttonAddAirFighter
|
||||
//
|
||||
buttonAddAirFighter.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonAddAirFighter.Location = new Point(3, 122);
|
||||
buttonAddAirFighter.Name = "buttonAddAirFighter";
|
||||
buttonAddAirFighter.Size = new Size(194, 31);
|
||||
buttonAddAirFighter.TabIndex = 2;
|
||||
buttonAddAirFighter.Text = "Добавление истребителя";
|
||||
buttonAddAirFighter.UseVisualStyleBackColor = true;
|
||||
buttonAddAirFighter.Click += buttonAddAirFighter_Click;
|
||||
//
|
||||
// buttonRemoveAir
|
||||
//
|
||||
buttonRemoveAir.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonRemoveAir.Location = new Point(6, 192);
|
||||
buttonRemoveAir.Name = "buttonRemoveAir";
|
||||
buttonRemoveAir.Size = new Size(182, 29);
|
||||
buttonRemoveAir.TabIndex = 5;
|
||||
buttonRemoveAir.Text = "Удаление самолёта";
|
||||
buttonRemoveAir.UseVisualStyleBackColor = true;
|
||||
buttonRemoveAir.Click += buttonRemoveAir_Click;
|
||||
//
|
||||
// maskedTextBoxPosition
|
||||
//
|
||||
maskedTextBoxPosition.Location = new Point(7, 159);
|
||||
maskedTextBoxPosition.Mask = "00";
|
||||
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||
maskedTextBoxPosition.Size = new Size(194, 27);
|
||||
maskedTextBoxPosition.TabIndex = 4;
|
||||
maskedTextBoxPosition.ValidatingType = typeof(int);
|
||||
//
|
||||
// panelStorage
|
||||
//
|
||||
panelStorage.Controls.Add(buttonCollectionDel);
|
||||
panelStorage.Controls.Add(listBoxCollection);
|
||||
panelStorage.Controls.Add(buttonCollectionAdd);
|
||||
panelStorage.Controls.Add(radioButtonList);
|
||||
panelStorage.Controls.Add(radioButtonMassive);
|
||||
panelStorage.Controls.Add(textBoxCollectionName);
|
||||
panelStorage.Controls.Add(labelCollectionName);
|
||||
panelStorage.Dock = DockStyle.Top;
|
||||
panelStorage.Location = new Point(3, 23);
|
||||
panelStorage.Name = "panelStorage";
|
||||
panelStorage.Size = new Size(200, 270);
|
||||
panelStorage.TabIndex = 8;
|
||||
//
|
||||
// buttonCollectionDel
|
||||
//
|
||||
buttonCollectionDel.Location = new Point(7, 239);
|
||||
buttonCollectionDel.Name = "buttonCollectionDel";
|
||||
buttonCollectionDel.Size = new Size(182, 27);
|
||||
buttonCollectionDel.TabIndex = 6;
|
||||
buttonCollectionDel.Text = "Удалить коллекцию";
|
||||
buttonCollectionDel.UseVisualStyleBackColor = true;
|
||||
buttonCollectionDel.Click += buttonCollectionDel_Click;
|
||||
//
|
||||
// listBoxCollection
|
||||
//
|
||||
listBoxCollection.FormattingEnabled = true;
|
||||
listBoxCollection.ItemHeight = 20;
|
||||
listBoxCollection.Location = new Point(11, 129);
|
||||
listBoxCollection.Name = "listBoxCollection";
|
||||
listBoxCollection.Size = new Size(180, 104);
|
||||
listBoxCollection.TabIndex = 5;
|
||||
//
|
||||
// buttonCollectionAdd
|
||||
//
|
||||
buttonCollectionAdd.Location = new Point(9, 96);
|
||||
buttonCollectionAdd.Name = "buttonCollectionAdd";
|
||||
buttonCollectionAdd.Size = new Size(182, 27);
|
||||
buttonCollectionAdd.TabIndex = 4;
|
||||
buttonCollectionAdd.Text = "Добавить коллекцию";
|
||||
buttonCollectionAdd.UseVisualStyleBackColor = true;
|
||||
buttonCollectionAdd.Click += buttonCollectionAdd_Click;
|
||||
//
|
||||
// radioButtonList
|
||||
//
|
||||
radioButtonList.AutoSize = true;
|
||||
radioButtonList.Location = new Point(117, 66);
|
||||
radioButtonList.Name = "radioButtonList";
|
||||
radioButtonList.Size = new Size(80, 24);
|
||||
radioButtonList.TabIndex = 3;
|
||||
radioButtonList.TabStop = true;
|
||||
radioButtonList.Text = "Список";
|
||||
radioButtonList.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// radioButtonMassive
|
||||
//
|
||||
radioButtonMassive.AutoSize = true;
|
||||
radioButtonMassive.Location = new Point(9, 66);
|
||||
radioButtonMassive.Name = "radioButtonMassive";
|
||||
radioButtonMassive.Size = new Size(82, 24);
|
||||
radioButtonMassive.TabIndex = 2;
|
||||
radioButtonMassive.TabStop = true;
|
||||
radioButtonMassive.Text = "Массив";
|
||||
radioButtonMassive.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBoxCollectionName
|
||||
//
|
||||
textBoxCollectionName.Location = new Point(9, 33);
|
||||
textBoxCollectionName.Name = "textBoxCollectionName";
|
||||
textBoxCollectionName.Size = new Size(188, 27);
|
||||
textBoxCollectionName.TabIndex = 1;
|
||||
//
|
||||
// labelCollectionName
|
||||
//
|
||||
labelCollectionName.AutoSize = true;
|
||||
labelCollectionName.Location = new Point(24, 10);
|
||||
labelCollectionName.Name = "labelCollectionName";
|
||||
labelCollectionName.Size = new Size(158, 20);
|
||||
labelCollectionName.TabIndex = 0;
|
||||
labelCollectionName.Text = "Название коллекции:";
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
pictureBox.Dock = DockStyle.Fill;
|
||||
pictureBox.Location = new Point(0, 0);
|
||||
pictureBox.Name = "pictureBox";
|
||||
pictureBox.Size = new Size(712, 602);
|
||||
pictureBox.TabIndex = 3;
|
||||
pictureBox.TabStop = false;
|
||||
//
|
||||
// FormAirCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(918, 602);
|
||||
Controls.Add(pictureBox);
|
||||
Controls.Add(groupBoxTools);
|
||||
Name = "FormAirCollection";
|
||||
Text = "Коллекция самолётов";
|
||||
groupBoxTools.ResumeLayout(false);
|
||||
panelCompanyTools.ResumeLayout(false);
|
||||
panelCompanyTools.PerformLayout();
|
||||
panelStorage.ResumeLayout(false);
|
||||
panelStorage.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxTools;
|
||||
private ComboBox comboBoxSelectorCompany;
|
||||
private Button buttonAddMilitaryAircraft;
|
||||
private Button buttonAddAirFighter;
|
||||
private PictureBox pictureBox;
|
||||
private MaskedTextBox maskedTextBoxPosition;
|
||||
private Button buttonRemoveAir;
|
||||
private Button buttonRefresh;
|
||||
private Button buttonGoToCheck;
|
||||
private Panel panelStorage;
|
||||
private TextBox textBoxCollectionName;
|
||||
private Label labelCollectionName;
|
||||
private RadioButton radioButtonList;
|
||||
private RadioButton radioButtonMassive;
|
||||
private Button buttonCollectionAdd;
|
||||
private Button buttonCollectionDel;
|
||||
private ListBox listBoxCollection;
|
||||
private Button buttonCreateCompany;
|
||||
private Panel panelCompanyTools;
|
||||
}
|
||||
}
|
||||
286
AirFighter/AirFighter/FormMilitaryAircraftCollection.cs
Normal file
286
AirFighter/AirFighter/FormMilitaryAircraftCollection.cs
Normal file
@@ -0,0 +1,286 @@
|
||||
using ProjectAirFighter.CollectionGenericObjects;
|
||||
using ProjectAirFighter.Drawnings;
|
||||
|
||||
namespace ProjectAirFighter;
|
||||
|
||||
public partial class FormMilitaryAircraftCollection : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Хранилише коллекций
|
||||
/// </summary>
|
||||
private readonly StorageCollection<DrawningMilitaryAircraft> _storageCollection;
|
||||
|
||||
/// <summary>
|
||||
/// Компания
|
||||
/// </summary>
|
||||
private AbstractCompany? _company = null;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public FormMilitaryAircraftCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
_storageCollection = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Выбор компании
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
panelCompanyTools.Enabled = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавление самолёта
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonAddAir_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningMilitaryAircraft));
|
||||
|
||||
/// <summary>
|
||||
/// Добавление истребителя
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonAddAirFighter_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirFighter));
|
||||
|
||||
/// <summary>
|
||||
/// Создание объекта класса-перемещенияв
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
private void CreateObject(string type)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Random random = new();
|
||||
DrawningMilitaryAircraft drawningMilitaryAircraft;
|
||||
switch (type)
|
||||
{
|
||||
case nameof(DrawningMilitaryAircraft):
|
||||
drawningMilitaryAircraft = new DrawningMilitaryAircraft(random.Next(100, 300), random.Next(1000, 3000), GetColor(random));
|
||||
break;
|
||||
case nameof(DrawningAirFighter):
|
||||
drawningMilitaryAircraft = new DrawningAirFighter(random.Next(100, 300), random.Next(1000, 3000),
|
||||
GetColor(random), GetColor(random),
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (_company + drawningMilitaryAircraft != -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение цвета
|
||||
/// </summary>
|
||||
/// <param name="random">Генератор случайных чисел</param>
|
||||
/// <returns></returns>
|
||||
private static Color GetColor(Random random)
|
||||
{
|
||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Удаление объекта
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonRemoveAir_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||
if (_company - pos != null)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Передача объекта в другую форму
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonGoToCheck_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DrawningMilitaryAircraft? militaryAircraft = null;
|
||||
int counter = 100;
|
||||
while (militaryAircraft == null)
|
||||
{
|
||||
militaryAircraft = _company.GetRandomObject();
|
||||
counter--;
|
||||
if (counter <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (militaryAircraft == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FormAirFighter form = new()
|
||||
{
|
||||
SetAir = militaryAircraft
|
||||
};
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перерисовка коллекции
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавление коллекции
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonCollectionAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxCollectionName.Text) || (!radioButtonList.Checked && !radioButtonMassive.Checked))
|
||||
{
|
||||
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
CollectionType collectionType = CollectionType.None;
|
||||
if (radioButtonMassive.Checked)
|
||||
{
|
||||
collectionType = CollectionType.Massive;
|
||||
}
|
||||
else if (radioButtonList.Checked)
|
||||
{
|
||||
collectionType = CollectionType.List;
|
||||
}
|
||||
|
||||
_storageCollection.AddCollection(textBoxCollectionName.Text, collectionType);
|
||||
RerfreshListBoxItems();
|
||||
}
|
||||
/// <summary>
|
||||
/// Удаление коллекции
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonCollectionDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
// TODO прописать логику удаления элемента из коллекции
|
||||
// нужно убедиться, что есть выбранная коллекция
|
||||
// спросить у пользователя через MessageBox, что он подтверждает, что хочет удалить запись
|
||||
// удалить и обновить ListBox
|
||||
|
||||
if (listBoxCollection.SelectedItem == null)
|
||||
{
|
||||
MessageBox.Show("Коллекция не выбрана");
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_storageCollection.DelCollection(listBoxCollection.SelectedItem.ToString());
|
||||
RerfreshListBoxItems();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обновление списка в listBoxCollection
|
||||
/// </summary>
|
||||
private void RerfreshListBoxItems()
|
||||
{
|
||||
listBoxCollection.Items.Clear();
|
||||
for (int i = 0; i < _storageCollection.Keys?.Count; ++i)
|
||||
{
|
||||
string? colName = _storageCollection.Keys?[i];
|
||||
if (!string.IsNullOrEmpty(colName))
|
||||
{
|
||||
listBoxCollection.Items.Add(colName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Создание компании
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonCreateCompany_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
|
||||
{
|
||||
MessageBox.Show("Коллекция не выбрана");
|
||||
return;
|
||||
}
|
||||
|
||||
ICollectionGenericObjects<DrawningMilitaryAircraft>? collection = _storageCollection[listBoxCollection.SelectedItem.ToString() ?? string.Empty];
|
||||
if (collection == null)
|
||||
{
|
||||
MessageBox.Show("Коллекция не проинициализирована");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (comboBoxSelectorCompany.Text)
|
||||
{
|
||||
case "Хранилище":
|
||||
_company = new Angar(pictureBox.Width, pictureBox.Height, collection);
|
||||
break;
|
||||
}
|
||||
|
||||
panelCompanyTools.Enabled = true;
|
||||
RerfreshListBoxItems();
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pplanes.
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
@@ -13,8 +13,10 @@ public class MoveToCenter : AbstractStrategy
|
||||
return false;
|
||||
}
|
||||
|
||||
return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
||||
objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
||||
return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 &&
|
||||
objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
||||
objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 &&
|
||||
objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
||||
}
|
||||
|
||||
protected override void MoveToTarget()
|
||||
|
||||
@@ -5,44 +5,44 @@ namespace ProjectAirFighter.MovementStrategy;
|
||||
/// <summary>
|
||||
/// Класс-реализация IMoveableObject с использованием DrawningCar
|
||||
/// </summary>
|
||||
public class MoveableAir : IMoveableObject
|
||||
public class MoveableMilitaryAircraft : IMoveableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Поле-объект класса DrawningCar или его наследника
|
||||
/// Поле-объект класса DrawningMilitaryAircraft или его наследника
|
||||
/// </summary>
|
||||
private readonly DrawningPlane? _plane = null;
|
||||
private readonly DrawningMilitaryAircraft? _militaryAircraft = null;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="car">Объект класса DrawningCar</param>
|
||||
public MoveableAir(DrawningPlane plane)
|
||||
/// <param name="militaryAircraft">Объект класса DrawningMilitaryAircraft</param>
|
||||
public MoveableMilitaryAircraft(DrawningMilitaryAircraft militaryAircraft)
|
||||
{
|
||||
_plane = plane;
|
||||
_militaryAircraft = militaryAircraft;
|
||||
}
|
||||
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_plane == null || _plane.EntityPlane == null || !_plane.GetPosX.HasValue || !_plane.GetPosY.HasValue)
|
||||
if (_militaryAircraft == null || _militaryAircraft.EntityMilitaryAircraft == null || !_militaryAircraft.GetPosX.HasValue || !_militaryAircraft.GetPosY.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_plane.GetPosX.Value, _plane.GetPosY.Value, _plane.GetWidth, _plane.GetHeight);
|
||||
return new ObjectParameters(_militaryAircraft.GetPosX.Value, _militaryAircraft.GetPosY.Value, _militaryAircraft.GetWidth, _militaryAircraft.GetHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetStep => (int)(_plane?.EntityPlane?.Step ?? 0);
|
||||
public int GetStep => (int)(_militaryAircraft?.EntityMilitaryAircraft?.Step ?? 0);
|
||||
|
||||
public bool TryMoveObject(MovementDirection direction)
|
||||
{
|
||||
if (_plane == null || _plane.EntityPlane == null)
|
||||
if (_militaryAircraft == null || _militaryAircraft.EntityMilitaryAircraft == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _plane.MoveTransport(GetDirectionType(direction));
|
||||
return _militaryAircraft.MoveTransport(GetDirectionType(direction));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -11,7 +11,7 @@ namespace ProjectAirFighter
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new FormAirCollection());
|
||||
Application.Run(new FormMilitaryAircraftCollection());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pplanes.
|
||||
name/value pmilitaryAircrafts.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
|
||||
Reference in New Issue
Block a user