diff --git a/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/AbstractCompany.cs b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/AbstractCompany.cs new file mode 100644 index 0000000..77409f4 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/AbstractCompany.cs @@ -0,0 +1,123 @@ +using ProjectSeaplane.Drawnings; + +namespace ProjectSeaplane.CollectionGenericObjects; + +/// +/// Абстракция компании, хранящий коллекцию самолётов +/// +public abstract class AbstractCompany +{ + /// + /// Размер места (ширина) + /// + protected readonly int _placeSizeWidth = 140; + + /// + /// Размер места (высота) + /// + protected readonly int _placeSizeHeight = 60; + + /// + /// Ширина окна + /// + protected readonly int _pictureWidth; + + /// + /// Высота окна + /// + protected readonly int _pictureHeight; + + /// + /// Коллекция самолётов + /// + protected ICollectionGenericObjects? _collection = null; + + /// + /// Вычисление максимального количества элементов, который можно разместить в окне + /// + private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _placeSizeHeight); + + /// + /// Конструктор + /// + /// Ширина окна + /// Высота окна + /// Коллекция самолётов + public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects collection) + { + _pictureWidth = picWidth; + _pictureHeight = picHeight; + _collection = collection; + _collection.SetMaxCount = GetMaxCount; + } + + /// + /// Перегрузка оператора сложения для класса + /// + /// Компания + /// Добавляемый объект + /// + public static int operator +(AbstractCompany company, DrawningPlane plane) + { + if (company._collection == null) + { + return -1; + } + return company._collection.Insert(plane); + } + + /// + /// Перегрузка оператора удаления для класса + /// + /// Компания + /// Номер удаляемого объекта + /// + public static DrawningPlane operator -(AbstractCompany company, int position) + { + if (company._collection == null) + { + return null; + } + return company._collection.Remove(position); + } + + /// + /// Получение случайного объекта из коллекции + /// + /// + public DrawningPlane? GetRandomObject() + { + Random rnd = new(); + return _collection?.Get(rnd.Next(GetMaxCount)); + } + + /// + /// Вывод всей коллекции + /// + /// + public Bitmap? Show() + { + Bitmap bitmap = new(_pictureWidth, _pictureHeight); + Graphics graphics = Graphics.FromImage(bitmap); + DrawBackgound(graphics); + + SetObjectsPosition(); + for (int i = 0; i < (_collection?.Count ?? 0); ++i) + { + DrawningPlane? obj = _collection?.Get(i); + obj?.DrawTransport(graphics); + } + return bitmap; + } + + /// + /// Вывод заднего фона + /// + /// + protected abstract void DrawBackgound(Graphics g); + + /// + /// Расстановка объектов + /// + protected abstract void SetObjectsPosition(); +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/CollectionType.cs b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/CollectionType.cs new file mode 100644 index 0000000..de79c68 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/CollectionType.cs @@ -0,0 +1,22 @@ +namespace ProjectSeaplane.CollectionGenericObjects; + +/// +/// Тип коллекции +/// +public enum CollectionType +{ + /// + /// Неопределено + /// + None = 0, + + /// + /// Массив + /// + Massive = 1, + + /// + /// Список + /// + List = 2 +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/ICollectionGenericObjects.cs b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/ICollectionGenericObjects.cs new file mode 100644 index 0000000..63be330 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/ICollectionGenericObjects.cs @@ -0,0 +1,48 @@ +namespace ProjectSeaplane.CollectionGenericObjects; + +/// +/// Интерфейс описания действий для набора хранимых объектов +/// +/// Параметр: ограничение - ссылочный тип +public interface ICollectionGenericObjects + where T : class +{ + /// + /// Количество объектов в коллекции + /// + int Count { get; } + + /// + /// Установка максимального количества элементов + /// + int SetMaxCount { set; } + + /// + /// Добавление объекта в коллекцию + /// + /// Добавляемый объект + /// true - вставка прошла удачно, false - вставка не удалась + int Insert(T obj); + + /// + /// Добавление объекта в коллекцию на конкретную позицию + /// + /// Добавляемый объект + /// Позиция + /// true - вставка прошла удачно, false - вставка не удалась + int Insert(T obj, int position); + + /// + /// Удаление объекта из коллекции с конкретной позиции + /// + /// Позиция + /// true - удаление прошло удачно, false - удаление не удалось + T? Remove(int position); + + /// + /// Получение объекта по позиции + /// + /// Позиция + /// Объект + T? Get(int position); +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/ListGenericObjects.cs b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/ListGenericObjects.cs new file mode 100644 index 0000000..3e94174 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/ListGenericObjects.cs @@ -0,0 +1,60 @@ +namespace ProjectSeaplane.CollectionGenericObjects; + +/// +/// Параметризованный набор объектов +/// +/// Параметр: ограничение - ссылочный тип +public class ListGenericObjects : ICollectionGenericObjects + where T : class +{ + /// + /// Список объектов, которые храним + /// + private readonly List _collection; + + /// + /// Максимально допустимое число объектов в списке + /// + private int _maxCount; + public int Count => _collection.Count; + public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } } + + /// + /// Конструктор + /// + public ListGenericObjects() + { + _collection = new(); + } + public T? Get(int position) + { + if (position < 0 || position > _collection.Count) + { + return null; + } + return _collection[position]; + } + public int Insert(T obj) + { + return Insert(obj, _collection.Count); + } + public int Insert(T obj, int position) + { + if (_maxCount == _collection.Count || position < 0 || position > _collection.Count) + { + return -1; + } + _collection.Insert(position, obj); + return _collection.Count; + } + public T? Remove(int position) + { + if (position < 0 || position > _collection.Count) + { + return null; + } + T obj = _collection[position]; + _collection.RemoveAt(position); + return obj; + } +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/MassiveGenericObjects.cs new file mode 100644 index 0000000..840ea93 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/MassiveGenericObjects.cs @@ -0,0 +1,108 @@ +using ProjectSeaplane.Drawnings; + +namespace ProjectSeaplane.CollectionGenericObjects; + +/// +/// Параметризованный набор объектов +/// +/// Параметр: ограничение - ссылочный тип +public class MassiveGenericObjects : ICollectionGenericObjects + where T : class +{ + /// + /// Массив объектов, которые храним + /// + private T?[] _collection; + + public int Count => _collection.Length; + + public int SetMaxCount + { + set + { + if (value > 0) + { + if (_collection.Length > 0) + { + Array.Resize(ref _collection, value); + } + else + { + _collection = new T?[value]; + } + } + } + } + + /// + /// Конструктор + /// + public MassiveGenericObjects() + { + _collection = Array.Empty(); + } + + public T? Get(int position) + { + if (position >= 0 && position < Count) + { + return _collection[position]; + } + else + { + return null; + } + } + + public int Insert(T obj) + { + return Insert(obj, 0); + } + + public int Insert(T obj, int position) + { + if (position < 0 || position >= Count) + { + return -1; + } + if (_collection[position] == null) + { + _collection[position] = obj; + return position; + } + + for (int i = position; i < Count; i++) + { + if (_collection[i] == null) + { + _collection[i] = obj; + return i; + } + } + for (int i = position - 1; i >= 0; --i) + { + if (_collection[i] == null) + { + _collection[i] = obj; + return i; + } + } + return -1; + } + + public T? Remove(int position) + { + if (position < 0 || position >= _collection.Count()) + { + return null; + } + if (_collection[position] != null) + { + T obj = _collection[position]; + _collection[position] = null; + return obj; + + } + return null; + } +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/PlaneSharingService.cs b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/PlaneSharingService.cs new file mode 100644 index 0000000..6e80060 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/PlaneSharingService.cs @@ -0,0 +1,66 @@ +using ProjectSeaplane.Drawnings; + +namespace ProjectSeaplane.CollectionGenericObjects; + +/// +/// Реализация абстрактной компании - плейншеринг +/// +public class PlaneSharingService : AbstractCompany +{ + private List> locCoord = new List>(); + private int countInRow; + private int countRow; + + /// + /// Конструктор + /// + /// + /// + /// + public PlaneSharingService(int picWidth, int picHeight, ICollectionGenericObjects? collection) : base(picWidth, picHeight, collection) + { + } + + protected override void DrawBackgound(Graphics g) + { + Pen pen = new Pen(Color.Brown); + int x = 1, y = 0; + while (y + _placeSizeHeight <= _pictureHeight) + { + int count = 0; + while (x + _placeSizeWidth <= _pictureWidth) + { + count++; + g.DrawLine(pen, x, y, x + _placeSizeWidth, y); + g.DrawLine(pen, x, y, x, y + _placeSizeHeight); + g.DrawLine(pen, x, y + _placeSizeHeight, x + _placeSizeWidth, y + _placeSizeHeight); + g.DrawLine(pen, x + _placeSizeWidth, y + _placeSizeHeight, x + _placeSizeWidth, y); + locCoord.Add(new Tuple(x, y)); + x += _placeSizeWidth + 2; + } + countInRow = count; + x = 1; + y += _placeSizeHeight + 5; + countRow++; + } + } + + protected override void SetObjectsPosition() + { + if (locCoord == null || _collection == null) + { + return; + } + int row = countRow, col = 1; + for (int i = 0; i < _collection?.Count; i++, col++) + { + _collection?.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight); + _collection?.Get(i)?.SetPosition(locCoord[row * countInRow - col].Item1 + 5, locCoord[row * countInRow - col].Item2 + 5); + if (col == countInRow) + { + col = 0; + row--; + } + } + } +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/StorageCollection.cs b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/StorageCollection.cs new file mode 100644 index 0000000..5950c32 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/StorageCollection.cs @@ -0,0 +1,85 @@ +namespace ProjectSeaplane.CollectionGenericObjects; + +/// +/// Класс-хранилище коллекций +/// +/// +public class StorageCollection + where T : class +{ + /// + /// Словарь (хранилище) с коллекциями + /// + readonly Dictionary> _storage; + + /// + /// Возвращение списка названий коллекций + /// + public List Keys => _storage.Keys.ToList(); + + /// + /// Конструктор + /// + public StorageCollection() + { + _storage = new Dictionary>(); + } + + /// + /// Добавление коллекции в хранилище + /// + /// Название коллекции + /// тип коллекции + public void AddCollection(string name, CollectionType collectionType) + { + if (string.IsNullOrEmpty(name) || _storage.ContainsKey(name)) + { + return; + } + if (collectionType == CollectionType.None) + { + return; + } + if (collectionType == CollectionType.Massive) + { + _storage[name] = new MassiveGenericObjects(); + } + else if (collectionType == CollectionType.List) + { + _storage[name] = new ListGenericObjects(); + } + } + + /// + /// Удаление коллекции + /// + /// Название коллекции + public void DelCollection(string name) + { + if (name == null || !_storage.ContainsKey(name)) + { + return; + } + _storage.Remove(name); + } + + /// + /// Доступ к коллекции + /// + /// Название коллекции + /// + public ICollectionGenericObjects? this[string name] + { + get + { + if (_storage.ContainsKey(name)) + { + return _storage[name]; + } + else + { + return null; + } + } + } +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/Drawnings/DirectionType.cs b/ProjectSeaplane/ProjectSeaplane/Drawnings/DirectionType.cs new file mode 100644 index 0000000..81916f2 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/Drawnings/DirectionType.cs @@ -0,0 +1,31 @@ +namespace ProjectSeaplane.Drawnings; +/// +/// Направление перемещения +/// +public enum DirectionType +{ + /// + /// Неизвестное направление + /// + Unknow = -1, + + /// + /// Вверх + /// + Up = 1, + + /// + /// Вниз + /// + Down = 2, + + /// + /// Влево + /// + Left = 3, + + /// + /// Вправо + /// + Right = 4 +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/Drawnings/DrawningPlane.cs b/ProjectSeaplane/ProjectSeaplane/Drawnings/DrawningPlane.cs new file mode 100644 index 0000000..adb5ead --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/Drawnings/DrawningPlane.cs @@ -0,0 +1,246 @@ +using ProjectSeaplane.Entities; + +namespace ProjectSeaplane.Drawnings; + +/// +/// Класс, отвечающий за прорисовку и перемещение базового объекта-сущности +/// +public class DrawningPlane +{ + /// + /// Класс-сущность + /// + public EntityPlane? EntityPlane { get; protected set; } + + /// + /// Ширина окна + /// + private int? _pictureWidth; + + /// + /// Высота окна + /// + private int? _pictureHeight; + + /// + /// Левая координата прорисовки самолёта + /// + protected int? _startPosX; + + /// + /// Верхняя кооридната прорисовки самолёта + /// + protected int? _startPosY; + + /// + /// Ширина прорисовки самолёта + /// + private readonly int _drawningPlaneWidth = 130; + + /// + /// Высота прорисовки самолёта + /// + private readonly int _drawningPlaneHeight = 45; + + /// + /// Координата X объекта + /// + public int? GetPosX => _startPosX; + /// + /// Координата Y объекта + /// + public int? GetPosY => _startPosY; + /// + /// Ширина объекта + /// + public int GetWidth => _drawningPlaneWidth; + /// + /// Высота объекта + /// + public int GetHeight => _drawningPlaneHeight; + + /// + /// Пустой конструктор + /// + private DrawningPlane() + { + _pictureWidth = null; + _pictureHeight = null; + _startPosX = null; + _startPosY = null; + } + + /// + /// Конструктор + /// + /// Скорость + /// Вес + /// Основной цвет + public DrawningPlane(int speed, double weight, Color bodyColor) : this() + { + EntityPlane = new EntityPlane(speed, weight, bodyColor); + } + + /// + /// Конструктор для наследников + /// + /// Ширина прорисовки гидросамолёта + /// Высота прорисовки гидросамолёта + protected DrawningPlane(int drawningPlaneWidth, int drawningPlaneHeight) : this() + { + _drawningPlaneWidth = drawningPlaneWidth; + _drawningPlaneHeight = drawningPlaneHeight; + } + + /// + /// Установка границ поля + /// + /// Ширина поля + /// Высота поля + /// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах + public bool SetPictureSize(int width, int height) + { + + if (height < _drawningPlaneHeight || width < _drawningPlaneWidth) + { + return false; + } + + _pictureWidth = width; + _pictureHeight = height; + + if (_startPosX.HasValue && _drawningPlaneWidth + _startPosX > width) _startPosX = _pictureWidth - _drawningPlaneWidth; + if (_startPosY.HasValue && _drawningPlaneHeight + _startPosY > height) _startPosY = _pictureHeight - _drawningPlaneHeight; + return true; + } + + /// + /// Установка позиции + /// + /// Координата X + /// Координата Y + public void SetPosition(int x, int y) + { + if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) + { + return; + } + if (x < 0) + { + x = 0; + } + if (x + _drawningPlaneWidth > _pictureWidth.Value) + { + x = _pictureWidth.Value - _drawningPlaneWidth; + } + if (y < 0) + { + y = 0; + } + if (y + _drawningPlaneHeight > _pictureHeight.Value) + { + y = _pictureHeight.Value - _drawningPlaneHeight; + } + + _startPosX = x; + _startPosY = y; + } + + /// + /// Изменение направления перемещения + /// + /// Направление + /// true - перемещене выполнено, false - перемещение невозможно + public bool MoveTransport(DirectionType direction) + { + if (EntityPlane == null || !_startPosX.HasValue || !_startPosY.HasValue) + { + return false; + } + + switch (direction) + { + //влево + case DirectionType.Left: + if (_startPosX.Value - EntityPlane.Step > 0) + { + _startPosX -= (int)EntityPlane.Step; + } + return true; + //вверх + case DirectionType.Up: + if (_startPosY.Value - EntityPlane.Step > 0) + { + _startPosY -= (int)EntityPlane.Step; + } + return true; + // вправо + case DirectionType.Right: + if (_startPosX.Value + _drawningPlaneWidth + EntityPlane.Step < _pictureWidth) + { + _startPosX += (int)EntityPlane.Step; + } + return true; + //вниз + case DirectionType.Down: + + if (_startPosY.Value + _drawningPlaneHeight + EntityPlane.Step < _pictureHeight) + { + _startPosY += (int)EntityPlane.Step; + } + return true; + default: + return false; + } + } + + /// + /// Прорисовка объекта + /// + /// + public virtual void DrawTransport(Graphics g) + { + if (EntityPlane == null || !_startPosX.HasValue || !_startPosY.HasValue) + { + return; + } + Pen pen = new(Color.Black, 2); + + //Отрисовка основных частей самолёта + Brush br = new SolidBrush(EntityPlane.BodyColor); + g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 20, 20, 20); + g.FillEllipse(br, _startPosX.Value, _startPosY.Value + 20, 20, 20); + Point point1 = new Point(_startPosX.Value + 10, _startPosY.Value); + Point point2 = new Point(_startPosX.Value + 40, _startPosY.Value + 20); + Point point3 = new Point(_startPosX.Value + 100, _startPosY.Value + 20); + Point point4 = new Point(_startPosX.Value + 130, _startPosY.Value + 30); + Point point5 = new Point(_startPosX.Value + 100, _startPosY.Value + 40); + Point point6 = new Point(_startPosX.Value + 10, _startPosY.Value + 40); + Point[] points = { point1, point2, point3, point4, point5, point6 }; + g.FillPolygon(br, points); + g.DrawPolygon(pen, points); + g.DrawLine(pen, _startPosX.Value + 10, _startPosY.Value + 20, _startPosX.Value + 40, _startPosY.Value + 20); + g.DrawLine(pen, _startPosX.Value + 100, _startPosY.Value + 20, _startPosX.Value + 100, _startPosY.Value + 40); + g.DrawLine(pen, _startPosX.Value + 100, _startPosY.Value + 30, _startPosX.Value + 130, _startPosY.Value + 30); + + //Крылья + g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 20, 25, 5); + g.FillEllipse(br, _startPosX.Value, _startPosY.Value + 20, 25, 5); + g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 25, 40, 10); + g.FillEllipse(br, _startPosX.Value + 30, _startPosY.Value + 25, 40, 10); + + + //Шасси + g.DrawRectangle(pen, _startPosX.Value + 38, _startPosY.Value + 40, 4, 5); + g.DrawRectangle(pen, _startPosX.Value + 88, _startPosY.Value + 40, 4, 5); + g.DrawEllipse(pen, _startPosX.Value + 35, _startPosY.Value + 45, 5, 5); + g.DrawEllipse(pen, _startPosX.Value + 42, _startPosY.Value + 45, 5, 5); + g.DrawEllipse(pen, _startPosX.Value + 87, _startPosY.Value + 45, 5, 5); + + g.FillRectangle(br, _startPosX.Value + 38, _startPosY.Value + 40, 4, 5); + g.FillRectangle(br, _startPosX.Value + 88, _startPosY.Value + 40, 4, 5); + g.FillEllipse(br, _startPosX.Value + 35, _startPosY.Value + 45, 5, 5); + g.FillEllipse(br, _startPosX.Value + 42, _startPosY.Value + 45, 5, 5); + g.FillEllipse(br, _startPosX.Value + 87, _startPosY.Value + 45, 5, 5); + } +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/Drawnings/DrawningSeaplane.cs b/ProjectSeaplane/ProjectSeaplane/Drawnings/DrawningSeaplane.cs new file mode 100644 index 0000000..68f7500 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/Drawnings/DrawningSeaplane.cs @@ -0,0 +1,54 @@ +using ProjectSeaplane.Entities; + +namespace ProjectSeaplane.Drawnings; +/// +/// Класс, отвечающий за прорисовку и перемещение объекта-сущности +/// +public class DrawningSeaplane : DrawningPlane +{ + /// + /// Конструктор + /// + /// Скорость + /// Вес + /// Основной цвет + /// Дополнительный цвет + /// Признак наличия поплавков + /// Признак наличия лодки + public DrawningSeaplane(int speed, double weight, Color bodyColor, Color additionalColor, bool floats, bool boat) : base(130, 50) + { + EntityPlane = new EntitySeaplane(speed, weight, bodyColor, additionalColor, floats, boat); + } + + public override void DrawTransport(Graphics g) + { + if (EntityPlane == null || EntityPlane is not EntitySeaplane seaplane || !_startPosX.HasValue || !_startPosY.HasValue) + { + return; + } + + Pen pen = new(Color.Black, 2); + Brush additionalBrush = new SolidBrush(seaplane.AdditionalColor); + + base.DrawTransport(g); + + //Надувнвя лодка + if (seaplane.Boat) + { + g.DrawEllipse(pen, _startPosX.Value + 50, _startPosY.Value + 15, 30, 10); + g.FillEllipse(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 15, 30, 10); + + } + + //Поплавки + if (seaplane.Floats) + { + g.DrawRectangle(pen, _startPosX.Value + 30, _startPosY.Value + 30, 4, 15); + g.FillRectangle(additionalBrush, _startPosX.Value + 30, _startPosY.Value + 30, 4, 15); + g.DrawRectangle(pen, _startPosX.Value + 66, _startPosY.Value + 30, 4, 15); + g.FillRectangle(additionalBrush, _startPosX.Value + 66, _startPosY.Value + 30, 4, 15); + g.DrawEllipse(pen, _startPosX.Value + 20, _startPosY.Value + 40, 70, 10); + g.FillEllipse(additionalBrush, _startPosX.Value + 20, _startPosY.Value + 40, 70, 10); + } + } +} diff --git a/ProjectSeaplane/ProjectSeaplane/Entities/EntityPlane.cs b/ProjectSeaplane/ProjectSeaplane/Entities/EntityPlane.cs new file mode 100644 index 0000000..f8fc121 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/Entities/EntityPlane.cs @@ -0,0 +1,40 @@ +namespace ProjectSeaplane.Entities; + +/// +/// Класс-сущность "Самолёт" +/// +public class EntityPlane +{ + /// + /// Скорость + /// + public int Speed { get; private set; } + + /// + /// Вес + /// + public double Weight { get; private set; } + + /// + /// Основной цвет + /// + public Color BodyColor { get; private set; } + + /// + /// Шаг перемещения гидросамолёта + /// + public double Step => Speed * 100 / Weight; + + /// + /// Конструктор сущности + /// + /// Скорость + /// Вес автомобиля + /// Основной цвет + public EntityPlane(int speed, double weight, Color bodyColor) + { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + } +} diff --git a/ProjectSeaplane/ProjectSeaplane/Entities/EntitySeaplane.cs b/ProjectSeaplane/ProjectSeaplane/Entities/EntitySeaplane.cs new file mode 100644 index 0000000..e97ba9c --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/Entities/EntitySeaplane.cs @@ -0,0 +1,38 @@ +namespace ProjectSeaplane.Entities; +/// +/// Класс-сущность "Гидросамолёт" +/// +public class EntitySeaplane : EntityPlane +{ + /// + /// Дополнительный цвет (для опциональных элементов) + /// + public Color AdditionalColor { get; private set; } + + + /// + /// Признак (опция) наличия поплавков + /// + public bool Floats { get; private set; } + + /// + /// Признак (опция) наличия лодки + /// + public bool Boat { get; private set; } + + /// + /// Инициализация полей объекта-класса гидросамолёта + /// + /// Скорость + /// Вес автомобиля + /// Основной цвет + /// Дополнительный цвет + /// Признак наличия поплавков + /// Признак наличия лодки + public EntitySeaplane(int speed, double weight, Color bodyColor, Color additionalColor, bool floats, bool boat) : base(speed, weight, bodyColor) + { + AdditionalColor = additionalColor; + Floats = floats; + Boat = boat; + } +} diff --git a/ProjectSeaplane/ProjectSeaplane/Form1.Designer.cs b/ProjectSeaplane/ProjectSeaplane/Form1.Designer.cs deleted file mode 100644 index 8e222d3..0000000 --- a/ProjectSeaplane/ProjectSeaplane/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace ProjectSeaplane -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; - } - - #endregion - } -} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/Form1.cs b/ProjectSeaplane/ProjectSeaplane/Form1.cs deleted file mode 100644 index 4a978b3..0000000 --- a/ProjectSeaplane/ProjectSeaplane/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ProjectSeaplane -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/FormPlaneCollection.Designer.cs b/ProjectSeaplane/ProjectSeaplane/FormPlaneCollection.Designer.cs new file mode 100644 index 0000000..cd005c1 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/FormPlaneCollection.Designer.cs @@ -0,0 +1,299 @@ +namespace ProjectSeaplane +{ + partial class FormPlaneCollection + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + groupBoxTools = new GroupBox(); + buttonCreateCompany = new Button(); + panelStorage = new Panel(); + buttonCollectionDel = new Button(); + listBoxCollection = new ListBox(); + buttonCollectionAdd = new Button(); + radioButtonList = new RadioButton(); + radioButtonMassive = new RadioButton(); + textBoxCollectionName = new TextBox(); + labelCollectionName = new Label(); + buttonRefresh = new Button(); + buttonGoToCheck = new Button(); + buttonRemovePlane = new Button(); + maskedTextBoxPosition = new MaskedTextBox(); + buttonAddSeaplane = new Button(); + buttonAddPlane = new Button(); + comboBoxSelectorCompany = new ComboBox(); + pictureBox = new PictureBox(); + panelCompanyTools = new Panel(); + groupBoxTools.SuspendLayout(); + panelStorage.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit(); + panelCompanyTools.SuspendLayout(); + SuspendLayout(); + // + // groupBoxTools + // + groupBoxTools.Controls.Add(panelCompanyTools); + groupBoxTools.Controls.Add(buttonCreateCompany); + groupBoxTools.Controls.Add(panelStorage); + groupBoxTools.Controls.Add(comboBoxSelectorCompany); + groupBoxTools.Dock = DockStyle.Right; + groupBoxTools.Location = new Point(793, 0); + groupBoxTools.Name = "groupBoxTools"; + groupBoxTools.Size = new Size(144, 571); + groupBoxTools.TabIndex = 0; + groupBoxTools.TabStop = false; + groupBoxTools.Text = "Инструменты"; + // + // buttonCreateCompany + // + buttonCreateCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + buttonCreateCompany.Location = new Point(7, 285); + buttonCreateCompany.Name = "buttonCreateCompany"; + buttonCreateCompany.Size = new Size(126, 30); + buttonCreateCompany.TabIndex = 9; + buttonCreateCompany.Text = "Создать компанию"; + buttonCreateCompany.UseVisualStyleBackColor = true; + buttonCreateCompany.Click += ButtonCreateCompany_Click; + // + // 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, 19); + panelStorage.Name = "panelStorage"; + panelStorage.Size = new Size(138, 231); + panelStorage.TabIndex = 7; + // + // buttonCollectionDel + // + buttonCollectionDel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + buttonCollectionDel.Location = new Point(3, 196); + buttonCollectionDel.Name = "buttonCollectionDel"; + buttonCollectionDel.Size = new Size(126, 30); + buttonCollectionDel.TabIndex = 8; + buttonCollectionDel.Text = "Удалить коллекцию"; + buttonCollectionDel.UseVisualStyleBackColor = true; + buttonCollectionDel.Click += ButtonCollectionDel_Click; + // + // listBoxCollection + // + listBoxCollection.FormattingEnabled = true; + listBoxCollection.ItemHeight = 15; + listBoxCollection.Location = new Point(3, 126); + listBoxCollection.Name = "listBoxCollection"; + listBoxCollection.Size = new Size(126, 64); + listBoxCollection.TabIndex = 5; + // + // buttonCollectionAdd + // + buttonCollectionAdd.Location = new Point(4, 81); + buttonCollectionAdd.Name = "buttonCollectionAdd"; + buttonCollectionAdd.Size = new Size(125, 39); + buttonCollectionAdd.TabIndex = 4; + buttonCollectionAdd.Text = "Добавить коллекцию"; + buttonCollectionAdd.UseVisualStyleBackColor = true; + buttonCollectionAdd.Click += ButtonCollectionAdd_Click; + // + // radioButtonList + // + radioButtonList.AutoSize = true; + radioButtonList.Location = new Point(69, 56); + radioButtonList.Name = "radioButtonList"; + radioButtonList.Size = new Size(66, 19); + radioButtonList.TabIndex = 3; + radioButtonList.TabStop = true; + radioButtonList.Text = "Список"; + radioButtonList.UseVisualStyleBackColor = true; + // + // radioButtonMassive + // + radioButtonMassive.AutoSize = true; + radioButtonMassive.Location = new Point(4, 56); + radioButtonMassive.Name = "radioButtonMassive"; + radioButtonMassive.Size = new Size(67, 19); + radioButtonMassive.TabIndex = 2; + radioButtonMassive.TabStop = true; + radioButtonMassive.Text = "Массив"; + radioButtonMassive.UseVisualStyleBackColor = true; + // + // textBoxCollectionName + // + textBoxCollectionName.Location = new Point(3, 27); + textBoxCollectionName.Name = "textBoxCollectionName"; + textBoxCollectionName.Size = new Size(126, 23); + textBoxCollectionName.TabIndex = 1; + // + // labelCollectionName + // + labelCollectionName.AutoSize = true; + labelCollectionName.Location = new Point(4, 9); + labelCollectionName.Name = "labelCollectionName"; + labelCollectionName.Size = new Size(125, 15); + labelCollectionName.TabIndex = 0; + labelCollectionName.Text = "Название коллекции:"; + // + // buttonRefresh + // + buttonRefresh.Location = new Point(3, 202); + buttonRefresh.Name = "buttonRefresh"; + buttonRefresh.Size = new Size(126, 42); + buttonRefresh.TabIndex = 6; + buttonRefresh.Text = "Обновить"; + buttonRefresh.UseVisualStyleBackColor = true; + buttonRefresh.Click += ButtonRefresh_Click; + // + // buttonGoToCheck + // + buttonGoToCheck.Location = new Point(4, 166); + buttonGoToCheck.Name = "buttonGoToCheck"; + buttonGoToCheck.Size = new Size(126, 30); + buttonGoToCheck.TabIndex = 5; + buttonGoToCheck.Text = "Передать на тесты"; + buttonGoToCheck.UseVisualStyleBackColor = true; + buttonGoToCheck.Click += ButtonGoToCheck_Click; + // + // buttonRemovePlane + // + buttonRemovePlane.Location = new Point(4, 130); + buttonRemovePlane.Name = "buttonRemovePlane"; + buttonRemovePlane.Size = new Size(126, 30); + buttonRemovePlane.TabIndex = 4; + buttonRemovePlane.Text = "Удалить самолёт"; + buttonRemovePlane.UseVisualStyleBackColor = true; + buttonRemovePlane.Click += ButtonRemovePlane_Click; + // + // maskedTextBoxPosition + // + maskedTextBoxPosition.Location = new Point(4, 101); + maskedTextBoxPosition.Mask = "00"; + maskedTextBoxPosition.Name = "maskedTextBoxPosition"; + maskedTextBoxPosition.Size = new Size(126, 23); + maskedTextBoxPosition.TabIndex = 3; + maskedTextBoxPosition.ValidatingType = typeof(int); + // + // buttonAddSeaplane + // + buttonAddSeaplane.Location = new Point(3, 51); + buttonAddSeaplane.Name = "buttonAddSeaplane"; + buttonAddSeaplane.Size = new Size(126, 44); + buttonAddSeaplane.TabIndex = 2; + buttonAddSeaplane.Text = "Добавление гидросамолёта"; + buttonAddSeaplane.UseVisualStyleBackColor = true; + buttonAddSeaplane.Click += ButtonAddSeaplane_Click; + // + // buttonAddPlane + // + buttonAddPlane.Location = new Point(4, 3); + buttonAddPlane.Name = "buttonAddPlane"; + buttonAddPlane.Size = new Size(126, 42); + buttonAddPlane.TabIndex = 1; + buttonAddPlane.Text = "Добавление самолёта"; + buttonAddPlane.UseVisualStyleBackColor = true; + buttonAddPlane.Click += ButtonAddPlane_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, 256); + comboBoxSelectorCompany.Name = "comboBoxSelectorCompany"; + comboBoxSelectorCompany.Size = new Size(126, 23); + 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(793, 571); + pictureBox.TabIndex = 1; + pictureBox.TabStop = false; + // + // panelCompanyTools + // + panelCompanyTools.Controls.Add(buttonAddPlane); + panelCompanyTools.Controls.Add(buttonAddSeaplane); + panelCompanyTools.Controls.Add(buttonRefresh); + panelCompanyTools.Controls.Add(maskedTextBoxPosition); + panelCompanyTools.Controls.Add(buttonGoToCheck); + panelCompanyTools.Controls.Add(buttonRemovePlane); + panelCompanyTools.Dock = DockStyle.Bottom; + panelCompanyTools.Enabled = false; + panelCompanyTools.Location = new Point(3, 320); + panelCompanyTools.Name = "panelCompanyTools"; + panelCompanyTools.Size = new Size(138, 248); + panelCompanyTools.TabIndex = 10; + // + // FormPlaneCollection + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(937, 571); + Controls.Add(pictureBox); + Controls.Add(groupBoxTools); + Name = "FormPlaneCollection"; + Text = "Коллекция самолётов"; + groupBoxTools.ResumeLayout(false); + panelStorage.ResumeLayout(false); + panelStorage.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit(); + panelCompanyTools.ResumeLayout(false); + panelCompanyTools.PerformLayout(); + ResumeLayout(false); + } + + #endregion + + private GroupBox groupBoxTools; + private ComboBox comboBoxSelectorCompany; + private Button buttonAddPlane; + private Button buttonAddSeaplane; + private Button buttonRemovePlane; + private MaskedTextBox maskedTextBoxPosition; + private PictureBox pictureBox; + private Button buttonRefresh; + private Button buttonGoToCheck; + private Panel panelStorage; + private Label labelCollectionName; + private RadioButton radioButtonMassive; + private TextBox textBoxCollectionName; + private Button buttonCollectionAdd; + private RadioButton radioButtonList; + private ListBox listBoxCollection; + private Button buttonCollectionDel; + private Button buttonCreateCompany; + private Panel panelCompanyTools; + } +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/FormPlaneCollection.cs b/ProjectSeaplane/ProjectSeaplane/FormPlaneCollection.cs new file mode 100644 index 0000000..a953ae7 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/FormPlaneCollection.cs @@ -0,0 +1,280 @@ +using ProjectSeaplane.CollectionGenericObjects; +using ProjectSeaplane.Drawnings; + +namespace ProjectSeaplane; + +/// +/// Форма работы с компанией и её коллекцией +/// +public partial class FormPlaneCollection : Form +{ + /// + /// Хранилише коллекций + /// + private readonly StorageCollection _storageCollection; + + /// + /// Компания + /// + private AbstractCompany? _company = null; + + /// + /// Конструктор + /// + public FormPlaneCollection() + { + InitializeComponent(); + _storageCollection = new(); + } + + /// + /// Выбор компании + /// + /// + /// + private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e) + { + panelCompanyTools.Enabled = false; + } + + /// + /// Добавление обычного самолёта + /// + /// + /// + private void ButtonAddPlane_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningPlane)); + + /// + /// Добавление гидросамолёта + /// + /// + /// + private void ButtonAddSeaplane_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningSeaplane)); + + /// + /// Создание объекта класса-перемещения + /// + /// Тип создаваемого объекта + private void CreateObject(string type) + { + if (_company == null) + { + return; + } + + Random random = new(); + DrawningPlane _drawningPlane; + switch (type) + { + case nameof(DrawningPlane): + _drawningPlane = new DrawningPlane(random.Next(100, 300), random.Next(1000, 3000), GetColor(random)); + break; + case nameof(DrawningSeaplane): + _drawningPlane = new DrawningSeaplane(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 + _drawningPlane) != -1) + { + MessageBox.Show("Объект добавлен"); + pictureBox.Image = _company.Show(); + } + else + { + MessageBox.Show("Не удалось добавить объект"); + } + } + + /// + /// Получение цвета + /// + /// Генератор случайных чисел + /// + 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; + } + + /// + /// Удаление объекта + /// + /// + /// + private void ButtonRemovePlane_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("Не удалось удалить объект"); + } + + } + + /// + /// Передача объекта в другую форму + /// + /// + /// + 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; + } + + FormSeaplane form = new FormSeaplane(); + form.SetPlane = plane; + form.ShowDialog(); + } + + /// + /// Перерисовка коллекции + /// + /// + /// + private void ButtonRefresh_Click(object sender, EventArgs e) + { + if (_company == null) + { + return; + } + + pictureBox.Image = _company.Show(); + } + + /// + /// Добавление коллекции + /// + /// + /// + 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); + RefreshListBoxItems(); + } + + /// + /// Удаление коллекции + /// + /// + /// + private void ButtonCollectionDel_Click(object sender, EventArgs e) + { + if (listBoxCollection.SelectedIndex < 0) + { + MessageBox.Show("Сначала выберите коллекцию"); + return; + } + if (MessageBox.Show("Удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + _storageCollection.DelCollection(listBoxCollection.SelectedItem?.ToString() ?? string.Empty); + RefreshListBoxItems(); + } + + + /// + /// Обновление списка в listBoxCollection + /// + private void RefreshListBoxItems() + { + 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); + } + } + } + + /// + /// Создание компании + /// + /// + /// + private void ButtonCreateCompany_Click(object sender, EventArgs e) + { + if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null) + { + MessageBox.Show("Коллекция не выбрана"); + return; + } + + ICollectionGenericObjects? collection = _storageCollection[listBoxCollection.SelectedItem.ToString() ?? string.Empty]; + if (collection == null) + { + MessageBox.Show("Коллекция не проинициализирована"); + return; + } + + switch (comboBoxSelectorCompany.Text) + { + case "Хранилище": + _company = new PlaneSharingService(pictureBox.Width, pictureBox.Height, collection); + break; + } + panelCompanyTools.Enabled = true; + RefreshListBoxItems(); + } +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/Form1.resx b/ProjectSeaplane/ProjectSeaplane/FormPlaneCollection.resx similarity index 93% rename from ProjectSeaplane/ProjectSeaplane/Form1.resx rename to ProjectSeaplane/ProjectSeaplane/FormPlaneCollection.resx index 1af7de1..af32865 100644 --- a/ProjectSeaplane/ProjectSeaplane/Form1.resx +++ b/ProjectSeaplane/ProjectSeaplane/FormPlaneCollection.resx @@ -1,17 +1,17 @@  - diff --git a/ProjectSeaplane/ProjectSeaplane/FormSeaplane.Designer.cs b/ProjectSeaplane/ProjectSeaplane/FormSeaplane.Designer.cs new file mode 100644 index 0000000..0015250 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/FormSeaplane.Designer.cs @@ -0,0 +1,146 @@ +namespace ProjectSeaplane +{ + partial class FormSeaplane + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + pictureBoxSeaplane = new PictureBox(); + buttonLeft = new Button(); + buttonUp = new Button(); + buttonDown = new Button(); + buttonRight = new Button(); + comboBoxStrategy = new ComboBox(); + buttonStrategyStep = new Button(); + ((System.ComponentModel.ISupportInitialize)pictureBoxSeaplane).BeginInit(); + SuspendLayout(); + // + // pictureBoxSeaplane + // + pictureBoxSeaplane.Dock = DockStyle.Fill; + pictureBoxSeaplane.Location = new Point(0, 0); + pictureBoxSeaplane.Name = "pictureBoxSeaplane"; + pictureBoxSeaplane.Size = new Size(900, 517); + pictureBoxSeaplane.TabIndex = 0; + pictureBoxSeaplane.TabStop = false; + // + // buttonLeft + // + buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonLeft.BackgroundImage = Properties.Resources.arrow_left; + buttonLeft.BackgroundImageLayout = ImageLayout.Stretch; + buttonLeft.Location = new Point(768, 468); + buttonLeft.Name = "buttonLeft"; + buttonLeft.Size = new Size(35, 35); + buttonLeft.TabIndex = 2; + buttonLeft.UseVisualStyleBackColor = true; + buttonLeft.Click += ButtonMove_Click; + // + // buttonUp + // + buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonUp.BackgroundImage = Properties.Resources.arrow_up; + buttonUp.BackgroundImageLayout = ImageLayout.Stretch; + buttonUp.Location = new Point(808, 428); + buttonUp.Name = "buttonUp"; + buttonUp.Size = new Size(35, 35); + buttonUp.TabIndex = 3; + buttonUp.UseVisualStyleBackColor = true; + buttonUp.Click += ButtonMove_Click; + // + // buttonDown + // + buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonDown.BackgroundImage = Properties.Resources.arrow_down; + buttonDown.BackgroundImageLayout = ImageLayout.Stretch; + buttonDown.Location = new Point(808, 468); + buttonDown.Name = "buttonDown"; + buttonDown.Size = new Size(35, 35); + buttonDown.TabIndex = 4; + buttonDown.UseVisualStyleBackColor = true; + buttonDown.Click += ButtonMove_Click; + // + // buttonRight + // + buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonRight.BackgroundImage = Properties.Resources.arrow_right; + buttonRight.BackgroundImageLayout = ImageLayout.Stretch; + buttonRight.Location = new Point(849, 468); + buttonRight.Name = "buttonRight"; + buttonRight.Size = new Size(35, 35); + buttonRight.TabIndex = 5; + buttonRight.UseVisualStyleBackColor = true; + buttonRight.Click += ButtonMove_Click; + // + // comboBoxStrategy + // + comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxStrategy.FormattingEnabled = true; + comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К краю" }); + comboBoxStrategy.Location = new Point(763, 12); + comboBoxStrategy.Name = "comboBoxStrategy"; + comboBoxStrategy.Size = new Size(121, 23); + comboBoxStrategy.TabIndex = 7; + // + // buttonStrategyStep + // + buttonStrategyStep.Location = new Point(808, 41); + buttonStrategyStep.Name = "buttonStrategyStep"; + buttonStrategyStep.Size = new Size(75, 23); + buttonStrategyStep.TabIndex = 8; + buttonStrategyStep.Text = "Шаг"; + buttonStrategyStep.UseVisualStyleBackColor = true; + buttonStrategyStep.Click += ButtonStrategyStep_Click; + // + // FormSeaplane + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(900, 517); + Controls.Add(buttonStrategyStep); + Controls.Add(comboBoxStrategy); + Controls.Add(buttonRight); + Controls.Add(buttonDown); + Controls.Add(buttonUp); + Controls.Add(buttonLeft); + Controls.Add(pictureBoxSeaplane); + Name = "FormSeaplane"; + Text = "Гидросамолёт"; + ((System.ComponentModel.ISupportInitialize)pictureBoxSeaplane).EndInit(); + ResumeLayout(false); + } + + #endregion + + private PictureBox pictureBoxSeaplane; + private Button buttonLeft; + private Button buttonUp; + private Button buttonDown; + private Button buttonRight; + private ComboBox comboBoxStrategy; + private Button buttonStrategyStep; + } +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/FormSeaplane.cs b/ProjectSeaplane/ProjectSeaplane/FormSeaplane.cs new file mode 100644 index 0000000..ff242e0 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/FormSeaplane.cs @@ -0,0 +1,136 @@ +using ProjectSeaplane.Drawnings; +using ProjectSeaplane.MovementStrategy; + +namespace ProjectSeaplane; + +/// +/// Форма работы с объектом "Спортивный автомобиль" +/// +public partial class FormSeaplane : Form +{ + /// + /// Поле-объект для прорисовки объекта + /// + private DrawningPlane? _drawningPlane; + + /// + /// Стратегия перемещения + /// + private AbstractStrategy? _strategy; + + /// + /// Получение объекта + /// + public DrawningPlane SetPlane + { + set + { + _drawningPlane = value; + _drawningPlane.SetPictureSize(pictureBoxSeaplane.Width, pictureBoxSeaplane.Height); + comboBoxStrategy.Enabled = true; + _strategy = null; + Draw(); + } + } + + /// + /// Конструктор формы + /// + public FormSeaplane() + { + InitializeComponent(); + _strategy = null; + } + + /// + /// Метод прорисовки самолёта + /// + private void Draw() + { + if (_drawningPlane == null) + { + return; + } + Bitmap bmp = new(pictureBoxSeaplane.Width, pictureBoxSeaplane.Height); + Graphics gr = Graphics.FromImage(bmp); + _drawningPlane.DrawTransport(gr); + pictureBoxSeaplane.Image = bmp; + } + + /// + /// Перемещение объекта по форме (нажатие кнопок навигации) + /// + /// + /// + private void ButtonMove_Click(object sender, EventArgs e) + { + if (_drawningPlane == null) + { + return; + } + string name = ((Button)sender)?.Name ?? string.Empty; + bool result = false; + switch (name) + { + case "buttonUp": + result = _drawningPlane.MoveTransport(DirectionType.Up); + break; + case "buttonDown": + result = _drawningPlane.MoveTransport(DirectionType.Down); + break; + case "buttonLeft": + result = _drawningPlane.MoveTransport(DirectionType.Left); + break; + case "buttonRight": + result = _drawningPlane.MoveTransport(DirectionType.Right); + break; + } + if (result) + { + Draw(); + } + } + + /// + /// Обработка нажатия кнопки "Шаг" + /// + /// + /// + private void ButtonStrategyStep_Click(object sender, EventArgs e) + { + if (_drawningPlane == null) + { + return; + } + + if (comboBoxStrategy.Enabled) + { + _strategy = comboBoxStrategy.SelectedIndex switch + { + 0 => new MoveToCenter(), + 1 => new MoveToBorder(), + _ => null, + }; + if (_strategy == null) + { + return; + } + _strategy.SetData(new MoveablePlane(_drawningPlane), pictureBoxSeaplane.Width, pictureBoxSeaplane.Height); + } + + if (_strategy == null) + { + return; + } + + comboBoxStrategy.Enabled = false; + _strategy.MakeStep(); + Draw(); + + if (_strategy.GetStatus() == StrategyStatus.Finish) + { + comboBoxStrategy.Enabled = true; + _strategy = null; + } + } +} diff --git a/ProjectSeaplane/ProjectSeaplane/FormSeaplane.resx b/ProjectSeaplane/ProjectSeaplane/FormSeaplane.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/FormSeaplane.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/MovementStrategy/AbstractStrategy.cs b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/AbstractStrategy.cs new file mode 100644 index 0000000..2750643 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/AbstractStrategy.cs @@ -0,0 +1,138 @@ +namespace ProjectSeaplane.MovementStrategy; + +/// +/// Класс перемещения объекта +/// +public abstract class AbstractStrategy +{ + /// + /// Перемещаемый объект + /// + private IMoveableObject? _moveableObject; + + /// + /// Статус перемещения + /// + private StrategyStatus _state = StrategyStatus.NotInit; + + /// + /// Ширина поля + /// + protected int FieldWidth { get; private set; } + + /// + /// Высота поля + /// + protected int FieldHeight { get; private set; } + + /// + /// Статус перемещения + /// + public StrategyStatus GetStatus() { return _state; } + + /// + /// Установка данных + /// + /// Перемещаемый объект + /// Ширина поля + /// Высота поля + public void SetData(IMoveableObject moveableObject, int width, int height) + { + if (moveableObject == null) + { + _state = StrategyStatus.NotInit; + return; + } + + _state = StrategyStatus.InProgress; + _moveableObject = moveableObject; + FieldWidth = width; + FieldHeight = height; + } + + /// + /// Шаг перемещения + /// + public void MakeStep() + { + if (_state != StrategyStatus.InProgress) + { + return; + } + + if (IsTargetDestinaion()) + { + _state = StrategyStatus.Finish; + return; + } + + MoveToTarget(); + } + + /// + /// Перемещение влево + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveLeft() => MoveTo(MovementDirection.Left); + + /// + /// Перемещение вправо + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveRight() => MoveTo(MovementDirection.Right); + + /// + /// Перемещение вверх + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveUp() => MoveTo(MovementDirection.Up); + + /// + /// Перемещение вниз + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveDown() => MoveTo(MovementDirection.Down); + + /// + /// Параметры объекта + /// + protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition; + + /// + /// Шаг объекта + /// + /// + protected int? GetStep() + { + if (_state != StrategyStatus.InProgress) + { + return null; + } + return _moveableObject?.GetStep; + } + + /// + /// Перемещение к цели + /// + protected abstract void MoveToTarget(); + + /// + /// Достигнута ли цель + /// + /// + protected abstract bool IsTargetDestinaion(); + + /// + /// Попытка перемещения в требуемом направлении + /// + /// Направление + /// Результат попытки (true - удалось переместиться, false - неудача) + private bool MoveTo(MovementDirection movementDirection) + { + if (_state != StrategyStatus.InProgress) + { + return false; + } + return _moveableObject?.TryMoveObject(movementDirection) ?? false; + } +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/MovementStrategy/IMoveableObject.cs b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/IMoveableObject.cs new file mode 100644 index 0000000..2e61bb1 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/IMoveableObject.cs @@ -0,0 +1,24 @@ +namespace ProjectSeaplane.MovementStrategy; + +/// +/// Интерфейс для работы с перемещаемым объектом +/// +public interface IMoveableObject +{ + /// + /// Получение координаты объекта + /// + ObjectParameters? GetObjectPosition { get; } + + /// + /// Шаг объекта + /// + int GetStep { get; } + + /// + /// Попытка переместить объект в указанном направлении + /// + /// Направление + /// true - объект перемещен, false - перемещение невозможно + bool TryMoveObject(MovementDirection direction); +} diff --git a/ProjectSeaplane/ProjectSeaplane/MovementStrategy/MoveToBorder.cs b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/MoveToBorder.cs new file mode 100644 index 0000000..2b3c748 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/MoveToBorder.cs @@ -0,0 +1,51 @@ +namespace ProjectSeaplane.MovementStrategy; + +/// +/// Стратегия перемещения объекта в угол экрана +/// + +public class MoveToBorder : AbstractStrategy +{ + protected override bool IsTargetDestinaion() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return false; + } + return objParams.RightBorder + GetStep() >= FieldWidth && objParams.DownBorder + GetStep() >= FieldHeight; + } + + protected override void MoveToTarget() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return; + } + int diffX = objParams.RightBorder - FieldWidth; + if (Math.Abs(diffX) > GetStep()) + { + if (diffX > 0) + { + MoveLeft(); + } + else + { + MoveRight(); + } + } + int diffY = objParams.DownBorder - FieldHeight; + if (Math.Abs(diffY) > GetStep()) + { + if (diffY > 0) + { + MoveUp(); + } + else + { + MoveDown(); + } + } + } +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/MovementStrategy/MoveToCenter.cs b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/MoveToCenter.cs new file mode 100644 index 0000000..12012c2 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/MoveToCenter.cs @@ -0,0 +1,50 @@ +namespace ProjectSeaplane.MovementStrategy; + +/// +/// Стратегия перемещения объекта в центр экрана +/// +public class MoveToCenter : AbstractStrategy +{ + protected override bool IsTargetDestinaion() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return false; + } + 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() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return; + } + int diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2; + if (Math.Abs(diffX) > GetStep()) + { + if (diffX > 0) + { + MoveLeft(); + } + else + { + MoveRight(); + } + } + int diffY = objParams.ObjectMiddleVertical - FieldHeight / 2; + if (Math.Abs(diffY) > GetStep()) + { + if (diffY > 0) + { + MoveUp(); + } + else + { + MoveDown(); + } + } + } +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/MovementStrategy/MoveablePlane.cs b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/MoveablePlane.cs new file mode 100644 index 0000000..e9852e1 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/MoveablePlane.cs @@ -0,0 +1,61 @@ +using ProjectSeaplane.Drawnings; + +namespace ProjectSeaplane.MovementStrategy; + +/// +/// Класс-реализация IMoveableObject с использованием DrawningPlane +/// +public class MoveablePlane : IMoveableObject +{ + /// + /// Поле-объект класса DrawningPlane или его наследника + /// + private readonly DrawningPlane? _plane = null; + + /// + /// Конструктор + /// + /// Объект класса DrawningPlane + public MoveablePlane(DrawningPlane plane) + { + _plane = plane; + } + public ObjectParameters? GetObjectPosition + { + get + { + if (_plane == null || _plane.EntityPlane == null || !_plane.GetPosX.HasValue || !_plane.GetPosY.HasValue) + { + return null; + } + return new ObjectParameters(_plane.GetPosX.Value, _plane.GetPosY.Value, _plane.GetWidth, _plane.GetHeight); + } + } + public int GetStep => (int)(_plane?.EntityPlane?.Step ?? 0); + public bool TryMoveObject(MovementDirection direction) + { + if (_plane == null || _plane.EntityPlane == null) + { + return false; + } + return _plane.MoveTransport(GetDirectionType(direction)); + } + + /// + /// Конвертация из MovementDirection в DirectionType + /// + /// MovementDirection + /// DirectionType + private static DirectionType GetDirectionType(MovementDirection direction) + { + return direction switch + { + MovementDirection.Left => DirectionType.Left, + MovementDirection.Right => DirectionType.Right, + MovementDirection.Up => DirectionType.Up, + MovementDirection.Down => DirectionType.Down, + _ => DirectionType.Unknow, + }; + } + +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/MovementStrategy/MovementDirection.cs b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/MovementDirection.cs new file mode 100644 index 0000000..07ff2e8 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/MovementDirection.cs @@ -0,0 +1,32 @@ +namespace ProjectSeaplane.MovementStrategy; + +/// +/// Направление перемещения +/// +public enum MovementDirection +{ + /// + /// Неизвестное направление + /// + Unknow = -1, + + /// + /// Вверх + /// + Up = 1, + + /// + /// Вниз + /// + Down = 2, + + /// + /// Влево + /// + Left = 3, + + /// + /// Вправо + /// + Right = 4 +} diff --git a/ProjectSeaplane/ProjectSeaplane/MovementStrategy/ObjectParameters.cs b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/ObjectParameters.cs new file mode 100644 index 0000000..ba982d9 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/ObjectParameters.cs @@ -0,0 +1,72 @@ +namespace ProjectSeaplane.MovementStrategy; + +/// +/// Параметры-координаты объекта +/// +public class ObjectParameters +{ + /// + /// Координата X + /// + private readonly int _x; + + /// + /// Координата Y + /// + private readonly int _y; + + /// + /// Ширина объекта + /// + private readonly int _width; + + /// + /// Высота объекта + /// + private readonly int _height; + + /// + /// Левая граница + /// + public int LeftBorder => _x; + + /// + /// Верхняя граница + /// + public int TopBorder => _y; + + /// + /// Правая граница + /// + public int RightBorder => _x + _width; + + /// + /// Нижняя граница + /// + public int DownBorder => _y + _height; + + /// + /// Середина объекта + /// + public int ObjectMiddleHorizontal => _x + _width / 2; + + /// + /// Середина объекта + /// + public int ObjectMiddleVertical => _y + _height / 2; + + /// + /// Конструктор + /// + /// Координата X + /// Координата Y + /// Ширина объекта + /// Высота объекта + public ObjectParameters(int x, int y, int width, int height) + { + _x = x; + _y = y; + _width = width; + _height = height; + } +} \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/MovementStrategy/StrategyStatus.cs b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/StrategyStatus.cs new file mode 100644 index 0000000..020c989 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/MovementStrategy/StrategyStatus.cs @@ -0,0 +1,22 @@ +namespace ProjectSeaplane.MovementStrategy; + +/// +/// Статус выполнения операции перемещения +/// +public enum StrategyStatus +{ + /// + /// Все готово к началу + /// + NotInit, + + /// + /// Выполняется + /// + InProgress, + + /// + /// Завершено + /// + Finish +} diff --git a/ProjectSeaplane/ProjectSeaplane/Program.cs b/ProjectSeaplane/ProjectSeaplane/Program.cs index bcf84b2..0b08fb7 100644 --- a/ProjectSeaplane/ProjectSeaplane/Program.cs +++ b/ProjectSeaplane/ProjectSeaplane/Program.cs @@ -11,7 +11,7 @@ namespace ProjectSeaplane // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); + Application.Run(new FormPlaneCollection()); } } } \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/ProjectSeaplane.csproj b/ProjectSeaplane/ProjectSeaplane/ProjectSeaplane.csproj index e1a0735..244387d 100644 --- a/ProjectSeaplane/ProjectSeaplane/ProjectSeaplane.csproj +++ b/ProjectSeaplane/ProjectSeaplane/ProjectSeaplane.csproj @@ -8,4 +8,19 @@ enable + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/Properties/Resources.Designer.cs b/ProjectSeaplane/ProjectSeaplane/Properties/Resources.Designer.cs new file mode 100644 index 0000000..ff77389 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ProjectSeaplane.Properties { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectSeaplane.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrow_down { + get { + object obj = ResourceManager.GetObject("arrow_down", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrow_left { + get { + object obj = ResourceManager.GetObject("arrow_left", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrow_right { + get { + object obj = ResourceManager.GetObject("arrow_right", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrow_up { + get { + object obj = ResourceManager.GetObject("arrow_up", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/ProjectSeaplane/ProjectSeaplane/Properties/Resources.resx b/ProjectSeaplane/ProjectSeaplane/Properties/Resources.resx new file mode 100644 index 0000000..47aca23 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/Properties/Resources.resx @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\arrow_down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\arrow_left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\arrow_right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\arrow_up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ProjectSeaplane/ProjectSeaplane/Resources/arrow_down.png b/ProjectSeaplane/ProjectSeaplane/Resources/arrow_down.png new file mode 100644 index 0000000..769dc0c Binary files /dev/null and b/ProjectSeaplane/ProjectSeaplane/Resources/arrow_down.png differ diff --git a/ProjectSeaplane/ProjectSeaplane/Resources/arrow_left.png b/ProjectSeaplane/ProjectSeaplane/Resources/arrow_left.png new file mode 100644 index 0000000..2460900 Binary files /dev/null and b/ProjectSeaplane/ProjectSeaplane/Resources/arrow_left.png differ diff --git a/ProjectSeaplane/ProjectSeaplane/Resources/arrow_right.png b/ProjectSeaplane/ProjectSeaplane/Resources/arrow_right.png new file mode 100644 index 0000000..6536fe7 Binary files /dev/null and b/ProjectSeaplane/ProjectSeaplane/Resources/arrow_right.png differ diff --git a/ProjectSeaplane/ProjectSeaplane/Resources/arrow_up.png b/ProjectSeaplane/ProjectSeaplane/Resources/arrow_up.png new file mode 100644 index 0000000..a49e00a Binary files /dev/null and b/ProjectSeaplane/ProjectSeaplane/Resources/arrow_up.png differ