Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
6dcc2b89b7 | ||
|
d3ebbc092d | ||
|
dd60ab3219 | ||
|
f74d8a8bd3 | ||
|
26e0d00ce5 | ||
|
bf7cfe1f84 | ||
|
d215fc5864 | ||
|
692f1a21c1 | ||
|
2f34b4bdcf | ||
|
71156a3ec2 | ||
|
18baaa5880 | ||
|
4ef5a5cac1 |
16
ProjectAirFighter/ProjectAirFighter/AdNum.cs
Normal file
16
ProjectAirFighter/ProjectAirFighter/AdNum.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using ProjectAirFighter.Drawning;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection.Metadata.Ecma335;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter;
|
||||||
|
|
||||||
|
public class AdNum<T>
|
||||||
|
where T : DrawningAirFighter
|
||||||
|
{
|
||||||
|
public void Nothing(){
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,116 @@
|
|||||||
|
using ProjectAirFighter.CollectionGenericObject;
|
||||||
|
using ProjectAirFighter.Drawning;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.CollectionGenericObjects;
|
||||||
|
|
||||||
|
public abstract class AbstractCompany
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Размер места(ширина)
|
||||||
|
/// </summary>
|
||||||
|
public readonly int _placeSizeWidth = 140;
|
||||||
|
/// <summary>
|
||||||
|
/// Размер места(высота)
|
||||||
|
/// </summary>
|
||||||
|
public readonly int _placeSizeHeight = 160;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина окна
|
||||||
|
/// </summary>
|
||||||
|
protected readonly int _pictureWidth;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Высота окна
|
||||||
|
/// </summary>
|
||||||
|
protected readonly int _pictureHeight;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Коллекция военных самолетов
|
||||||
|
/// </summary>
|
||||||
|
protected ICollectionGenericObjects<DrawningWarPlane> _collection = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вычисление максимального количества элементов, которые можно разместить в окне
|
||||||
|
/// </summary>
|
||||||
|
private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _placeSizeHeight);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="picWidth">Ширина окна</param>
|
||||||
|
/// <param name="picHeight">Высота окна</param>
|
||||||
|
/// <param name="collection">Коллекция военных самолетов</param>
|
||||||
|
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningWarPlane> collection)
|
||||||
|
{
|
||||||
|
_pictureWidth = picWidth;
|
||||||
|
_pictureHeight = picHeight;
|
||||||
|
_collection = collection;
|
||||||
|
_collection.SetMaxCount = GetMaxCount - 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перегрузка оператора сложения для класса
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="company"></param>
|
||||||
|
/// <param name="warPlane"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int operator +(AbstractCompany company, DrawningWarPlane warPlane)
|
||||||
|
{
|
||||||
|
return company._collection.Insert(warPlane);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перегрузка оператора удаление для класса
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="company"></param>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static DrawningWarPlane operator -(AbstractCompany company, int position)
|
||||||
|
{
|
||||||
|
return company._collection.Remove(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Получение случайного объекта из коллекции
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DrawningWarPlane? GetRandomObject()
|
||||||
|
{
|
||||||
|
Random rnd = new();
|
||||||
|
return _collection?.Get(rnd.Next(GetMaxCount));
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Вывод всей коллекции
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
DrawningWarPlane? obj = _collection?.Get(i);
|
||||||
|
obj?.DrawTransport(graphics);
|
||||||
|
}
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вывод заднего фона
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
protected abstract void DrawBackgound(Graphics g);
|
||||||
|
/// <summary>
|
||||||
|
/// Расстановка объектов
|
||||||
|
/// </summary>
|
||||||
|
protected abstract void SetObjectsPosition();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.CollectionGenericObjects;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перечисление типов коллекции
|
||||||
|
/// </summary>
|
||||||
|
public enum CollectionType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Неопределено
|
||||||
|
/// </summary>
|
||||||
|
None = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Массив
|
||||||
|
/// </summary>
|
||||||
|
Massive = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Список
|
||||||
|
/// </summary>
|
||||||
|
List = 2
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.CollectionGenericObject;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Интерфейс описания действий для набора хранимых объектов
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
public interface ICollectionGenericObjects<T>
|
||||||
|
where T : class
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Колличество объектов в коллекции
|
||||||
|
/// </summary>
|
||||||
|
int Count { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///Установка максимального количества элементов
|
||||||
|
/// </summary>
|
||||||
|
int SetMaxCount { set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление объекта в коллекцию
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Добавляемы объект</param>
|
||||||
|
/// <returns>true - вставка прошла успешно, false - вставка не удалась</returns>
|
||||||
|
int Insert(T obj);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление объекта в коллекцию на конкретную позицию
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Добавляемы объект</param>
|
||||||
|
/// <param name="position">Позиция</param>
|
||||||
|
/// <returns>true - вставка прошла успешно, false - вставка не удалась</returns>
|
||||||
|
int Insert(T obj, int position);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление объекта из коллекции с конкретной позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position">Позиция</param>
|
||||||
|
/// <returns>true - удаление прошло успешно, false - удаление не удалось</returns>
|
||||||
|
T? Remove(int position);
|
||||||
|
/// <summary>
|
||||||
|
/// Получение объекта по позции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
T? Get(int position);
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
using ProjectAirFighter.CollectionGenericObject;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
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 (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? temp = _collection[position];
|
||||||
|
_collection.RemoveAt(position);
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,121 @@
|
|||||||
|
using ProjectAirFighter.CollectionGenericObject;
|
||||||
|
using ProjectAirFighter.CollectionGenericObjects;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.CollectionGenericObjects;
|
||||||
|
/// <summary>
|
||||||
|
/// Параметризованный набор объектов
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">Параметр: ограничение - ссылочный тип</typeparam>
|
||||||
|
public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
||||||
|
where T : class
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Массив объектов, которые хроним
|
||||||
|
/// </summary>
|
||||||
|
private T?[] _collection;
|
||||||
|
|
||||||
|
public int Count => _collection.Length;
|
||||||
|
|
||||||
|
public int SetMaxCount
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value > 0)
|
||||||
|
{
|
||||||
|
if (Count > 0)
|
||||||
|
{
|
||||||
|
Array.Resize(ref _collection, value);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_collection = new T?[value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
public MassiveGenericObjects()
|
||||||
|
{
|
||||||
|
_collection = Array.Empty<T?>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public T? Get(int position)
|
||||||
|
{
|
||||||
|
if (position >= 0 && position < Count)
|
||||||
|
{
|
||||||
|
return _collection[position];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Insert(T obj)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Count; i++)
|
||||||
|
{
|
||||||
|
if (_collection[i] == null)
|
||||||
|
{
|
||||||
|
_collection[i] = obj;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Insert(T obj, int position)
|
||||||
|
{
|
||||||
|
if (position < 0 || position >= Count)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (_collection[position] == null)
|
||||||
|
{
|
||||||
|
_collection[position] = obj;
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
int temp = position + 1;
|
||||||
|
while (temp < Count)
|
||||||
|
{
|
||||||
|
if (_collection[temp] == null)
|
||||||
|
{
|
||||||
|
_collection[temp] = obj;
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
temp++;
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = position - 1;
|
||||||
|
while (temp > 0)
|
||||||
|
{
|
||||||
|
if (_collection[temp] == null)
|
||||||
|
{
|
||||||
|
_collection[temp] = obj;
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
temp--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T? Remove(int position)
|
||||||
|
{
|
||||||
|
if (position < 0 || position >= Count)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (_collection[position] == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
T? temp = _collection[position];
|
||||||
|
_collection[position] = null;
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
using ProjectAirFighter.CollectionGenericObject;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.CollectionGenericObjects;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-хранилище коллекций
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
public class StorageCollection<T>
|
||||||
|
where T : class
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Словарь (хранилище) с коллекциями
|
||||||
|
/// </summary>
|
||||||
|
private Dictionary<string, ICollectionGenericObjects<T>> _storages;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Возвращение списка названий коллекций
|
||||||
|
/// </summary>
|
||||||
|
public List<string> Keys => _storages.Keys.ToList();
|
||||||
|
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICollectionGenericObjects<T>? this[int index]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
//логика получения объекта
|
||||||
|
if (index > Keys.Count || index < 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return _storages[Keys[index]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
using ProjectAirFighter.CollectionGenericObject;
|
||||||
|
using ProjectAirFighter.Drawning;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.CollectionGenericObjects;
|
||||||
|
|
||||||
|
public class WarPlaneBase : AbstractCompany
|
||||||
|
{
|
||||||
|
public WarPlaneBase(int picWidth, int picHeight, ICollectionGenericObjects<DrawningWarPlane> collection) : base(picWidth, picHeight, collection)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void DrawBackgound(Graphics g)
|
||||||
|
{
|
||||||
|
Pen pen = new(Color.Black, 3);
|
||||||
|
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; j++)
|
||||||
|
{
|
||||||
|
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth - 20, j * _placeSizeHeight);
|
||||||
|
}
|
||||||
|
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void SetObjectsPosition()
|
||||||
|
{
|
||||||
|
int width = _pictureWidth / _placeSizeWidth;
|
||||||
|
int height = _pictureHeight / _placeSizeHeight;
|
||||||
|
|
||||||
|
int curWidth = width - 1;
|
||||||
|
int curHeight = height - 1;
|
||||||
|
|
||||||
|
for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
||||||
|
{
|
||||||
|
if (_collection.Get(i) != null)
|
||||||
|
{
|
||||||
|
_collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
|
||||||
|
_collection.Get(i).SetPosition(_placeSizeWidth * curWidth + 10, curHeight * _placeSizeHeight + 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curWidth > 0)
|
||||||
|
curWidth--;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curHeight--;
|
||||||
|
curWidth = width - 1;
|
||||||
|
}
|
||||||
|
if (curHeight < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
namespace ProjectAirFighter.Drawning;
|
||||||
|
/// <summary>
|
||||||
|
/// Направление перемещения
|
||||||
|
/// </summary>
|
||||||
|
public enum DirectionType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Неизвестное напрвление
|
||||||
|
/// </summary>
|
||||||
|
Unknow = -1,
|
||||||
|
/// <summary>
|
||||||
|
/// Вверх
|
||||||
|
/// </summary>
|
||||||
|
Up = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вниз
|
||||||
|
/// </summary>
|
||||||
|
Down = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Влево
|
||||||
|
/// </summary>
|
||||||
|
Left = 3,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вправо
|
||||||
|
/// </summary>
|
||||||
|
Right = 4
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
using System.Net.NetworkInformation;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using ProjectAirFighter.Entities;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.Drawning;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// класс отвечающий за прорисовку и перемещение объекта-сущности
|
||||||
|
/// </summary>
|
||||||
|
public class DrawningAirFighter : DrawningWarPlane
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
|
/// <param name="bodyKit">Признак наличия корпуса</param>
|
||||||
|
/// <param name="rocket">Признак наличия рокет</param>
|
||||||
|
/// <param name="additionalWing">Признак наличия дополнительных крыльев</param>
|
||||||
|
//public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool rocket, bool additionalWing)
|
||||||
|
public DrawningAirFighter(int speed, double weight, Color bodyColor, Color additionalColor, bool rocket, bool additionalWing) : base(120,140)
|
||||||
|
{
|
||||||
|
EntityWarPlane = new EntityAirFighter(speed, weight, bodyColor, additionalColor, rocket, additionalWing);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DrawTransport(Graphics g)
|
||||||
|
{
|
||||||
|
if (EntityWarPlane == null || EntityWarPlane is not EntityAirFighter warPlane||!_startPosX.HasValue || !_startPosY.HasValue)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Pen pen = new(Color.Black, 3);
|
||||||
|
Pen pen_rocket = new(Color.Black);
|
||||||
|
|
||||||
|
Brush brAdd = new SolidBrush(warPlane.AdditionalColor);
|
||||||
|
|
||||||
|
//ракеты
|
||||||
|
if (warPlane.Rocket)
|
||||||
|
{
|
||||||
|
Point[] FirstRocket = { new Point(_startPosX.Value + 55, _startPosY.Value + 110), new Point(_startPosX.Value + 95, _startPosY.Value + 110),
|
||||||
|
new Point(_startPosX.Value + 105, _startPosY.Value + 115),new Point(_startPosX.Value + 95, _startPosY.Value + 120),
|
||||||
|
new Point(_startPosX.Value + 55, _startPosY.Value + 120) };
|
||||||
|
g.DrawPolygon(pen_rocket, FirstRocket);
|
||||||
|
Point[] SecondRocket = { new Point(_startPosX.Value + 55, _startPosY.Value + 30), new Point(_startPosX.Value + 95, _startPosY.Value + 30),
|
||||||
|
new Point(_startPosX.Value + 105, _startPosY.Value + 35),new Point(_startPosX.Value + 95, _startPosY.Value + 40),
|
||||||
|
new Point(_startPosX.Value + 55, _startPosY.Value + 40) };
|
||||||
|
g.DrawPolygon(pen_rocket, SecondRocket);
|
||||||
|
|
||||||
|
g.FillPolygon(brAdd, FirstRocket);
|
||||||
|
g.FillPolygon(brAdd, SecondRocket);
|
||||||
|
}
|
||||||
|
base.DrawTransport(g);
|
||||||
|
if (warPlane.AdditionalWing)
|
||||||
|
{
|
||||||
|
Point[] AddWingLower = { new Point(_startPosX.Value + 60, _startPosY.Value + 80),
|
||||||
|
new Point(_startPosX.Value + 60, _startPosY.Value + 140), new Point(_startPosX.Value + 50, _startPosY.Value + 140),
|
||||||
|
new Point(_startPosX.Value + 40, _startPosY.Value + 80) };
|
||||||
|
g.DrawPolygon(pen, AddWingLower);
|
||||||
|
|
||||||
|
Point[] AddWingUpper = { new Point(_startPosX.Value + 60, _startPosY.Value + 60), new Point(_startPosX.Value + 60, _startPosY.Value),
|
||||||
|
new Point(_startPosX.Value + 50, _startPosY.Value), new Point(_startPosX.Value + 40, _startPosY.Value + 60) };
|
||||||
|
g.DrawPolygon(pen, AddWingUpper);
|
||||||
|
|
||||||
|
g.FillPolygon(brAdd, AddWingUpper);
|
||||||
|
g.FillPolygon(brAdd, AddWingLower);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
269
ProjectAirFighter/ProjectAirFighter/Drawning/DrawningWarPlane.cs
Normal file
269
ProjectAirFighter/ProjectAirFighter/Drawning/DrawningWarPlane.cs
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
using ProjectAirFighter.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.Drawning;
|
||||||
|
|
||||||
|
public class DrawningWarPlane
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-сущность
|
||||||
|
/// </summary>
|
||||||
|
public EntityWarPlane? EntityWarPlane { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина окна
|
||||||
|
/// </summary>
|
||||||
|
private int? _pictureWidth;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Высота окна
|
||||||
|
/// </summary>
|
||||||
|
private int? _pictureHeight;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Левая координата прорисовки самолета
|
||||||
|
/// </summary>
|
||||||
|
protected int? _startPosX;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Верхняя координата прорисовки самолета
|
||||||
|
/// </summary>
|
||||||
|
protected int? _startPosY;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина прорисовки самолета
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _drawningWarPlaneWidth = 120;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Высота прорисовки самолета
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _drawningWarPlaneHeight = 140;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Координаты X объекта
|
||||||
|
/// </summary>
|
||||||
|
public int? GetPosX => _startPosX;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Координаты Y объекта
|
||||||
|
/// </summary>
|
||||||
|
public int? GetPosY => _startPosY;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Высота объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetHeight => _drawningWarPlaneHeight;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetWigdth => _drawningWarPlaneWidth;
|
||||||
|
private DrawningWarPlane()
|
||||||
|
{
|
||||||
|
_pictureHeight = null;
|
||||||
|
_pictureWidth = null;
|
||||||
|
_startPosX = null;
|
||||||
|
_startPosY = null;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
public DrawningWarPlane(int speed, double weight, Color bodyColor) : this()
|
||||||
|
{
|
||||||
|
EntityWarPlane = new EntityWarPlane(speed, weight, bodyColor);
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор для наслдеников
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="drawningWarPlaneHeight">Высота прорисовки самолета</param>
|
||||||
|
/// <param name="drawningWarPlaneWidth">Ширина прорисовки самолета</param>
|
||||||
|
public DrawningWarPlane(int drawningWarPlaneWidth, int drawningWarPlaneHeight) : this()
|
||||||
|
{
|
||||||
|
_drawningWarPlaneWidth = drawningWarPlaneWidth;
|
||||||
|
_drawningWarPlaneHeight = drawningWarPlaneHeight;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Установка границ поля
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="width">Ширина поля</param>
|
||||||
|
/// <param name="height">Высота поля</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool SetPictureSize(int width, int height)
|
||||||
|
{
|
||||||
|
if (width > _drawningWarPlaneWidth && height > _drawningWarPlaneHeight)
|
||||||
|
{
|
||||||
|
_pictureWidth = width;
|
||||||
|
_pictureHeight = height;
|
||||||
|
if (_startPosX != null && _startPosY != null)
|
||||||
|
{
|
||||||
|
if (_startPosX.Value < 0)
|
||||||
|
{
|
||||||
|
_startPosX = 0;
|
||||||
|
}
|
||||||
|
if (_startPosY.Value < 0)
|
||||||
|
{
|
||||||
|
_startPosY = 0;
|
||||||
|
}
|
||||||
|
if (_startPosX.Value + _drawningWarPlaneWidth > _pictureWidth)
|
||||||
|
{
|
||||||
|
_startPosX = _pictureWidth - _drawningWarPlaneWidth;
|
||||||
|
}
|
||||||
|
if (_startPosY.Value + _drawningWarPlaneHeight > _pictureHeight)
|
||||||
|
{
|
||||||
|
_startPosY = _pictureHeight - _drawningWarPlaneHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Установка позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">Координата X</param>
|
||||||
|
/// <param name="y">Координата Y</param>
|
||||||
|
public void SetPosition(int x, int y)
|
||||||
|
{
|
||||||
|
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_startPosX = x;
|
||||||
|
_startPosY = y;
|
||||||
|
if (_startPosX.Value < 0)
|
||||||
|
{
|
||||||
|
_startPosX = 0;
|
||||||
|
}
|
||||||
|
if (_startPosY.Value < 0)
|
||||||
|
{
|
||||||
|
_startPosY = 0;
|
||||||
|
}
|
||||||
|
if (_startPosX + _drawningWarPlaneWidth > _pictureWidth)
|
||||||
|
{
|
||||||
|
_startPosX = _pictureWidth - _drawningWarPlaneWidth;
|
||||||
|
}
|
||||||
|
if (_startPosY + _drawningWarPlaneHeight > _pictureHeight)
|
||||||
|
{
|
||||||
|
_startPosY = _pictureHeight - _drawningWarPlaneHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Изменение направления перемещения
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction">Направление</param>
|
||||||
|
/// <returns>true - перемещение выполнено, false - перемещение невозможно </returns>
|
||||||
|
public virtual bool MoveTransport(DirectionType direction)
|
||||||
|
{
|
||||||
|
if (EntityWarPlane == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
//влево
|
||||||
|
case DirectionType.Left:
|
||||||
|
if (_startPosX.Value - EntityWarPlane.Step > 0)
|
||||||
|
{
|
||||||
|
_startPosX -= (int)EntityWarPlane.Step;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
//вверх
|
||||||
|
case DirectionType.Up:
|
||||||
|
if (_startPosY.Value - EntityWarPlane.Step > 0)
|
||||||
|
{
|
||||||
|
_startPosY -= (int)EntityWarPlane.Step;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
//вниз
|
||||||
|
case DirectionType.Down:
|
||||||
|
if (_startPosY.Value + EntityWarPlane.Step + _drawningWarPlaneWidth < _pictureHeight)
|
||||||
|
{
|
||||||
|
_startPosY += (int)EntityWarPlane.Step;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
//вправо
|
||||||
|
case DirectionType.Right:
|
||||||
|
if (_startPosX.Value + EntityWarPlane.Step + _drawningWarPlaneWidth < _pictureWidth)
|
||||||
|
{
|
||||||
|
_startPosX += (int)EntityWarPlane.Step;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void DrawTransport(Graphics g)
|
||||||
|
{
|
||||||
|
if (EntityWarPlane == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pen pen = new(Color.Black, 3);
|
||||||
|
Pen pen_rocket = new(Color.Black);
|
||||||
|
|
||||||
|
//корпус
|
||||||
|
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 60, 100, 20);
|
||||||
|
Point[] body = { new Point(_startPosX.Value + 100, _startPosY.Value + 80),
|
||||||
|
new Point(_startPosX.Value + 120, _startPosY.Value + 70), new Point(_startPosX.Value + 100, _startPosY.Value + 60) };
|
||||||
|
g.DrawPolygon(pen, body);
|
||||||
|
//нижнее крыло
|
||||||
|
Point[] wingUpper = { new Point(_startPosX.Value + 80, _startPosY.Value + 80),
|
||||||
|
new Point(_startPosX.Value + 80, _startPosY.Value + 140), new Point(_startPosX.Value + 70, _startPosY.Value + 140),
|
||||||
|
new Point(_startPosX.Value + 60, _startPosY.Value + 80) };
|
||||||
|
g.DrawPolygon(pen, wingUpper);
|
||||||
|
//верхнее крыло
|
||||||
|
Point[] wingLower = { new Point(_startPosX.Value + 80, _startPosY.Value + 60), new Point(_startPosX.Value + 80, _startPosY.Value),
|
||||||
|
new Point(_startPosX.Value + 70, _startPosY.Value), new Point(_startPosX.Value + 60, _startPosY.Value + 60) };
|
||||||
|
g.DrawPolygon(pen, wingLower);
|
||||||
|
//задние крылья
|
||||||
|
//верхнее
|
||||||
|
Point[] rearWingUpper = { new Point(_startPosX.Value, _startPosY.Value + 60), new Point(_startPosX.Value, _startPosY.Value + 30),
|
||||||
|
new Point(_startPosX.Value + 25, _startPosY.Value + 50), new Point(_startPosX.Value + 25, _startPosY.Value + 60)};
|
||||||
|
g.DrawPolygon(pen, rearWingUpper);
|
||||||
|
//нижнее
|
||||||
|
Point[] rearWingLower = { new Point(_startPosX.Value, _startPosY.Value + 80),
|
||||||
|
new Point(_startPosX.Value, _startPosY.Value + 110),new Point(_startPosX.Value + 25, _startPosY.Value + 90),
|
||||||
|
new Point(_startPosX.Value + 25, _startPosY.Value + 80) };
|
||||||
|
g.DrawPolygon(pen, rearWingLower);
|
||||||
|
|
||||||
|
//залив носа
|
||||||
|
Brush brBlack = new SolidBrush(Color.Black);
|
||||||
|
g.FillPolygon(brBlack, body);
|
||||||
|
|
||||||
|
//залив корпуса
|
||||||
|
Brush br = new SolidBrush(EntityWarPlane.BodyColor);
|
||||||
|
g.FillRectangle(br, _startPosX.Value, _startPosY.Value + 60, 100, 20);
|
||||||
|
|
||||||
|
g.FillPolygon(br, wingLower);
|
||||||
|
g.FillPolygon(br, wingUpper);
|
||||||
|
g.FillPolygon(br, rearWingUpper);
|
||||||
|
g.FillPolygon(br, rearWingLower);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
namespace ProjectAirFighter.Entities;
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-сущность "Истребитель"
|
||||||
|
/// </summary>
|
||||||
|
public class EntityAirFighter : EntityWarPlane
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Скорость
|
||||||
|
/// </summary>
|
||||||
|
public int Speed { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вес
|
||||||
|
/// </summary>
|
||||||
|
public double Weight { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Основной цвет
|
||||||
|
/// </summary>
|
||||||
|
public Color BodyColor { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Дополнительный цвет
|
||||||
|
/// </summary>
|
||||||
|
public Color AdditionalColor { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Признак (опция) наличия ракет
|
||||||
|
/// </summary>
|
||||||
|
public bool Rocket { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Признак (опция) наличия дополнительных крыльев
|
||||||
|
/// </summary>
|
||||||
|
public bool AdditionalWing { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг
|
||||||
|
/// </summary>
|
||||||
|
public double Step => Speed * 100 / Weight;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Иницифлизация полей объекта-класса истребителя
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
|
/// <param name="rocket">Признак наличия рокет</param>
|
||||||
|
/// <param name="additionalWing">Признак наличия дополнительных крыльев</param>
|
||||||
|
public EntityAirFighter(int speed, double weight, Color bodyColor, Color additionalColor, bool rocket, bool additionalWing) :base(speed, weight, bodyColor)
|
||||||
|
{
|
||||||
|
|
||||||
|
AdditionalColor = additionalColor;
|
||||||
|
Rocket = rocket;
|
||||||
|
AdditionalWing = additionalWing;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
|||||||
|
namespace ProjectAirFighter.Entities;
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-сущность "Военный самолет"
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public class EntityWarPlane
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Скорость
|
||||||
|
/// </summary>
|
||||||
|
public int Speed { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вес
|
||||||
|
/// </summary>
|
||||||
|
public double Weight { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Основной цвет
|
||||||
|
/// </summary>
|
||||||
|
public Color BodyColor { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг
|
||||||
|
/// </summary>
|
||||||
|
public double Step => Speed * 100 / Weight;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор сущности
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
|
/// <param name="rocket">Признак наличия рокет</param>
|
||||||
|
/// <param name="additionalWing">Признак наличия дополнительных крыльев</param>
|
||||||
|
public EntityWarPlane(int speed, double weight, Color bodyColor)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
BodyColor = bodyColor;
|
||||||
|
}
|
||||||
|
}
|
@ -1,45 +0,0 @@
|
|||||||
namespace ProjectAirFighter
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// Form1
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(407, 301);
|
|
||||||
Name = "Form1";
|
|
||||||
Text = "Form1";
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace ProjectAirFighter
|
|
||||||
{
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
151
ProjectAirFighter/ProjectAirFighter/FormAirFighter.Designer.cs
generated
Normal file
151
ProjectAirFighter/ProjectAirFighter/FormAirFighter.Designer.cs
generated
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
namespace ProjectAirFighter
|
||||||
|
{
|
||||||
|
partial class FormAirFighter
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
pictureBoxAirFighter = new PictureBox();
|
||||||
|
buttonLeft = new Button();
|
||||||
|
buttonUp = new Button();
|
||||||
|
buttonDown = new Button();
|
||||||
|
buttonRight = new Button();
|
||||||
|
comboBoxStrategy = new ComboBox();
|
||||||
|
buttonStrategyStep = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxAirFighter).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// pictureBoxAirFighter
|
||||||
|
//
|
||||||
|
pictureBoxAirFighter.Dock = DockStyle.Fill;
|
||||||
|
pictureBoxAirFighter.Location = new Point(0, 0);
|
||||||
|
pictureBoxAirFighter.Name = "pictureBoxAirFighter";
|
||||||
|
pictureBoxAirFighter.Size = new Size(924, 557);
|
||||||
|
pictureBoxAirFighter.TabIndex = 0;
|
||||||
|
pictureBoxAirFighter.TabStop = false;
|
||||||
|
//
|
||||||
|
// buttonLeft
|
||||||
|
//
|
||||||
|
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonLeft.BackgroundImage = Properties.Resources.left;
|
||||||
|
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonLeft.Location = new Point(785, 510);
|
||||||
|
buttonLeft.Name = "buttonLeft";
|
||||||
|
buttonLeft.Size = new Size(35, 35);
|
||||||
|
buttonLeft.TabIndex = 2;
|
||||||
|
buttonLeft.UseVisualStyleBackColor = true;
|
||||||
|
buttonLeft.ClientSizeChanged += FormAirFighter_SizeChanged;
|
||||||
|
buttonLeft.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonUp
|
||||||
|
//
|
||||||
|
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonUp.BackgroundImage = Properties.Resources.up;
|
||||||
|
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonUp.Location = new Point(828, 469);
|
||||||
|
buttonUp.Name = "buttonUp";
|
||||||
|
buttonUp.Size = new Size(35, 35);
|
||||||
|
buttonUp.TabIndex = 3;
|
||||||
|
buttonUp.UseVisualStyleBackColor = true;
|
||||||
|
buttonUp.ClientSizeChanged += FormAirFighter_SizeChanged;
|
||||||
|
buttonUp.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonDown
|
||||||
|
//
|
||||||
|
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonDown.BackgroundImage = Properties.Resources.down;
|
||||||
|
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonDown.Location = new Point(828, 510);
|
||||||
|
buttonDown.Name = "buttonDown";
|
||||||
|
buttonDown.Size = new Size(35, 35);
|
||||||
|
buttonDown.TabIndex = 4;
|
||||||
|
buttonDown.UseVisualStyleBackColor = true;
|
||||||
|
buttonDown.ClientSizeChanged += FormAirFighter_SizeChanged;
|
||||||
|
buttonDown.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonRight
|
||||||
|
//
|
||||||
|
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonRight.BackgroundImage = Properties.Resources.right;
|
||||||
|
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonRight.Location = new Point(869, 510);
|
||||||
|
buttonRight.Name = "buttonRight";
|
||||||
|
buttonRight.Size = new Size(35, 35);
|
||||||
|
buttonRight.TabIndex = 5;
|
||||||
|
buttonRight.UseVisualStyleBackColor = true;
|
||||||
|
buttonRight.ClientSizeChanged += FormAirFighter_SizeChanged;
|
||||||
|
buttonRight.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// comboBoxStrategy
|
||||||
|
//
|
||||||
|
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxStrategy.FormattingEnabled = true;
|
||||||
|
comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К краю" });
|
||||||
|
comboBoxStrategy.Location = new Point(791, 12);
|
||||||
|
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||||
|
comboBoxStrategy.Size = new Size(121, 23);
|
||||||
|
comboBoxStrategy.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// buttonStrategyStep
|
||||||
|
//
|
||||||
|
buttonStrategyStep.Location = new Point(829, 41);
|
||||||
|
buttonStrategyStep.Name = "buttonStrategyStep";
|
||||||
|
buttonStrategyStep.Size = new Size(75, 23);
|
||||||
|
buttonStrategyStep.TabIndex = 8;
|
||||||
|
buttonStrategyStep.Text = "Шаг";
|
||||||
|
buttonStrategyStep.UseVisualStyleBackColor = true;
|
||||||
|
buttonStrategyStep.Click += buttonStrategyStep_Click;
|
||||||
|
//
|
||||||
|
// FormAirFighter
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(924, 557);
|
||||||
|
Controls.Add(buttonStrategyStep);
|
||||||
|
Controls.Add(comboBoxStrategy);
|
||||||
|
Controls.Add(buttonRight);
|
||||||
|
Controls.Add(buttonDown);
|
||||||
|
Controls.Add(buttonUp);
|
||||||
|
Controls.Add(buttonLeft);
|
||||||
|
Controls.Add(pictureBoxAirFighter);
|
||||||
|
Name = "FormAirFighter";
|
||||||
|
Text = "Истребитель";
|
||||||
|
SizeChanged += FormAirFighter_SizeChanged;
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxAirFighter).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private PictureBox pictureBoxAirFighter;
|
||||||
|
private Button buttonLeft;
|
||||||
|
private Button buttonUp;
|
||||||
|
private Button buttonDown;
|
||||||
|
private Button buttonRight;
|
||||||
|
private ComboBox comboBoxStrategy;
|
||||||
|
private Button buttonStrategyStep;
|
||||||
|
}
|
||||||
|
}
|
142
ProjectAirFighter/ProjectAirFighter/FormAirFighter.cs
Normal file
142
ProjectAirFighter/ProjectAirFighter/FormAirFighter.cs
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using ProjectAirFighter.Drawning;
|
||||||
|
using ProjectAirFighter.Entities;
|
||||||
|
using ProjectAirFighter.MovementStrategy;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter
|
||||||
|
{
|
||||||
|
public partial class FormAirFighter : Form
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
private DrawningWarPlane? _drawningWarPlane;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Стратегия перемещения
|
||||||
|
/// </summary>
|
||||||
|
private AbstractStrategy? _strategy;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор формы
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public DrawningWarPlane SetWarPlane{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_drawningWarPlane = value;
|
||||||
|
_drawningWarPlane.SetPictureSize(pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
||||||
|
comboBoxStrategy.Enabled = true;
|
||||||
|
_strategy = null;
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public FormAirFighter()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_strategy = null;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Метод прорисовки
|
||||||
|
/// </summary>
|
||||||
|
private void Draw()
|
||||||
|
{
|
||||||
|
if (_drawningWarPlane == null) return;
|
||||||
|
|
||||||
|
Bitmap bmp = new(pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_drawningWarPlane.DrawTransport(gr);
|
||||||
|
pictureBoxAirFighter.Image = bmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void ButtonMove_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawningWarPlane == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||||
|
bool result = false;
|
||||||
|
switch (name)
|
||||||
|
{
|
||||||
|
case "buttonUp":
|
||||||
|
result = _drawningWarPlane.MoveTransport(DirectionType.Up);
|
||||||
|
break;
|
||||||
|
case "buttonDown":
|
||||||
|
result = _drawningWarPlane.MoveTransport(DirectionType.Down);
|
||||||
|
break;
|
||||||
|
case "buttonLeft":
|
||||||
|
result = _drawningWarPlane.MoveTransport(DirectionType.Left);
|
||||||
|
break;
|
||||||
|
case "buttonRight":
|
||||||
|
result = _drawningWarPlane.MoveTransport(DirectionType.Right);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
private void FormAirFighter_SizeChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawningWarPlane == null) return;
|
||||||
|
|
||||||
|
|
||||||
|
_drawningWarPlane.SetPictureSize(pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
||||||
|
|
||||||
|
|
||||||
|
if (_drawningWarPlane.SetPictureSize(pictureBoxAirFighter.Width, pictureBoxAirFighter.Height))
|
||||||
|
{
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonStrategyStep_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawningWarPlane == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (comboBoxStrategy.Enabled)
|
||||||
|
{
|
||||||
|
_strategy = comboBoxStrategy.SelectedIndex switch
|
||||||
|
{
|
||||||
|
0 => new MoveToCenter(),
|
||||||
|
1 => new MoveToBorder(),
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
if (_strategy == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_strategy.SetDate(new MoveableWarPlane(_drawningWarPlane), pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_strategy == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
comboBoxStrategy.Enabled = false;
|
||||||
|
_strategy.MakeStep();
|
||||||
|
Draw();
|
||||||
|
|
||||||
|
if (_strategy.GetStatus() == StrategyStatus.Finish)
|
||||||
|
{
|
||||||
|
comboBoxStrategy.Enabled = true;
|
||||||
|
_strategy = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
316
ProjectAirFighter/ProjectAirFighter/FormWarPlaneCollection.Designer.cs
generated
Normal file
316
ProjectAirFighter/ProjectAirFighter/FormWarPlaneCollection.Designer.cs
generated
Normal file
@ -0,0 +1,316 @@
|
|||||||
|
namespace ProjectAirFighter
|
||||||
|
{
|
||||||
|
partial class FormWarPlaneCollection
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
groupBox1 = new GroupBox();
|
||||||
|
panelCompanyTools = new Panel();
|
||||||
|
buttonRemove = new Button();
|
||||||
|
buttonAddWarPlane = new Button();
|
||||||
|
button1 = new Button();
|
||||||
|
buttonAddAirFighter = new Button();
|
||||||
|
maskedTextBoxPosition = new MaskedTextBox();
|
||||||
|
buttonGoToCheck = new Button();
|
||||||
|
buttonCreateCompany = new Button();
|
||||||
|
panelStorage = new Panel();
|
||||||
|
buttonCollectionRemove = new Button();
|
||||||
|
listBoxCollection = new ListBox();
|
||||||
|
buttonCollectionAdd = new Button();
|
||||||
|
radioButtonList = new RadioButton();
|
||||||
|
radioButtonMassive = new RadioButton();
|
||||||
|
textBoxCollectionName = new TextBox();
|
||||||
|
labelCollectionName = new Label();
|
||||||
|
comboBoxSelectorCompany = new ComboBox();
|
||||||
|
pictureBox = new PictureBox();
|
||||||
|
groupBox1.SuspendLayout();
|
||||||
|
panelCompanyTools.SuspendLayout();
|
||||||
|
panelStorage.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
groupBox1.Controls.Add(panelCompanyTools);
|
||||||
|
groupBox1.Controls.Add(buttonCreateCompany);
|
||||||
|
groupBox1.Controls.Add(panelStorage);
|
||||||
|
groupBox1.Controls.Add(comboBoxSelectorCompany);
|
||||||
|
groupBox1.Dock = DockStyle.Right;
|
||||||
|
groupBox1.Location = new Point(753, 0);
|
||||||
|
groupBox1.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
groupBox1.Name = "groupBox1";
|
||||||
|
groupBox1.Padding = new Padding(3, 4, 3, 4);
|
||||||
|
groupBox1.Size = new Size(199, 884);
|
||||||
|
groupBox1.TabIndex = 0;
|
||||||
|
groupBox1.TabStop = false;
|
||||||
|
groupBox1.Text = "Инструменты";
|
||||||
|
//
|
||||||
|
// panelCompanyTools
|
||||||
|
//
|
||||||
|
panelCompanyTools.Controls.Add(buttonRemove);
|
||||||
|
panelCompanyTools.Controls.Add(buttonAddWarPlane);
|
||||||
|
panelCompanyTools.Controls.Add(button1);
|
||||||
|
panelCompanyTools.Controls.Add(buttonAddAirFighter);
|
||||||
|
panelCompanyTools.Controls.Add(maskedTextBoxPosition);
|
||||||
|
panelCompanyTools.Controls.Add(buttonGoToCheck);
|
||||||
|
panelCompanyTools.Enabled = false;
|
||||||
|
panelCompanyTools.Location = new Point(0, 497);
|
||||||
|
panelCompanyTools.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
panelCompanyTools.Name = "panelCompanyTools";
|
||||||
|
panelCompanyTools.Size = new Size(199, 371);
|
||||||
|
panelCompanyTools.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// buttonRemove
|
||||||
|
//
|
||||||
|
buttonRemove.Location = new Point(7, 193);
|
||||||
|
buttonRemove.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonRemove.Name = "buttonRemove";
|
||||||
|
buttonRemove.Size = new Size(185, 59);
|
||||||
|
buttonRemove.TabIndex = 4;
|
||||||
|
buttonRemove.Text = "Удалить самолет";
|
||||||
|
buttonRemove.UseVisualStyleBackColor = true;
|
||||||
|
buttonRemove.Click += ButtonRemove_Click;
|
||||||
|
//
|
||||||
|
// buttonAddWarPlane
|
||||||
|
//
|
||||||
|
buttonAddWarPlane.Location = new Point(7, 4);
|
||||||
|
buttonAddWarPlane.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonAddWarPlane.Name = "buttonAddWarPlane";
|
||||||
|
buttonAddWarPlane.Size = new Size(185, 69);
|
||||||
|
buttonAddWarPlane.TabIndex = 1;
|
||||||
|
buttonAddWarPlane.Text = "Добавление военного самолета";
|
||||||
|
buttonAddWarPlane.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddWarPlane.Click += ButtonAddWarPlane_Click;
|
||||||
|
//
|
||||||
|
// button1
|
||||||
|
//
|
||||||
|
button1.Location = new Point(7, 327);
|
||||||
|
button1.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
button1.Name = "button1";
|
||||||
|
button1.Size = new Size(185, 40);
|
||||||
|
button1.TabIndex = 6;
|
||||||
|
button1.Text = "Обновить";
|
||||||
|
button1.UseVisualStyleBackColor = true;
|
||||||
|
button1.Click += ButtonRefresh_Click;
|
||||||
|
//
|
||||||
|
// buttonAddAirFighter
|
||||||
|
//
|
||||||
|
buttonAddAirFighter.Location = new Point(7, 81);
|
||||||
|
buttonAddAirFighter.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonAddAirFighter.Name = "buttonAddAirFighter";
|
||||||
|
buttonAddAirFighter.Size = new Size(185, 59);
|
||||||
|
buttonAddAirFighter.TabIndex = 2;
|
||||||
|
buttonAddAirFighter.Text = "Добавление истребителя";
|
||||||
|
buttonAddAirFighter.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddAirFighter.Click += ButtonAddAirFighter_Click;
|
||||||
|
//
|
||||||
|
// maskedTextBoxPosition
|
||||||
|
//
|
||||||
|
maskedTextBoxPosition.Location = new Point(9, 148);
|
||||||
|
maskedTextBoxPosition.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
maskedTextBoxPosition.Mask = "00";
|
||||||
|
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||||
|
maskedTextBoxPosition.Size = new Size(185, 27);
|
||||||
|
maskedTextBoxPosition.TabIndex = 3;
|
||||||
|
maskedTextBoxPosition.ValidatingType = typeof(int);
|
||||||
|
//
|
||||||
|
// buttonGoToCheck
|
||||||
|
//
|
||||||
|
buttonGoToCheck.Location = new Point(7, 260);
|
||||||
|
buttonGoToCheck.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonGoToCheck.Name = "buttonGoToCheck";
|
||||||
|
buttonGoToCheck.Size = new Size(185, 59);
|
||||||
|
buttonGoToCheck.TabIndex = 5;
|
||||||
|
buttonGoToCheck.Text = "Передать на тест";
|
||||||
|
buttonGoToCheck.UseVisualStyleBackColor = true;
|
||||||
|
buttonGoToCheck.Click += ButtonGoToCheck_Click;
|
||||||
|
//
|
||||||
|
// buttonCreateCompany
|
||||||
|
//
|
||||||
|
buttonCreateCompany.Location = new Point(7, 459);
|
||||||
|
buttonCreateCompany.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonCreateCompany.Name = "buttonCreateCompany";
|
||||||
|
buttonCreateCompany.Size = new Size(185, 31);
|
||||||
|
buttonCreateCompany.TabIndex = 8;
|
||||||
|
buttonCreateCompany.Text = "Создать компанию";
|
||||||
|
buttonCreateCompany.UseVisualStyleBackColor = true;
|
||||||
|
buttonCreateCompany.Click += buttonCreateCompany_Click;
|
||||||
|
//
|
||||||
|
// panelStorage
|
||||||
|
//
|
||||||
|
panelStorage.Controls.Add(buttonCollectionRemove);
|
||||||
|
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, 24);
|
||||||
|
panelStorage.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
panelStorage.Name = "panelStorage";
|
||||||
|
panelStorage.Size = new Size(193, 361);
|
||||||
|
panelStorage.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// buttonCollectionRemove
|
||||||
|
//
|
||||||
|
buttonCollectionRemove.Location = new Point(3, 280);
|
||||||
|
buttonCollectionRemove.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonCollectionRemove.Name = "buttonCollectionRemove";
|
||||||
|
buttonCollectionRemove.Size = new Size(185, 31);
|
||||||
|
buttonCollectionRemove.TabIndex = 6;
|
||||||
|
buttonCollectionRemove.Text = "Удалить коллекцию";
|
||||||
|
buttonCollectionRemove.UseVisualStyleBackColor = true;
|
||||||
|
buttonCollectionRemove.Click += buttonCollectionRemove_Click;
|
||||||
|
//
|
||||||
|
// listBoxCollection
|
||||||
|
//
|
||||||
|
listBoxCollection.FormattingEnabled = true;
|
||||||
|
listBoxCollection.Location = new Point(3, 147);
|
||||||
|
listBoxCollection.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
listBoxCollection.Name = "listBoxCollection";
|
||||||
|
listBoxCollection.Size = new Size(185, 124);
|
||||||
|
listBoxCollection.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonCollectionAdd
|
||||||
|
//
|
||||||
|
buttonCollectionAdd.Location = new Point(3, 108);
|
||||||
|
buttonCollectionAdd.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonCollectionAdd.Name = "buttonCollectionAdd";
|
||||||
|
buttonCollectionAdd.Size = new Size(185, 31);
|
||||||
|
buttonCollectionAdd.TabIndex = 4;
|
||||||
|
buttonCollectionAdd.Text = "Добавить коллекцию";
|
||||||
|
buttonCollectionAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonCollectionAdd.Click += buttonCollectionAdd_Click;
|
||||||
|
//
|
||||||
|
// radioButtonList
|
||||||
|
//
|
||||||
|
radioButtonList.AutoSize = true;
|
||||||
|
radioButtonList.Location = new Point(105, 75);
|
||||||
|
radioButtonList.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
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(3, 75);
|
||||||
|
radioButtonMassive.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
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(3, 36);
|
||||||
|
textBoxCollectionName.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
textBoxCollectionName.Name = "textBoxCollectionName";
|
||||||
|
textBoxCollectionName.Size = new Size(185, 27);
|
||||||
|
textBoxCollectionName.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// labelCollectionName
|
||||||
|
//
|
||||||
|
labelCollectionName.AutoSize = true;
|
||||||
|
labelCollectionName.Location = new Point(24, 12);
|
||||||
|
labelCollectionName.Name = "labelCollectionName";
|
||||||
|
labelCollectionName.Size = new Size(158, 20);
|
||||||
|
labelCollectionName.TabIndex = 0;
|
||||||
|
labelCollectionName.Text = "Название коллекции:";
|
||||||
|
//
|
||||||
|
// 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, 416);
|
||||||
|
comboBoxSelectorCompany.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||||
|
comboBoxSelectorCompany.Size = new Size(185, 28);
|
||||||
|
comboBoxSelectorCompany.TabIndex = 0;
|
||||||
|
comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
|
||||||
|
//
|
||||||
|
// pictureBox
|
||||||
|
//
|
||||||
|
pictureBox.Dock = DockStyle.Fill;
|
||||||
|
pictureBox.Location = new Point(0, 0);
|
||||||
|
pictureBox.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
pictureBox.Name = "pictureBox";
|
||||||
|
pictureBox.Size = new Size(753, 884);
|
||||||
|
pictureBox.TabIndex = 1;
|
||||||
|
pictureBox.TabStop = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// FormWarPlaneCollection
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(952, 884);
|
||||||
|
Controls.Add(pictureBox);
|
||||||
|
Controls.Add(groupBox1);
|
||||||
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
|
Name = "FormWarPlaneCollection";
|
||||||
|
Text = "Коллекция военных самолетов";
|
||||||
|
groupBox1.ResumeLayout(false);
|
||||||
|
panelCompanyTools.ResumeLayout(false);
|
||||||
|
panelCompanyTools.PerformLayout();
|
||||||
|
panelStorage.ResumeLayout(false);
|
||||||
|
panelStorage.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private GroupBox groupBox1;
|
||||||
|
private ComboBox comboBoxSelectorCompany;
|
||||||
|
private MaskedTextBox maskedTextBoxPosition;
|
||||||
|
private Button buttonAddAirFighter;
|
||||||
|
private Button buttonAddWarPlane;
|
||||||
|
private PictureBox pictureBox;
|
||||||
|
private Button buttonRemove;
|
||||||
|
private Button buttonGoToCheck;
|
||||||
|
private Button button1;
|
||||||
|
private Panel panelStorage;
|
||||||
|
private TextBox textBoxCollectionName;
|
||||||
|
private Label labelCollectionName;
|
||||||
|
private ListBox listBoxCollection;
|
||||||
|
private Button buttonCollectionAdd;
|
||||||
|
private RadioButton radioButtonList;
|
||||||
|
private RadioButton radioButtonMassive;
|
||||||
|
private Button buttonCreateCompany;
|
||||||
|
private Button buttonCollectionRemove;
|
||||||
|
private Panel panelCompanyTools;
|
||||||
|
}
|
||||||
|
}
|
262
ProjectAirFighter/ProjectAirFighter/FormWarPlaneCollection.cs
Normal file
262
ProjectAirFighter/ProjectAirFighter/FormWarPlaneCollection.cs
Normal file
@ -0,0 +1,262 @@
|
|||||||
|
using ProjectAirFighter.CollectionGenericObject;
|
||||||
|
using ProjectAirFighter.CollectionGenericObjects;
|
||||||
|
using ProjectAirFighter.Drawning;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter;
|
||||||
|
|
||||||
|
public partial class FormWarPlaneCollection : Form
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Хранилище коолекций
|
||||||
|
/// </summary>
|
||||||
|
private readonly StorageCollection<DrawningWarPlane> _storageCollection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Компания
|
||||||
|
/// </summary>
|
||||||
|
private AbstractCompany? _company;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
public FormWarPlaneCollection()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_storageCollection = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Выбор компании
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
panelCompanyTools.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateObject(string type)
|
||||||
|
{
|
||||||
|
if (_company == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Random random = new();
|
||||||
|
DrawningWarPlane drawningWarPlane;
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case nameof(DrawningWarPlane):
|
||||||
|
drawningWarPlane = new DrawningWarPlane(random.Next(100, 300), random.Next(1000, 3000), GetColor(random));
|
||||||
|
break;
|
||||||
|
case nameof(DrawningAirFighter):
|
||||||
|
drawningWarPlane = 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 + drawningWarPlane != -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект добавлен");
|
||||||
|
pictureBox.Image = _company.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonAddWarPlane_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningWarPlane));
|
||||||
|
|
||||||
|
private void ButtonAddAirFighter_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirFighter));
|
||||||
|
|
||||||
|
/// <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;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonRemove_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawningWarPlane? warPlane = null;
|
||||||
|
|
||||||
|
int counter = 100;
|
||||||
|
while (warPlane == null)
|
||||||
|
{
|
||||||
|
warPlane = _company.GetRandomObject();
|
||||||
|
counter--;
|
||||||
|
if (counter <= 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (warPlane == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FormAirFighter form = new()
|
||||||
|
{
|
||||||
|
SetWarPlane = warPlane
|
||||||
|
};
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
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>
|
||||||
|
/// Обновление списка в 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 buttonCollectionRemove_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(textBoxCollectionName.Text) || (!radioButtonList.Checked && !radioButtonMassive.Checked))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MessageBox.Show("Удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_storageCollection.DelCollection(listBoxCollection.SelectedItem.ToString());
|
||||||
|
RerfreshListBoxItems();
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <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<DrawningWarPlane>? collection = _storageCollection[listBoxCollection.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if (collection == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Коллекция не проинициализирована");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (comboBoxSelectorCompany.Text)
|
||||||
|
{
|
||||||
|
case "Хранилище":
|
||||||
|
_company = new WarPlaneBase(pictureBox.Width,
|
||||||
|
pictureBox.Height, collection);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
panelCompanyTools.Enabled = true;
|
||||||
|
RerfreshListBoxItems();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
120
ProjectAirFighter/ProjectAirFighter/FormWarPlaneCollection.resx
Normal file
120
ProjectAirFighter/ProjectAirFighter/FormWarPlaneCollection.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
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
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -0,0 +1,123 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.MovementStrategy;
|
||||||
|
|
||||||
|
public abstract class AbstractStrategy
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещенный объект
|
||||||
|
/// </summary>
|
||||||
|
private IMoveableObject? _moveableObject;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Статус перемещения
|
||||||
|
/// </summary>
|
||||||
|
private StrategyStatus _state = StrategyStatus.NotInit;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина поля
|
||||||
|
/// </summary>
|
||||||
|
protected int FieldWidth { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Высота поля
|
||||||
|
/// </summary>
|
||||||
|
protected int FieldHeight { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Статус перемещения
|
||||||
|
/// </summary>
|
||||||
|
public StrategyStatus GetStatus() { return _state; }
|
||||||
|
|
||||||
|
public void SetDate(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();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение влево
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
protected bool MoveLeft() => MoveTo(MovementDirection.Left);
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение вправо
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
protected bool MoveRight() => MoveTo(MovementDirection.Right);
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение вверх
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
protected bool MoveUp() => MoveTo(MovementDirection.Up);
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение вниз
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
protected bool MoveDown() => MoveTo(MovementDirection.Down);
|
||||||
|
/// <summary>
|
||||||
|
/// Параметры объекта
|
||||||
|
/// </summary>
|
||||||
|
protected ObjectParameters? GetObjectParameters =>
|
||||||
|
_moveableObject?.GetObjectPosition;
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected int? GetStep()
|
||||||
|
{
|
||||||
|
if (_state != StrategyStatus.InProgress)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return _moveableObject?.GetStep;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение к цели
|
||||||
|
/// </summary>
|
||||||
|
protected abstract void MoveToTarget();
|
||||||
|
/// <summary>
|
||||||
|
/// Достигнута ли цель
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected abstract bool IsTargetDestinaion();
|
||||||
|
/// <summary>
|
||||||
|
/// Попытка перемещения в требуемом направлении
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="movementDirection">Направление</param>
|
||||||
|
/// <returns>Результат попытки (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
private bool MoveTo(MovementDirection movementDirection)
|
||||||
|
{
|
||||||
|
if (_state != StrategyStatus.InProgress)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return _moveableObject?.TryMoveObject(movementDirection) ?? false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.MovementStrategy;
|
||||||
|
|
||||||
|
public interface IMoveableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Получение координаты объекта
|
||||||
|
/// </summary>
|
||||||
|
ObjectParameters? GetObjectPosition { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг объекта
|
||||||
|
/// </summary>
|
||||||
|
int GetStep { get; }
|
||||||
|
|
||||||
|
bool TryMoveObject(MovementDirection direction);
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.MovementStrategy;
|
||||||
|
|
||||||
|
public class MoveToBorder : AbstractStrategy
|
||||||
|
{
|
||||||
|
protected override bool IsTargetDestinaion()
|
||||||
|
{
|
||||||
|
ObjectParameters? objParams = GetObjectParameters;
|
||||||
|
if (objParams == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return objParams.LeftBorder - GetStep() <= 0 || objParams.RightBorder + GetStep() >= FieldWidth ||
|
||||||
|
objParams.TopBorder - GetStep() <= 0 || objParams.ObjectMiddleVertical + GetStep() >= FieldHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void MoveToTarget()
|
||||||
|
{
|
||||||
|
ObjectParameters? objParams = GetObjectParameters;
|
||||||
|
if (objParams == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int x = objParams.RightBorder;
|
||||||
|
if (x + GetStep() < FieldWidth) MoveRight();
|
||||||
|
int y = objParams.DownBorder;
|
||||||
|
if (y + GetStep() < FieldHeight) MoveDown();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
using ProjectAirFighter.Drawning;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.MovementStrategy;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// класс реализация IMoveableObject с исользованием DrawningWarPlane
|
||||||
|
/// </summary>
|
||||||
|
public class MoveableWarPlane: IMoveableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Полк объекта DrawningWarPlane или его наследника
|
||||||
|
/// </summary>
|
||||||
|
private readonly DrawningWarPlane? _warPlane = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="warPlane">Объект класса DrawningWarPlane</param>
|
||||||
|
public MoveableWarPlane(DrawningWarPlane warPlane)
|
||||||
|
{
|
||||||
|
_warPlane = warPlane;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObjectParameters? GetObjectPosition {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_warPlane == null || _warPlane.EntityWarPlane == null || !_warPlane.GetPosX.HasValue || !_warPlane.GetPosY.HasValue)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new ObjectParameters(_warPlane.GetPosX.Value, _warPlane.GetPosY.Value, _warPlane.GetWigdth, _warPlane.GetHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetStep => (int)(_warPlane?.EntityWarPlane?.Step ?? 0);
|
||||||
|
|
||||||
|
public bool TryMoveObject(MovementDirection direction)
|
||||||
|
{
|
||||||
|
if (_warPlane == null || _warPlane.EntityWarPlane == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return _warPlane.MoveTransport(GetDirectionType(direction));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конвертация из MovementDirection в DirectionType
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction">MovementDirection</param>
|
||||||
|
/// <returns>DirectionType</returns>
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.MovementStrategy;
|
||||||
|
|
||||||
|
public enum MovementDirection
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вверх
|
||||||
|
/// </summary>
|
||||||
|
Up = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вниз
|
||||||
|
/// </summary>
|
||||||
|
Down = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Влево
|
||||||
|
/// </summary>
|
||||||
|
Left = 3,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вправо
|
||||||
|
/// </summary>
|
||||||
|
Right = 4
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.MovementStrategy;
|
||||||
|
|
||||||
|
public class ObjectParameters {
|
||||||
|
/// <summary>
|
||||||
|
/// Координата X
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _x;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Координата Y
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _y;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина объекта
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _width;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Высота объекта
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _height;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Левая граница
|
||||||
|
/// </summary>
|
||||||
|
public int LeftBorder => _x;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Верхняя граница
|
||||||
|
/// </summary>
|
||||||
|
public int TopBorder => _y;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Правая граница
|
||||||
|
/// </summary>
|
||||||
|
public int RightBorder => _x + _width;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Нижняя граница
|
||||||
|
/// </summary>
|
||||||
|
public int DownBorder => _y + _height;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Середина объекта
|
||||||
|
/// </summary>
|
||||||
|
public int ObjectMiddleHorizontal => _x + _width / 2;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Середина объекта
|
||||||
|
/// </summary>
|
||||||
|
public int ObjectMiddleVertical => _y + _height / 2;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">Координата X</param>
|
||||||
|
/// <param name="y">Координата Y</param>
|
||||||
|
/// <param name="width">Ширина объекта</param>
|
||||||
|
/// <param name="height">Высота объекта</param>
|
||||||
|
public ObjectParameters(int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
_x = x;
|
||||||
|
_y = y;
|
||||||
|
_width = width;
|
||||||
|
_height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.MovementStrategy;
|
||||||
|
/// <summary>
|
||||||
|
/// Статус выполнения операции перемещения
|
||||||
|
/// </summary>
|
||||||
|
public enum StrategyStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Все готово к началу
|
||||||
|
/// </summary>
|
||||||
|
NotInit,
|
||||||
|
/// <summary>
|
||||||
|
/// Выполняется
|
||||||
|
/// </summary>
|
||||||
|
InProgress,
|
||||||
|
/// <summary>
|
||||||
|
/// Завершено
|
||||||
|
/// </summary>
|
||||||
|
Finish
|
||||||
|
|
||||||
|
}
|
@ -11,7 +11,7 @@ namespace ProjectAirFighter
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new Form1());
|
Application.Run(new FormWarPlaneCollection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,10 +2,25 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows7.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
113
ProjectAirFighter/ProjectAirFighter/Properties/Resources.Designer.cs
generated
Normal file
113
ProjectAirFighter/ProjectAirFighter/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace ProjectAirFighter.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||||
|
/// </summary>
|
||||||
|
// Этот класс создан автоматически классом 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() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||||
|
/// </summary>
|
||||||
|
[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("ProjectAirFighter.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||||
|
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap down {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("down", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap left {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("left", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap png_clipart_arrow_computer_icons_red_arrow_down_blue_triangle {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("png-clipart-arrow-computer-icons-red-arrow-down-blue-triangle", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap right {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("right", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap up {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("up", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
136
ProjectAirFighter/ProjectAirFighter/Properties/Resources.resx
Normal file
136
ProjectAirFighter/ProjectAirFighter/Properties/Resources.resx
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
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
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="left" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\left.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="right" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\right.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="down" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\down.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="png-clipart-arrow-computer-icons-red-arrow-down-blue-triangle" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\png-clipart-arrow-computer-icons-red-arrow-down-blue-triangle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="up" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\up.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
BIN
ProjectAirFighter/ProjectAirFighter/Resources/down.jpg
Normal file
BIN
ProjectAirFighter/ProjectAirFighter/Resources/down.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
ProjectAirFighter/ProjectAirFighter/Resources/left.jpg
Normal file
BIN
ProjectAirFighter/ProjectAirFighter/Resources/left.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
BIN
ProjectAirFighter/ProjectAirFighter/Resources/right.jpg
Normal file
BIN
ProjectAirFighter/ProjectAirFighter/Resources/right.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
ProjectAirFighter/ProjectAirFighter/Resources/up.jpg
Normal file
BIN
ProjectAirFighter/ProjectAirFighter/Resources/up.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
Loading…
Reference in New Issue
Block a user