Compare commits
7 Commits
main
...
laba5_Link
| Author | SHA1 | Date | |
|---|---|---|---|
| 679b5a42d6 | |||
| 18ce0f63ae | |||
| 2aa688c89e | |||
| d402809f02 | |||
| 684f185bb2 | |||
| 3a4576005c | |||
| 0eeff5c79c |
119
Linkor_8/Linkor_8/CollectionGenericObjects/AbstractCompany.cs
Normal file
119
Linkor_8/Linkor_8/CollectionGenericObjects/AbstractCompany.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Linkor_8.Drawings;
|
||||
|
||||
namespace Linkor_8.CollectionGenericObjects;
|
||||
|
||||
public abstract class AbstractCompany
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Размер места (ширина)
|
||||
/// </summary>
|
||||
protected readonly int _placeSizeWidth = 210;
|
||||
|
||||
/// <summary>
|
||||
/// Размер места (высота)
|
||||
/// </summary>
|
||||
protected readonly int _placeSizeHeight = 80;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина окна
|
||||
/// </summary>
|
||||
protected readonly int _pictureWidth;
|
||||
|
||||
/// <summary>
|
||||
/// Высота окна
|
||||
/// </summary>
|
||||
protected readonly int _pictureHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Коллекция автомобилей
|
||||
/// </summary>
|
||||
protected ICollectionGenericObjects<DrawningLinkorSimple>? _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<DrawningLinkorSimple> collection)
|
||||
{
|
||||
_pictureWidth = picWidth;
|
||||
_pictureHeight = picHeight;
|
||||
_collection = collection;
|
||||
_collection.SetMaxCount = GetMaxCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перегрузка оператора сложения для класса
|
||||
/// </summary>
|
||||
/// <param name="company">Компания</param>
|
||||
/// <param name="car">Добавляемый объект</param>
|
||||
/// <returns></returns>
|
||||
public static bool operator +(AbstractCompany company, DrawningLinkorSimple car)
|
||||
{
|
||||
return company._collection?.Insert(car) ?? false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перегрузка оператора удаления для класса
|
||||
/// </summary>
|
||||
/// <param name="company">Компания</param>
|
||||
/// <param name="position">Номер удаляемого объекта</param>
|
||||
/// <returns></returns>
|
||||
public static bool operator -(AbstractCompany company, int position)
|
||||
{
|
||||
return company._collection?.Remove(position) ?? false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение случайного объекта из коллекции
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DrawningLinkorSimple? 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)
|
||||
{
|
||||
DrawningLinkorSimple? 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();
|
||||
}
|
||||
29
Linkor_8/Linkor_8/CollectionGenericObjects/CollectionType.cs
Normal file
29
Linkor_8/Linkor_8/CollectionGenericObjects/CollectionType.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Тип коллекции
|
||||
/// </summary>
|
||||
public enum CollectionType
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Неопределено
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Массив
|
||||
/// </summary>
|
||||
Massive = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Список
|
||||
/// </summary>
|
||||
List = 2
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.CollectionGenericObjects;
|
||||
|
||||
/// <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>
|
||||
bool Insert(T obj);
|
||||
|
||||
/// <summary>
|
||||
/// Добавление объекта в коллекцию на конкретную позицию
|
||||
/// </summary>
|
||||
/// <param name="obj">Добавляемый объект</param>
|
||||
/// <param name="position">Позиция</param>
|
||||
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
|
||||
bool Insert(T obj, int position);
|
||||
|
||||
/// <summary>
|
||||
/// Удаление объекта из коллекции с конкретной позиции
|
||||
/// </summary>
|
||||
/// <param name="position">Позиция</param>
|
||||
/// <returns>true - удаление прошло удачно, false - удаление не удалось</returns>
|
||||
bool Remove(int position);
|
||||
|
||||
/// <summary>
|
||||
/// Получение объекта по позиции
|
||||
/// </summary>
|
||||
/// <param name="position">Позиция</param>
|
||||
/// <returns>Объект</returns>
|
||||
T? Get(int position);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Linkor_8.Drawings;
|
||||
|
||||
namespace Linkor_8.CollectionGenericObjects;
|
||||
|
||||
public class LinkorSharingService : AbstractCompany
|
||||
{
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="picWidth"></param>
|
||||
/// <param name="picHeight"></param>
|
||||
/// <param name="collection"></param>
|
||||
public LinkorSharingService(int picWidth, int picHeight, ICollectionGenericObjects<DrawningLinkorSimple> collection) : base(picWidth, picHeight, collection)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void DrawBackgound(Graphics g)
|
||||
{
|
||||
Pen blackPen = new Pen(Color.Black, 3);
|
||||
|
||||
int placeWidth = 320; // Ширина парковочного места
|
||||
int placeHeight = 160; // Высота парковочного места
|
||||
int startX = 20; // Отступ слева
|
||||
int startY = 30; // Отступ сверху
|
||||
int spacingX = 360; // Расстояние между колонками
|
||||
int spacingY = 200; // Расстояние между рядами
|
||||
|
||||
int rows = 5; // Количество рядов
|
||||
|
||||
for (int col = 0; col < 4; col++)
|
||||
{
|
||||
for (int row = 0; row < rows; row++)
|
||||
{
|
||||
int x = startX + col * spacingX;
|
||||
int y = startY + row * spacingY;
|
||||
// Рисуем прямоугольник парковочного места
|
||||
g.DrawLine(blackPen, x, y + placeHeight, x + placeWidth, y + placeHeight);
|
||||
g.DrawLine(blackPen, x, y, x + placeWidth, y);
|
||||
g.DrawLine(blackPen, x, y, x, y + placeHeight);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetObjectsPosition()
|
||||
{
|
||||
|
||||
int maxObjectsPerRow = (_pictureWidth / _placeSizeWidth) - 3;
|
||||
int maxRows = 5;
|
||||
|
||||
int placeWidth = 180; // Ширина парковочного места
|
||||
int placeHeight = 160; // Высота парковочного места
|
||||
int startX = 15; // Отступ слева
|
||||
int startY = 20; // Отступ сверху
|
||||
int spacingX = 360; // Расстояние между колонками
|
||||
int spacingY = 200; // Расстояние между рядами
|
||||
|
||||
|
||||
int col = 0;
|
||||
int row = 0;
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < _collection?.Count; i++)
|
||||
{
|
||||
var item = _collection.Get(i);
|
||||
if (_collection.Get(i) != null && item != null)
|
||||
{
|
||||
int x = startX + col * spacingX;
|
||||
int y = startY + row * spacingY;
|
||||
|
||||
int objectY = y + (placeHeight - 60) / 2;
|
||||
int objectX = x + (placeWidth - 140) / 2;
|
||||
|
||||
_collection?.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
||||
item.SetPosition(objectX, objectY);
|
||||
|
||||
}
|
||||
if (col < maxObjectsPerRow - 1)
|
||||
{
|
||||
col++;
|
||||
}
|
||||
else if (row < maxRows - 1)
|
||||
{
|
||||
col = 0;
|
||||
row++;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.CollectionGenericObjects;
|
||||
|
||||
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)
|
||||
{
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
if (i == position)
|
||||
{
|
||||
return _collection[position];
|
||||
}
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
public bool Insert(T obj)
|
||||
{
|
||||
if (Count < _maxCount)
|
||||
{
|
||||
_collection.Add(obj);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Insert(T obj, int position)
|
||||
{
|
||||
if (Count < _maxCount)
|
||||
{
|
||||
if (Count >= position)
|
||||
{
|
||||
_collection.Insert(position, obj);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_collection.Add(obj);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public bool Remove(int position)
|
||||
{
|
||||
if (Count >= position)
|
||||
{
|
||||
_collection.RemoveAt(position);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.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 (_collection.Length > 0)
|
||||
{
|
||||
Array.Resize(ref _collection, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
_collection = new T?[value];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public MassiveGenericObjects()
|
||||
{
|
||||
_collection = Array.Empty<T?>();
|
||||
}
|
||||
|
||||
public T? Get(int position)
|
||||
{
|
||||
for (int i = 0; i < _collection.Length; i++)
|
||||
{
|
||||
if (i == position)
|
||||
{
|
||||
return _collection[position];
|
||||
}
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
public bool Insert(T obj)
|
||||
{
|
||||
for (int i = 0; i < _collection.Length; i++)
|
||||
{
|
||||
if (_collection[i] == null)
|
||||
{
|
||||
_collection[i] = obj;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Insert(T obj, int position)
|
||||
{
|
||||
if (_collection[position] == null)
|
||||
{
|
||||
_collection[position] = obj;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = position + 1; j < _collection.Length; j++)
|
||||
{
|
||||
if (_collection[j] == null)
|
||||
{
|
||||
_collection[j] = obj;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (int k = position - 1; k >= 0; k--)
|
||||
{
|
||||
if (_collection[k] == null)
|
||||
{
|
||||
_collection[k] = obj;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Remove(int position)
|
||||
{
|
||||
if (_collection[position] != null)
|
||||
{
|
||||
_collection[position] = null;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-хранилище коллекций
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
|
||||
public class StorageCollection<T>
|
||||
where T : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Словарь (хранилище) с коллекциями
|
||||
/// </summary>
|
||||
readonly Dictionary<string, ICollectionGenericObjects<T>> _storages;
|
||||
|
||||
/// <summary>
|
||||
/// Возвращение списка названий коллекций
|
||||
/// </summary>
|
||||
public List<string> Keys => _storages.Keys.ToList();
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public StorageCollection()
|
||||
{
|
||||
_storages = new Dictionary<string, ICollectionGenericObjects<T>>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавление коллекции в хранилище
|
||||
/// </summary>
|
||||
/// <param name="name">Название коллекции</param>
|
||||
/// <param name="collectionType">тип коллекции</param>
|
||||
public void AddCollection(string name, CollectionType collectionType)
|
||||
{
|
||||
if (name != null && !_storages.ContainsKey(name))
|
||||
{
|
||||
switch (collectionType)
|
||||
{
|
||||
case CollectionType.Massive:
|
||||
_storages.Add(name, new MassiveGenericObjects<T>());
|
||||
break;
|
||||
case CollectionType.List:
|
||||
_storages.Add(name, new ListGenericObjects<T>());
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаление коллекции
|
||||
/// </summary>
|
||||
/// <param name="name">Название коллекции</param>
|
||||
public void DelCollection(string name)
|
||||
{
|
||||
if (name == null || _storages == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_storages.ContainsKey(name))
|
||||
{
|
||||
_storages.Remove(name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Доступ к коллекции
|
||||
/// </summary>
|
||||
/// <param name="name">Название коллекции</param>
|
||||
/// <returns></returns>
|
||||
public ICollectionGenericObjects<T>? this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_storages.ContainsKey(name))
|
||||
{
|
||||
return _storages.GetValueOrDefault(name);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
Linkor_8/Linkor_8/Drawings/DirectionType.cs
Normal file
35
Linkor_8/Linkor_8/Drawings/DirectionType.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.Drawings;
|
||||
/// <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,
|
||||
}
|
||||
|
||||
85
Linkor_8/Linkor_8/Drawings/DrawningLinkor.cs
Normal file
85
Linkor_8/Linkor_8/Drawings/DrawningLinkor.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Linkor_8.Entities;
|
||||
|
||||
namespace Linkor_8.Drawings;
|
||||
|
||||
public class DrawningLinkor : DrawningLinkorSimple
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="mainColor">Основной цвет</param>
|
||||
/// <param name="secondColor">Дополнительный цвет</param>
|
||||
/// <param name="flag">Признак наличия обвеса</param>
|
||||
/// <param name="stripes">Признак наличия антикрыла</param>
|
||||
/// <param name="helicopterLandingSite">Признак наличия гоночной полосы</param>
|
||||
public DrawningLinkor(int speed, double weight, Color mainColor, Color secondColor, bool flag, bool stripes, bool helicopterLandingSite) : base(350, 105)
|
||||
{
|
||||
Entity_Linkor_Simple = new Entity_Linkor(speed, weight, mainColor, secondColor, flag, stripes, helicopterLandingSite);
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
_startPosX += 5;
|
||||
_startPosY += 5;
|
||||
base.DrawTransport(g);
|
||||
_startPosX -= 5;
|
||||
_startPosY -= 5;
|
||||
|
||||
if (Entity_Linkor_Simple == null || Entity_Linkor_Simple is not Entity_Linkor Linkor || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//вертолетная площадка
|
||||
if (Linkor.HelicopterLandingSite)
|
||||
{
|
||||
Pen penHelicopter = new Pen(Color.Red, 3);
|
||||
g.DrawEllipse(penHelicopter, _startPosX.Value + 15, _startPosY.Value + 10, 90, 90);
|
||||
g.DrawLine(penHelicopter, _startPosX.Value + 30, _startPosY.Value + 22, _startPosX.Value + 30, _startPosY.Value + 90);
|
||||
g.DrawLine(penHelicopter, _startPosX.Value + 30, _startPosY.Value + 56, _startPosX.Value + 90, _startPosY.Value + 56);
|
||||
g.DrawLine(penHelicopter, _startPosX.Value + 90, _startPosY.Value + 22, _startPosX.Value + 90, _startPosY.Value + 90);
|
||||
}
|
||||
|
||||
//полоски
|
||||
if (Linkor.Stripes)
|
||||
{
|
||||
Pen penStripes1 = new Pen(Color.White, 10);
|
||||
g.DrawLine(penStripes1, _startPosX.Value + 120, _startPosY.Value + 105, _startPosX.Value + 120, _startPosY.Value + 5);
|
||||
Pen penStripes2 = new Pen(Color.DarkBlue, 10);
|
||||
g.DrawLine(penStripes2, _startPosX.Value + 130, _startPosY.Value + 105, _startPosX.Value + 130, _startPosY.Value + 5);
|
||||
Pen penStripes3 = new Pen(Color.Red, 10);
|
||||
g.DrawLine(penStripes3, _startPosX.Value + 140, _startPosY.Value + 105, _startPosX.Value + 140, _startPosY.Value + 5);
|
||||
}
|
||||
|
||||
|
||||
//флаг
|
||||
if (Linkor.Flag)
|
||||
{
|
||||
Brush additionalBrush = new SolidBrush(Linkor.SecondColor);
|
||||
Pen pen = new Pen(Color.Black, 3);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 250, _startPosY.Value, 40, 20);
|
||||
g.DrawLine(pen, _startPosX.Value + 250, _startPosY.Value, _startPosX.Value + 250, _startPosY.Value + 60);
|
||||
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 250, _startPosY.Value, 40, 20);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
259
Linkor_8/Linkor_8/Drawings/DrawningLinkorSimple.cs
Normal file
259
Linkor_8/Linkor_8/Drawings/DrawningLinkorSimple.cs
Normal file
@@ -0,0 +1,259 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Linkor_8.Entities;
|
||||
|
||||
namespace Linkor_8.Drawings;
|
||||
|
||||
public class DrawningLinkorSimple
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-сущность
|
||||
/// </summary>
|
||||
public Entity_Linkor_Simple? Entity_Linkor_Simple { 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 _drawningLinkorWidth = 340;
|
||||
|
||||
/// <summary>
|
||||
/// Высота прорисовки линкора
|
||||
/// </summary>
|
||||
private readonly int _drawningLinkorHeight = 90;
|
||||
/// <summary>
|
||||
/// Координата X
|
||||
/// </summary>
|
||||
public int? GetPosX => _startPosX;
|
||||
/// <summary>
|
||||
/// Координата Y
|
||||
/// </summary>
|
||||
public int? GetPosY => _startPosY;
|
||||
/// <summary>
|
||||
/// Ширина объекта
|
||||
/// </summary>
|
||||
public int GetWidth => _drawningLinkorWidth;
|
||||
/// <summary>
|
||||
/// Высота объекта
|
||||
/// </summary>
|
||||
public int GetHeight => _drawningLinkorHeight;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Пустой конструктор
|
||||
/// </summary>
|
||||
public DrawningLinkorSimple()
|
||||
{
|
||||
_pictureWidth = null;
|
||||
_pictureHeight = null;
|
||||
_startPosX = null;
|
||||
_startPosY = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="mainColor">Основной цвет</param>
|
||||
public DrawningLinkorSimple(int speed, double weight, Color mainColor) : this()
|
||||
{
|
||||
Entity_Linkor_Simple = new Entity_Linkor_Simple(speed, weight, mainColor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор для наследников
|
||||
/// </summary>
|
||||
/// <param name="drawningLinkorWidth">Ширина прорисовки линкора</param>
|
||||
/// <param name="drawningLinkorHeight">Высота прорисовки линкора</param>
|
||||
protected DrawningLinkorSimple(int drawningLinkorWidth, int drawningLinkorHeight) : this()
|
||||
{
|
||||
_drawningLinkorWidth = drawningLinkorWidth;
|
||||
_pictureHeight = drawningLinkorHeight;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Установка границ поля
|
||||
/// </summary>
|
||||
/// <param name="width">Ширина поля</param>
|
||||
/// <param name="height">Высота поля</param>
|
||||
/// <returns>true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах</returns>
|
||||
public bool SetPictureSize(int width, int height)
|
||||
{
|
||||
if (height < _drawningLinkorHeight || width < _drawningLinkorWidth)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <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;
|
||||
}
|
||||
|
||||
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (x + _drawningLinkorWidth >= _pictureWidth && y + _drawningLinkorHeight >= _pictureHeight)
|
||||
{
|
||||
_startPosX = _pictureWidth - _drawningLinkorWidth;
|
||||
_startPosY = _pictureHeight - _drawningLinkorHeight;
|
||||
}
|
||||
else if (x + _drawningLinkorWidth >= _pictureWidth)
|
||||
{
|
||||
_startPosX = _pictureWidth - _drawningLinkorWidth;
|
||||
_startPosY = y;
|
||||
}
|
||||
else if (y + _drawningLinkorHeight >= _pictureHeight)
|
||||
{
|
||||
_startPosX = x;
|
||||
_startPosY = _pictureHeight - _drawningLinkorHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Изменение направления перемещения
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
/// <returns>true - перемещене выполнено, false - перемещение невозможно</returns>
|
||||
public bool MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (Entity_Linkor_Simple == null || !_startPosX.HasValue ||
|
||||
!_startPosY.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case DirectionType.Left:
|
||||
if (_startPosX.Value - Entity_Linkor_Simple.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)Entity_Linkor_Simple.Step;
|
||||
}
|
||||
return true;
|
||||
//вверх
|
||||
case DirectionType.Up:
|
||||
if (_startPosY.Value - Entity_Linkor_Simple.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)Entity_Linkor_Simple.Step;
|
||||
}
|
||||
return true;
|
||||
// вправо
|
||||
case DirectionType.Right:
|
||||
if (_startPosX.Value + Entity_Linkor_Simple.Step + _drawningLinkorWidth < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)Entity_Linkor_Simple.Step;
|
||||
}
|
||||
return true;
|
||||
//вниз
|
||||
case DirectionType.Down:
|
||||
if (_startPosY.Value + Entity_Linkor_Simple.Step + _drawningLinkorHeight < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)Entity_Linkor_Simple.Step;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Прорисовка объекта
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
if (Entity_Linkor_Simple == null || !_startPosX.HasValue ||
|
||||
!_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Pen pen = new(Color.Black);
|
||||
|
||||
|
||||
|
||||
//границы линкора
|
||||
Brush Brushlinkor = new SolidBrush(Entity_Linkor_Simple.MainColor);
|
||||
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value, 300, 100);
|
||||
g.FillRectangle(Brushlinkor, _startPosX.Value, _startPosY.Value, 300, 100);
|
||||
g.DrawLine(pen, _startPosX.Value + 300, _startPosY.Value, _startPosX.Value + 340, _startPosY.Value + 50);
|
||||
g.DrawLine(pen, _startPosX.Value + 300, _startPosY.Value + 100, _startPosX.Value + 340, _startPosY.Value + 50);
|
||||
Point point1 = new Point(_startPosX.Value + 300, _startPosY.Value + 100);
|
||||
Point point2 = new Point(_startPosX.Value + 300, _startPosY.Value);
|
||||
Point point3 = new Point(_startPosX.Value + 340, _startPosY.Value + 50);
|
||||
Point[] points = { point1, point2, point3 };
|
||||
g.FillPolygon(Brushlinkor, points);
|
||||
|
||||
//стекло
|
||||
Brush GlassBrush = new SolidBrush(Color.LightBlue);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 240, _startPosY.Value + 10, 50, 70);
|
||||
g.FillEllipse(GlassBrush, _startPosX.Value + 240, _startPosY.Value + 10, 50, 70);
|
||||
|
||||
//башня с пушками
|
||||
Brush BrushGun = new SolidBrush(Color.LightGray);
|
||||
//пушки
|
||||
g.DrawRectangle(pen, _startPosX.Value + 170, _startPosY.Value + 10, 50, 10);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 170, _startPosY.Value + 40, 50, 10);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 170, _startPosY.Value + 70, 50, 10);
|
||||
g.FillRectangle(BrushGun, _startPosX.Value + 170, _startPosY.Value + 10, 50, 10);
|
||||
g.FillRectangle(BrushGun, _startPosX.Value + 170, _startPosY.Value + 40, 50, 10);
|
||||
g.FillRectangle(BrushGun, _startPosX.Value + 170, _startPosY.Value + 70, 50, 10);
|
||||
//башня
|
||||
Brush BrushGun1 = new SolidBrush(Color.Gray);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 220, _startPosY.Value, 50, 90);
|
||||
g.FillRectangle(BrushGun1, _startPosX.Value + 220, _startPosY.Value, 50, 90);
|
||||
|
||||
|
||||
|
||||
//отсеки для ракет
|
||||
Brush bombbrush = new SolidBrush(Color.Black);
|
||||
g.FillRectangle(bombbrush, _startPosX.Value - 10, _startPosY.Value + 10, 10, 20);
|
||||
g.FillRectangle(bombbrush, _startPosX.Value - 10, _startPosY.Value + 60, 10, 20);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
61
Linkor_8/Linkor_8/Entities/Entity_Linkor.cs
Normal file
61
Linkor_8/Linkor_8/Entities/Entity_Linkor.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.Entities;
|
||||
|
||||
public class Entity_Linkor : Entity_Linkor_Simple
|
||||
{
|
||||
|
||||
public Color SecondColor { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Есть ли флаг
|
||||
/// </summary>
|
||||
public bool Flag { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Имеются ли полоски на борту
|
||||
/// </summary>
|
||||
public bool Stripes { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Новая ли модель
|
||||
/// </summary>
|
||||
public bool HelicopterLandingSite { get; private set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация полей объекта-класса спортивного автомобиля
|
||||
/// </summary>
|
||||
/// <param name="speed"></param>
|
||||
/// <param name="weight"></param>
|
||||
/// <param name="mainColor"></param>
|
||||
/// <param name="secondColor"></param>
|
||||
/// <param name="flag"></param>
|
||||
/// <param name="stripes"></param>
|
||||
/// <param name="helicopterLandingSite"></param>
|
||||
public Entity_Linkor(int speed, double weight, Color mainColor, Color secondColor, bool flag, bool stripes, bool helicopterLandingSite) : base(speed, weight, mainColor)
|
||||
{
|
||||
SecondColor = secondColor;
|
||||
Flag = flag;
|
||||
Stripes = stripes;
|
||||
HelicopterLandingSite = helicopterLandingSite;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Сеттеры
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
|
||||
|
||||
|
||||
|
||||
public void setSecondColor(Color color)
|
||||
{
|
||||
SecondColor = color;
|
||||
}
|
||||
}
|
||||
54
Linkor_8/Linkor_8/Entities/Entity_Linkor_Simple.cs
Normal file
54
Linkor_8/Linkor_8/Entities/Entity_Linkor_Simple.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
namespace Linkor_8.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-сущность "Простой линкор"
|
||||
/// </summary>
|
||||
public class Entity_Linkor_Simple
|
||||
{
|
||||
/// <summary>
|
||||
/// Скорость
|
||||
/// </summary>
|
||||
public int Speed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Вес
|
||||
/// </summary>
|
||||
public double Weight { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color MainColor { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Шаг перемещения линкора
|
||||
/// </summary>
|
||||
public double Step => Speed * 100 / Weight;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор сущности
|
||||
/// </summary>
|
||||
/// <param name="speed"></param>
|
||||
/// <param name="weight"></param>
|
||||
/// <param name="mainColor"></param>
|
||||
public Entity_Linkor_Simple(int speed, double weight, Color mainColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
MainColor = mainColor;
|
||||
}
|
||||
|
||||
public void setMainColor(Color color)
|
||||
{
|
||||
MainColor = color;
|
||||
}
|
||||
}
|
||||
39
Linkor_8/Linkor_8/Form1.Designer.cs
generated
39
Linkor_8/Linkor_8/Form1.Designer.cs
generated
@@ -1,39 +0,0 @@
|
||||
namespace Linkor_8
|
||||
{
|
||||
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()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace Linkor_8
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
152
Linkor_8/Linkor_8/FormLinkor.Designer.cs
generated
Normal file
152
Linkor_8/Linkor_8/FormLinkor.Designer.cs
generated
Normal file
@@ -0,0 +1,152 @@
|
||||
|
||||
|
||||
namespace Linkor_8
|
||||
{
|
||||
partial class FormLinkor
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
PictureBoxLinkor = new PictureBox();
|
||||
buttonUp = new Button();
|
||||
buttonDown = new Button();
|
||||
buttonRight = new Button();
|
||||
buttonLeft = new Button();
|
||||
comboBoxStrategy = new ComboBox();
|
||||
buttonStrategyStep = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)PictureBoxLinkor).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// PictureBoxLinkor
|
||||
//
|
||||
PictureBoxLinkor.Dock = DockStyle.Fill;
|
||||
PictureBoxLinkor.Location = new Point(0, 0);
|
||||
PictureBoxLinkor.Name = "PictureBoxLinkor";
|
||||
PictureBoxLinkor.Size = new Size(1902, 1033);
|
||||
PictureBoxLinkor.TabIndex = 0;
|
||||
PictureBoxLinkor.TabStop = false;
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonUp.BackgroundImage = Properties.Resources.up_arrow;
|
||||
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUp.Location = new Point(1814, 945);
|
||||
buttonUp.Name = "buttonUp";
|
||||
buttonUp.Size = new Size(35, 35);
|
||||
buttonUp.TabIndex = 2;
|
||||
buttonUp.UseVisualStyleBackColor = true;
|
||||
buttonUp.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonDown.BackgroundImage = Properties.Resources.bottom_arrow;
|
||||
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDown.Location = new Point(1814, 986);
|
||||
buttonDown.Name = "buttonDown";
|
||||
buttonDown.Size = new Size(35, 35);
|
||||
buttonDown.TabIndex = 3;
|
||||
buttonDown.UseVisualStyleBackColor = true;
|
||||
buttonDown.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonRight.BackgroundImage = Properties.Resources.right_arrow;
|
||||
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonRight.Location = new Point(1855, 986);
|
||||
buttonRight.Name = "buttonRight";
|
||||
buttonRight.Size = new Size(35, 35);
|
||||
buttonRight.TabIndex = 4;
|
||||
buttonRight.UseVisualStyleBackColor = true;
|
||||
buttonRight.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonLeft.BackgroundImage = Properties.Resources.left_arrow;
|
||||
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonLeft.Location = new Point(1773, 986);
|
||||
buttonLeft.Name = "buttonLeft";
|
||||
buttonLeft.Size = new Size(35, 35);
|
||||
buttonLeft.TabIndex = 5;
|
||||
buttonLeft.UseVisualStyleBackColor = true;
|
||||
buttonLeft.Click += ButtonMove_Click;
|
||||
//
|
||||
// comboBoxStrategy
|
||||
//
|
||||
comboBoxStrategy.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxStrategy.FormattingEnabled = true;
|
||||
comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К краю" });
|
||||
comboBoxStrategy.Location = new Point(1739, 12);
|
||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
comboBoxStrategy.Size = new Size(151, 28);
|
||||
comboBoxStrategy.TabIndex = 7;
|
||||
//
|
||||
// buttonStrategyStep
|
||||
//
|
||||
buttonStrategyStep.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
buttonStrategyStep.Location = new Point(1796, 46);
|
||||
buttonStrategyStep.Name = "buttonStrategyStep";
|
||||
buttonStrategyStep.Size = new Size(94, 29);
|
||||
buttonStrategyStep.TabIndex = 8;
|
||||
buttonStrategyStep.Text = "Шаг";
|
||||
buttonStrategyStep.UseVisualStyleBackColor = true;
|
||||
buttonStrategyStep.Click += buttonStrategyStep_Click;
|
||||
//
|
||||
// FormLinkor
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1902, 1033);
|
||||
Controls.Add(buttonStrategyStep);
|
||||
Controls.Add(comboBoxStrategy);
|
||||
Controls.Add(buttonLeft);
|
||||
Controls.Add(buttonRight);
|
||||
Controls.Add(buttonDown);
|
||||
Controls.Add(buttonUp);
|
||||
Controls.Add(PictureBoxLinkor);
|
||||
Name = "FormLinkor";
|
||||
Text = "Линкор";
|
||||
((System.ComponentModel.ISupportInitialize)PictureBoxLinkor).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox PictureBoxLinkor;
|
||||
private Button buttonUp;
|
||||
private Button buttonDown;
|
||||
private Button buttonRight;
|
||||
private Button buttonLeft;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button buttonStrategyStep;
|
||||
}
|
||||
}
|
||||
131
Linkor_8/Linkor_8/FormLinkor.cs
Normal file
131
Linkor_8/Linkor_8/FormLinkor.cs
Normal file
@@ -0,0 +1,131 @@
|
||||
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 Linkor_8.Drawings;
|
||||
using Linkor_8.MovingStrategy;
|
||||
|
||||
namespace Linkor_8
|
||||
{
|
||||
public partial class FormLinkor : Form
|
||||
{
|
||||
|
||||
private DrawningLinkorSimple? _drawningLinkorSimple;
|
||||
|
||||
/// <summary>
|
||||
/// Стратегия перемещения
|
||||
/// </summary>
|
||||
private AbstractStrategy? _strategy;
|
||||
|
||||
|
||||
|
||||
public FormLinkor()
|
||||
{
|
||||
InitializeComponent();
|
||||
_strategy = null;
|
||||
}
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawningLinkorSimple == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Bitmap bmp = new(PictureBoxLinkor.Width, PictureBoxLinkor.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningLinkorSimple.DrawTransport(gr);
|
||||
PictureBoxLinkor.Image = bmp;
|
||||
}
|
||||
|
||||
public DrawningLinkorSimple SetLinkor
|
||||
{
|
||||
set
|
||||
{
|
||||
_drawningLinkorSimple = value;
|
||||
_drawningLinkorSimple.SetPictureSize(PictureBoxLinkor.Width, PictureBoxLinkor.Height);
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_strategy = null;
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningLinkorSimple == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
bool result = false;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
result = _drawningLinkorSimple.MoveTransport(DirectionType.Up); break;
|
||||
case "buttonDown":
|
||||
result = _drawningLinkorSimple.MoveTransport(DirectionType.Down); break;
|
||||
case "buttonRight":
|
||||
result = _drawningLinkorSimple.MoveTransport(DirectionType.Right); break;
|
||||
case "buttonLeft":
|
||||
result = _drawningLinkorSimple.MoveTransport(DirectionType.Left); break;
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonStrategyStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningLinkorSimple == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (comboBoxStrategy.Enabled)
|
||||
{
|
||||
_strategy = comboBoxStrategy.SelectedIndex switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToBorder(),
|
||||
_ => null,
|
||||
};
|
||||
if (_strategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_strategy.SetData(new MoveableLinkor(_drawningLinkorSimple), PictureBoxLinkor.Width, PictureBoxLinkor.Height);
|
||||
}
|
||||
|
||||
if (_strategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
comboBoxStrategy.Enabled = false;
|
||||
_strategy.MakeStep();
|
||||
Draw();
|
||||
|
||||
if (_strategy.GetStatus() == StrategyStatus.Finish)
|
||||
{
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_strategy = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
<!--
|
||||
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
|
||||
|
||||
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>
|
||||
@@ -26,36 +26,36 @@
|
||||
<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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
288
Linkor_8/Linkor_8/FormLinkorCollection.Designer.cs
generated
Normal file
288
Linkor_8/Linkor_8/FormLinkorCollection.Designer.cs
generated
Normal file
@@ -0,0 +1,288 @@
|
||||
namespace Linkor_8
|
||||
{
|
||||
partial class FormLinkorCollection
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
groupBoxTools = new GroupBox();
|
||||
panelCompanyTools = new Panel();
|
||||
buttonAddLinkorSimple = new Button();
|
||||
buttonGoToCheck = new Button();
|
||||
buttonDelLinkor = new Button();
|
||||
maskedTextBoxPosition = new MaskedTextBox();
|
||||
buttonRefresh = new Button();
|
||||
buttonCreateCompany = new Button();
|
||||
panelStorage = new Panel();
|
||||
buttonCollectionDel = new Button();
|
||||
listBoxCollection = new ListBox();
|
||||
buttonCollectionAdd = new Button();
|
||||
radioButtonList = new RadioButton();
|
||||
radioButtonMassive = new RadioButton();
|
||||
textBoxCollectionName = new TextBox();
|
||||
labelCollectionName = new Label();
|
||||
comboBoxSelectorCompany = new ComboBox();
|
||||
pictureBox = new PictureBox();
|
||||
groupBoxTools.SuspendLayout();
|
||||
panelCompanyTools.SuspendLayout();
|
||||
panelStorage.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxTools
|
||||
//
|
||||
groupBoxTools.Controls.Add(panelCompanyTools);
|
||||
groupBoxTools.Controls.Add(buttonCreateCompany);
|
||||
groupBoxTools.Controls.Add(panelStorage);
|
||||
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
||||
groupBoxTools.Dock = DockStyle.Right;
|
||||
groupBoxTools.Location = new Point(1650, 0);
|
||||
groupBoxTools.Name = "groupBoxTools";
|
||||
groupBoxTools.Size = new Size(252, 1033);
|
||||
groupBoxTools.TabIndex = 0;
|
||||
groupBoxTools.TabStop = false;
|
||||
groupBoxTools.Text = "Инструменты";
|
||||
//
|
||||
// panelCompanyTools
|
||||
//
|
||||
panelCompanyTools.Controls.Add(buttonAddLinkorSimple);
|
||||
panelCompanyTools.Controls.Add(buttonGoToCheck);
|
||||
panelCompanyTools.Controls.Add(buttonDelLinkor);
|
||||
panelCompanyTools.Controls.Add(maskedTextBoxPosition);
|
||||
panelCompanyTools.Controls.Add(buttonRefresh);
|
||||
panelCompanyTools.Dock = DockStyle.Bottom;
|
||||
panelCompanyTools.Location = new Point(3, 681);
|
||||
panelCompanyTools.Name = "panelCompanyTools";
|
||||
panelCompanyTools.Size = new Size(246, 349);
|
||||
panelCompanyTools.TabIndex = 8;
|
||||
//
|
||||
// buttonAddLinkorSimple
|
||||
//
|
||||
buttonAddLinkorSimple.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonAddLinkorSimple.Location = new Point(6, 12);
|
||||
buttonAddLinkorSimple.Name = "buttonAddLinkorSimple";
|
||||
buttonAddLinkorSimple.Size = new Size(230, 56);
|
||||
buttonAddLinkorSimple.TabIndex = 1;
|
||||
buttonAddLinkorSimple.Text = "Добавление линкора без обвесов";
|
||||
buttonAddLinkorSimple.UseVisualStyleBackColor = true;
|
||||
buttonAddLinkorSimple.Click += ButtonAddLinkorSimple_Click;
|
||||
//
|
||||
// buttonGoToCheck
|
||||
//
|
||||
buttonGoToCheck.Location = new Point(8, 169);
|
||||
buttonGoToCheck.Name = "buttonGoToCheck";
|
||||
buttonGoToCheck.Size = new Size(232, 56);
|
||||
buttonGoToCheck.TabIndex = 5;
|
||||
buttonGoToCheck.Text = "Передать на тесты";
|
||||
buttonGoToCheck.UseVisualStyleBackColor = true;
|
||||
buttonGoToCheck.Click += buttonGoToCheck_Click;
|
||||
//
|
||||
// buttonDelLinkor
|
||||
//
|
||||
buttonDelLinkor.Location = new Point(8, 293);
|
||||
buttonDelLinkor.Name = "buttonDelLinkor";
|
||||
buttonDelLinkor.Size = new Size(232, 56);
|
||||
buttonDelLinkor.TabIndex = 4;
|
||||
buttonDelLinkor.Text = "Удаление линкора";
|
||||
buttonDelLinkor.UseVisualStyleBackColor = true;
|
||||
buttonDelLinkor.Click += buttonDelLinkor_Click;
|
||||
//
|
||||
// maskedTextBoxPosition
|
||||
//
|
||||
maskedTextBoxPosition.Location = new Point(6, 136);
|
||||
maskedTextBoxPosition.Mask = "00";
|
||||
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||
maskedTextBoxPosition.Size = new Size(234, 27);
|
||||
maskedTextBoxPosition.TabIndex = 3;
|
||||
maskedTextBoxPosition.ValidatingType = typeof(int);
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Location = new Point(8, 231);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(232, 56);
|
||||
buttonRefresh.TabIndex = 6;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += buttonRefresh_Click;
|
||||
//
|
||||
// buttonCreateCompany
|
||||
//
|
||||
buttonCreateCompany.Location = new Point(0, 615);
|
||||
buttonCreateCompany.Name = "buttonCreateCompany";
|
||||
buttonCreateCompany.Size = new Size(240, 29);
|
||||
buttonCreateCompany.TabIndex = 7;
|
||||
buttonCreateCompany.Text = "Создание компании";
|
||||
buttonCreateCompany.UseVisualStyleBackColor = true;
|
||||
buttonCreateCompany.Click += ButtonCreateCompany_Click;
|
||||
//
|
||||
// panelStorage
|
||||
//
|
||||
panelStorage.Controls.Add(buttonCollectionDel);
|
||||
panelStorage.Controls.Add(listBoxCollection);
|
||||
panelStorage.Controls.Add(buttonCollectionAdd);
|
||||
panelStorage.Controls.Add(radioButtonList);
|
||||
panelStorage.Controls.Add(radioButtonMassive);
|
||||
panelStorage.Controls.Add(textBoxCollectionName);
|
||||
panelStorage.Controls.Add(labelCollectionName);
|
||||
panelStorage.Dock = DockStyle.Top;
|
||||
panelStorage.Location = new Point(3, 23);
|
||||
panelStorage.Name = "panelStorage";
|
||||
panelStorage.Size = new Size(246, 410);
|
||||
panelStorage.TabIndex = 7;
|
||||
//
|
||||
// buttonCollectionDel
|
||||
//
|
||||
buttonCollectionDel.Location = new Point(6, 263);
|
||||
buttonCollectionDel.Name = "buttonCollectionDel";
|
||||
buttonCollectionDel.Size = new Size(240, 29);
|
||||
buttonCollectionDel.TabIndex = 6;
|
||||
buttonCollectionDel.Text = "Удалить коллекцию";
|
||||
buttonCollectionDel.UseVisualStyleBackColor = true;
|
||||
buttonCollectionDel.Click += ButtonCollectionDel_Click;
|
||||
//
|
||||
// listBoxCollection
|
||||
//
|
||||
listBoxCollection.FormattingEnabled = true;
|
||||
listBoxCollection.Location = new Point(8, 133);
|
||||
listBoxCollection.Name = "listBoxCollection";
|
||||
listBoxCollection.Size = new Size(229, 124);
|
||||
listBoxCollection.TabIndex = 5;
|
||||
//
|
||||
// buttonCollectionAdd
|
||||
//
|
||||
buttonCollectionAdd.Location = new Point(3, 95);
|
||||
buttonCollectionAdd.Name = "buttonCollectionAdd";
|
||||
buttonCollectionAdd.Size = new Size(240, 29);
|
||||
buttonCollectionAdd.TabIndex = 4;
|
||||
buttonCollectionAdd.Text = "Добавить коллекцию";
|
||||
buttonCollectionAdd.UseVisualStyleBackColor = true;
|
||||
buttonCollectionAdd.Click += ButtonCollectionAdd_Click;
|
||||
//
|
||||
// radioButtonList
|
||||
//
|
||||
radioButtonList.AutoSize = true;
|
||||
radioButtonList.Location = new Point(119, 65);
|
||||
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(17, 65);
|
||||
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(1, 23);
|
||||
textBoxCollectionName.Name = "textBoxCollectionName";
|
||||
textBoxCollectionName.Size = new Size(242, 27);
|
||||
textBoxCollectionName.TabIndex = 1;
|
||||
//
|
||||
// labelCollectionName
|
||||
//
|
||||
labelCollectionName.AutoSize = true;
|
||||
labelCollectionName.Location = new Point(44, 0);
|
||||
labelCollectionName.Name = "labelCollectionName";
|
||||
labelCollectionName.Size = new Size(155, 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(6, 650);
|
||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||
comboBoxSelectorCompany.Size = new Size(234, 28);
|
||||
comboBoxSelectorCompany.TabIndex = 0;
|
||||
comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
pictureBox.Dock = DockStyle.Fill;
|
||||
pictureBox.Location = new Point(0, 0);
|
||||
pictureBox.Name = "pictureBox";
|
||||
pictureBox.Size = new Size(1650, 1033);
|
||||
pictureBox.TabIndex = 1;
|
||||
pictureBox.TabStop = false;
|
||||
//
|
||||
// FormLinkorCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1902, 1033);
|
||||
Controls.Add(pictureBox);
|
||||
Controls.Add(groupBoxTools);
|
||||
Name = "FormLinkorCollection";
|
||||
Text = "Коллекция линкоров";
|
||||
groupBoxTools.ResumeLayout(false);
|
||||
panelCompanyTools.ResumeLayout(false);
|
||||
panelCompanyTools.PerformLayout();
|
||||
panelStorage.ResumeLayout(false);
|
||||
panelStorage.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
private void ButtonAddLinkor_Click1(object sender, EventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxTools;
|
||||
private ComboBox comboBoxSelectorCompany;
|
||||
private Button buttonAddLinkorSimple;
|
||||
private MaskedTextBox maskedTextBoxPosition;
|
||||
private PictureBox pictureBox;
|
||||
private Button buttonDelLinkor;
|
||||
private Button buttonRefresh;
|
||||
private Button buttonGoToCheck;
|
||||
private Panel panelStorage;
|
||||
private TextBox textBoxCollectionName;
|
||||
private Label labelCollectionName;
|
||||
private Button buttonCollectionAdd;
|
||||
private RadioButton radioButtonList;
|
||||
private RadioButton radioButtonMassive;
|
||||
private Button buttonCreateCompany;
|
||||
private Button buttonCollectionDel;
|
||||
private ListBox listBoxCollection;
|
||||
private Panel panelCompanyTools;
|
||||
}
|
||||
}
|
||||
232
Linkor_8/Linkor_8/FormLinkorCollection.cs
Normal file
232
Linkor_8/Linkor_8/FormLinkorCollection.cs
Normal file
@@ -0,0 +1,232 @@
|
||||
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 Linkor_8.CollectionGenericObjects;
|
||||
using Linkor_8.Drawings;
|
||||
|
||||
namespace Linkor_8;
|
||||
|
||||
public partial class FormLinkorCollection : Form
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Хранилише коллекций
|
||||
/// </summary>
|
||||
private readonly StorageCollection<DrawningLinkorSimple> _storageCollection;
|
||||
|
||||
private AbstractCompany? _company = null;
|
||||
|
||||
public FormLinkorCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
_storageCollection = new();
|
||||
panelCompanyTools.Enabled = false;
|
||||
}
|
||||
|
||||
private void SetLinkor(DrawningLinkorSimple? linkor)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
MessageBox.Show("_company == null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (linkor == null)
|
||||
{
|
||||
MessageBox.Show("linkor == null");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if (_company + linkor)
|
||||
{
|
||||
|
||||
|
||||
var image = _company.Show();
|
||||
if (image == null)
|
||||
{
|
||||
MessageBox.Show("_company.Show() вернул null");
|
||||
}
|
||||
else
|
||||
{
|
||||
pictureBox.Image = image;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
panelCompanyTools.Enabled = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void ButtonAddLinkorSimple_Click(object sender, EventArgs e)
|
||||
{
|
||||
FormLinkorConfig form = new();
|
||||
form.AddEvent(SetLinkor);
|
||||
form.Show();
|
||||
}
|
||||
|
||||
|
||||
private void buttonDelLinkor_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||
if (_company - pos)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buttonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
|
||||
private void buttonGoToCheck_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DrawningLinkorSimple? linkor = null;
|
||||
int counter = 100;
|
||||
while (linkor == null)
|
||||
{
|
||||
linkor = _company.GetRandomObject();
|
||||
counter--;
|
||||
if (counter <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (linkor == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FormLinkor form = new()
|
||||
{
|
||||
SetLinkor = linkor
|
||||
};
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
private void ButtonCollectionDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxCollection.SelectedItems.Count == 0)
|
||||
{
|
||||
MessageBox.Show("Нет выбранных элементов");
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show("Подтвердите удаление коллекции" + listBoxCollection.SelectedItem?.ToString(), "", MessageBoxButtons.YesNo) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_storageCollection.DelCollection(listBoxCollection.SelectedItem?.ToString());
|
||||
RerfreshListBoxItems();
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ButtonCreateCompany_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
|
||||
{
|
||||
MessageBox.Show("Коллекция не выбрана");
|
||||
return;
|
||||
}
|
||||
|
||||
ICollectionGenericObjects<DrawningLinkorSimple>? collection = _storageCollection[listBoxCollection.SelectedItem.ToString() ?? string.Empty];
|
||||
if (collection == null)
|
||||
{
|
||||
MessageBox.Show("Коллекция не проинициализирована");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (comboBoxSelectorCompany.Text)
|
||||
{
|
||||
case "Хранилище":
|
||||
_company = new LinkorSharingService(pictureBox.Width, pictureBox.Height, collection);
|
||||
break;
|
||||
}
|
||||
panelCompanyTools.Enabled = true;
|
||||
RerfreshListBoxItems();
|
||||
}
|
||||
}
|
||||
120
Linkor_8/Linkor_8/FormLinkorCollection.resx
Normal file
120
Linkor_8/Linkor_8/FormLinkorCollection.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>
|
||||
378
Linkor_8/Linkor_8/FormLinkorConfig.Designer.cs
generated
Normal file
378
Linkor_8/Linkor_8/FormLinkorConfig.Designer.cs
generated
Normal file
@@ -0,0 +1,378 @@
|
||||
namespace Linkor_8
|
||||
{
|
||||
partial class FormLinkorConfig
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
groupBoxLinkorConfig = new GroupBox();
|
||||
groupBoxColor = new GroupBox();
|
||||
panelPurple = new Panel();
|
||||
panelYellow = new Panel();
|
||||
panelBlack = new Panel();
|
||||
panelGrey = new Panel();
|
||||
panelBlue = new Panel();
|
||||
panelWhite = new Panel();
|
||||
panelGreen = new Panel();
|
||||
panelRed = new Panel();
|
||||
checkBoxHelicopterLandingSite = new CheckBox();
|
||||
checkBoxStripes = new CheckBox();
|
||||
checkBoxFlag = new CheckBox();
|
||||
numericUpDownWeight = new NumericUpDown();
|
||||
labelWeight = new Label();
|
||||
numericUpDownSpeed = new NumericUpDown();
|
||||
labelSpeed = new Label();
|
||||
labelModifiedObject = new Label();
|
||||
labelSimpleObject = new Label();
|
||||
pictureBoxObject = new PictureBox();
|
||||
buttonAdd = new Button();
|
||||
buttonCancel = new Button();
|
||||
panelObject = new Panel();
|
||||
labelAdditionalColor = new Label();
|
||||
labelBodyColor = new Label();
|
||||
groupBoxLinkorConfig.SuspendLayout();
|
||||
groupBoxColor.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
||||
panelObject.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxLinkorConfig
|
||||
//
|
||||
groupBoxLinkorConfig.Controls.Add(groupBoxColor);
|
||||
groupBoxLinkorConfig.Controls.Add(checkBoxHelicopterLandingSite);
|
||||
groupBoxLinkorConfig.Controls.Add(checkBoxStripes);
|
||||
groupBoxLinkorConfig.Controls.Add(checkBoxFlag);
|
||||
groupBoxLinkorConfig.Controls.Add(numericUpDownWeight);
|
||||
groupBoxLinkorConfig.Controls.Add(labelWeight);
|
||||
groupBoxLinkorConfig.Controls.Add(numericUpDownSpeed);
|
||||
groupBoxLinkorConfig.Controls.Add(labelSpeed);
|
||||
groupBoxLinkorConfig.Controls.Add(labelModifiedObject);
|
||||
groupBoxLinkorConfig.Controls.Add(labelSimpleObject);
|
||||
groupBoxLinkorConfig.Dock = DockStyle.Left;
|
||||
groupBoxLinkorConfig.Location = new Point(0, 0);
|
||||
groupBoxLinkorConfig.Name = "groupBoxLinkorConfig";
|
||||
groupBoxLinkorConfig.Size = new Size(612, 261);
|
||||
groupBoxLinkorConfig.TabIndex = 0;
|
||||
groupBoxLinkorConfig.TabStop = false;
|
||||
groupBoxLinkorConfig.Text = "Параметры";
|
||||
//
|
||||
// groupBoxColor
|
||||
//
|
||||
groupBoxColor.Controls.Add(panelPurple);
|
||||
groupBoxColor.Controls.Add(panelYellow);
|
||||
groupBoxColor.Controls.Add(panelBlack);
|
||||
groupBoxColor.Controls.Add(panelGrey);
|
||||
groupBoxColor.Controls.Add(panelBlue);
|
||||
groupBoxColor.Controls.Add(panelWhite);
|
||||
groupBoxColor.Controls.Add(panelGreen);
|
||||
groupBoxColor.Controls.Add(panelRed);
|
||||
groupBoxColor.Location = new Point(301, 23);
|
||||
groupBoxColor.Name = "groupBoxColor";
|
||||
groupBoxColor.Size = new Size(275, 153);
|
||||
groupBoxColor.TabIndex = 9;
|
||||
groupBoxColor.TabStop = false;
|
||||
groupBoxColor.Text = "Цвета";
|
||||
//
|
||||
// panelPurple
|
||||
//
|
||||
panelPurple.AllowDrop = true;
|
||||
panelPurple.BackColor = Color.Purple;
|
||||
panelPurple.Location = new Point(220, 101);
|
||||
panelPurple.Name = "panelPurple";
|
||||
panelPurple.Size = new Size(40, 40);
|
||||
panelPurple.TabIndex = 7;
|
||||
//
|
||||
// panelYellow
|
||||
//
|
||||
panelYellow.AllowDrop = true;
|
||||
panelYellow.BackColor = Color.Yellow;
|
||||
panelYellow.Location = new Point(220, 36);
|
||||
panelYellow.Name = "panelYellow";
|
||||
panelYellow.Size = new Size(40, 40);
|
||||
panelYellow.TabIndex = 3;
|
||||
//
|
||||
// panelBlack
|
||||
//
|
||||
panelBlack.AllowDrop = true;
|
||||
panelBlack.BackColor = Color.Black;
|
||||
panelBlack.Location = new Point(157, 101);
|
||||
panelBlack.Name = "panelBlack";
|
||||
panelBlack.Size = new Size(40, 40);
|
||||
panelBlack.TabIndex = 6;
|
||||
//
|
||||
// panelGrey
|
||||
//
|
||||
panelGrey.AllowDrop = true;
|
||||
panelGrey.BackColor = Color.Gray;
|
||||
panelGrey.Location = new Point(94, 101);
|
||||
panelGrey.Name = "panelGrey";
|
||||
panelGrey.Size = new Size(40, 40);
|
||||
panelGrey.TabIndex = 5;
|
||||
//
|
||||
// panelBlue
|
||||
//
|
||||
panelBlue.AllowDrop = true;
|
||||
panelBlue.BackColor = Color.Blue;
|
||||
panelBlue.Location = new Point(157, 36);
|
||||
panelBlue.Name = "panelBlue";
|
||||
panelBlue.Size = new Size(40, 40);
|
||||
panelBlue.TabIndex = 2;
|
||||
//
|
||||
// panelWhite
|
||||
//
|
||||
panelWhite.AllowDrop = true;
|
||||
panelWhite.BackColor = Color.White;
|
||||
panelWhite.Location = new Point(27, 101);
|
||||
panelWhite.Name = "panelWhite";
|
||||
panelWhite.Size = new Size(40, 40);
|
||||
panelWhite.TabIndex = 4;
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
panelGreen.AllowDrop = true;
|
||||
panelGreen.BackColor = Color.Green;
|
||||
panelGreen.Location = new Point(94, 36);
|
||||
panelGreen.Name = "panelGreen";
|
||||
panelGreen.Size = new Size(40, 40);
|
||||
panelGreen.TabIndex = 1;
|
||||
//
|
||||
// panelRed
|
||||
//
|
||||
panelRed.AllowDrop = true;
|
||||
panelRed.BackColor = Color.Red;
|
||||
panelRed.Location = new Point(27, 36);
|
||||
panelRed.Name = "panelRed";
|
||||
panelRed.Size = new Size(40, 40);
|
||||
panelRed.TabIndex = 0;
|
||||
//
|
||||
// checkBoxHelicopterLandingSite
|
||||
//
|
||||
checkBoxHelicopterLandingSite.AutoSize = true;
|
||||
checkBoxHelicopterLandingSite.Location = new Point(6, 209);
|
||||
checkBoxHelicopterLandingSite.Name = "checkBoxHelicopterLandingSite";
|
||||
checkBoxHelicopterLandingSite.Size = new Size(321, 24);
|
||||
checkBoxHelicopterLandingSite.TabIndex = 8;
|
||||
checkBoxHelicopterLandingSite.Text = "Признак наличия вертолетной площадки";
|
||||
checkBoxHelicopterLandingSite.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxStripes
|
||||
//
|
||||
checkBoxStripes.AutoSize = true;
|
||||
checkBoxStripes.Location = new Point(6, 162);
|
||||
checkBoxStripes.Name = "checkBoxStripes";
|
||||
checkBoxStripes.Size = new Size(216, 24);
|
||||
checkBoxStripes.TabIndex = 7;
|
||||
checkBoxStripes.Text = "Признак наличия полосок";
|
||||
checkBoxStripes.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxFlag
|
||||
//
|
||||
checkBoxFlag.AutoSize = true;
|
||||
checkBoxFlag.Location = new Point(6, 113);
|
||||
checkBoxFlag.Name = "checkBoxFlag";
|
||||
checkBoxFlag.Size = new Size(198, 24);
|
||||
checkBoxFlag.TabIndex = 6;
|
||||
checkBoxFlag.Text = "Признак наличия флага";
|
||||
checkBoxFlag.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownWeight
|
||||
//
|
||||
numericUpDownWeight.Location = new Point(88, 61);
|
||||
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownWeight.Name = "numericUpDownWeight";
|
||||
numericUpDownWeight.Size = new Size(116, 27);
|
||||
numericUpDownWeight.TabIndex = 5;
|
||||
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// labelWeight
|
||||
//
|
||||
labelWeight.AutoSize = true;
|
||||
labelWeight.Location = new Point(6, 61);
|
||||
labelWeight.Name = "labelWeight";
|
||||
labelWeight.Size = new Size(36, 20);
|
||||
labelWeight.TabIndex = 4;
|
||||
labelWeight.Text = "Вес:";
|
||||
//
|
||||
// numericUpDownSpeed
|
||||
//
|
||||
numericUpDownSpeed.Location = new Point(88, 23);
|
||||
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||
numericUpDownSpeed.Size = new Size(116, 27);
|
||||
numericUpDownSpeed.TabIndex = 3;
|
||||
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// labelSpeed
|
||||
//
|
||||
labelSpeed.AutoSize = true;
|
||||
labelSpeed.Location = new Point(6, 23);
|
||||
labelSpeed.Name = "labelSpeed";
|
||||
labelSpeed.Size = new Size(76, 20);
|
||||
labelSpeed.TabIndex = 2;
|
||||
labelSpeed.Text = "Скорость:";
|
||||
//
|
||||
// labelModifiedObject
|
||||
//
|
||||
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelModifiedObject.Location = new Point(465, 206);
|
||||
labelModifiedObject.Name = "labelModifiedObject";
|
||||
labelModifiedObject.Size = new Size(111, 44);
|
||||
labelModifiedObject.TabIndex = 1;
|
||||
labelModifiedObject.Text = "Продвинутый";
|
||||
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelModifiedObject.MouseDown += labelObject_MouseDown;
|
||||
//
|
||||
// labelSimpleObject
|
||||
//
|
||||
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelSimpleObject.Location = new Point(348, 206);
|
||||
labelSimpleObject.Name = "labelSimpleObject";
|
||||
labelSimpleObject.Size = new Size(111, 44);
|
||||
labelSimpleObject.TabIndex = 0;
|
||||
labelSimpleObject.Text = "Простой";
|
||||
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelSimpleObject.MouseDown += labelObject_MouseDown;
|
||||
//
|
||||
// pictureBoxObject
|
||||
//
|
||||
pictureBoxObject.Location = new Point(3, 60);
|
||||
pictureBoxObject.Name = "pictureBoxObject";
|
||||
pictureBoxObject.Size = new Size(372, 125);
|
||||
pictureBoxObject.TabIndex = 1;
|
||||
pictureBoxObject.TabStop = false;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(638, 206);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(162, 29);
|
||||
buttonAdd.TabIndex = 2;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(812, 206);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(162, 29);
|
||||
buttonCancel.TabIndex = 3;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// panelObject
|
||||
//
|
||||
panelObject.AllowDrop = true;
|
||||
panelObject.Controls.Add(labelAdditionalColor);
|
||||
panelObject.Controls.Add(labelBodyColor);
|
||||
panelObject.Controls.Add(pictureBoxObject);
|
||||
panelObject.Location = new Point(619, 1);
|
||||
panelObject.Name = "panelObject";
|
||||
panelObject.Size = new Size(390, 199);
|
||||
panelObject.TabIndex = 4;
|
||||
panelObject.DragDrop += panelObject_DragDrop;
|
||||
panelObject.DragEnter += panelObject_DragEnter;
|
||||
//
|
||||
// labelAdditionalColor
|
||||
//
|
||||
labelAdditionalColor.AllowDrop = true;
|
||||
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelAdditionalColor.Location = new Point(244, 8);
|
||||
labelAdditionalColor.Name = "labelAdditionalColor";
|
||||
labelAdditionalColor.Size = new Size(111, 44);
|
||||
labelAdditionalColor.TabIndex = 11;
|
||||
labelAdditionalColor.Text = "Доп. цвет";
|
||||
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelAdditionalColor.DragDrop += chooseColor_DragDrop;
|
||||
labelAdditionalColor.DragEnter += chooseColor_DragEnter;
|
||||
//
|
||||
// labelBodyColor
|
||||
//
|
||||
labelBodyColor.AllowDrop = true;
|
||||
labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelBodyColor.Location = new Point(19, 8);
|
||||
labelBodyColor.Name = "labelBodyColor";
|
||||
labelBodyColor.Size = new Size(111, 44);
|
||||
labelBodyColor.TabIndex = 10;
|
||||
labelBodyColor.Text = "Цвет";
|
||||
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelBodyColor.DragDrop += chooseColor_DragDrop;
|
||||
labelBodyColor.DragEnter += chooseColor_DragEnter;
|
||||
//
|
||||
// FormLinkorConfig
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1021, 261);
|
||||
Controls.Add(panelObject);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(groupBoxLinkorConfig);
|
||||
Name = "FormLinkorConfig";
|
||||
Text = "Создание объекта";
|
||||
groupBoxLinkorConfig.ResumeLayout(false);
|
||||
groupBoxLinkorConfig.PerformLayout();
|
||||
groupBoxColor.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
||||
panelObject.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxLinkorConfig;
|
||||
private Label labelModifiedObject;
|
||||
private Label labelSimpleObject;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private Label labelWeight;
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private Label labelSpeed;
|
||||
private CheckBox checkBoxFlag;
|
||||
private CheckBox checkBoxHelicopterLandingSite;
|
||||
private CheckBox checkBoxStripes;
|
||||
private GroupBox groupBoxColor;
|
||||
private Panel panelRed;
|
||||
private Panel panelPurple;
|
||||
private Panel panelYellow;
|
||||
private Panel panelBlack;
|
||||
private Panel panelGrey;
|
||||
private Panel panelBlue;
|
||||
private Panel panelWhite;
|
||||
private Panel panelGreen;
|
||||
private PictureBox pictureBoxObject;
|
||||
private Button buttonAdd;
|
||||
private Button buttonCancel;
|
||||
private Panel panelObject;
|
||||
private Label labelAdditionalColor;
|
||||
private Label labelBodyColor;
|
||||
}
|
||||
}
|
||||
116
Linkor_8/Linkor_8/FormLinkorConfig.cs
Normal file
116
Linkor_8/Linkor_8/FormLinkorConfig.cs
Normal file
@@ -0,0 +1,116 @@
|
||||
|
||||
|
||||
using Linkor_8.Drawings;
|
||||
using Linkor_8.Entities;
|
||||
|
||||
namespace Linkor_8;
|
||||
public partial class FormLinkorConfig : Form
|
||||
{
|
||||
private DrawningLinkorSimple _linkor;
|
||||
|
||||
private event Action<DrawningLinkorSimple> _linkorDelegate;
|
||||
public FormLinkorConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
panelRed.MouseDown += Panel_MouseDown;
|
||||
panelBlue.MouseDown += Panel_MouseDown;
|
||||
panelGreen.MouseDown += Panel_MouseDown;
|
||||
panelYellow.MouseDown += Panel_MouseDown;
|
||||
panelGrey.MouseDown += Panel_MouseDown;
|
||||
panelBlack.MouseDown += Panel_MouseDown;
|
||||
panelWhite.MouseDown += Panel_MouseDown;
|
||||
panelPurple.MouseDown += Panel_MouseDown;
|
||||
|
||||
buttonCancel.Click += (sender, e) => Close();
|
||||
}
|
||||
public void AddEvent(Action<DrawningLinkorSimple> LinkorDelegate)
|
||||
{
|
||||
_linkorDelegate += LinkorDelegate;
|
||||
}
|
||||
|
||||
private void Panel_MouseDown(object? sender, MouseEventArgs e)
|
||||
{
|
||||
if (sender is Panel p)
|
||||
{
|
||||
p?.DoDragDrop(p?.BackColor ?? Color.Transparent, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
}
|
||||
private void DrawObject()
|
||||
{
|
||||
if (_linkor == null) return;
|
||||
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_linkor.SetPictureSize(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
_linkor.SetPosition(5, 5);
|
||||
_linkor.DrawTransport(gr);
|
||||
pictureBoxObject.Image = bmp;
|
||||
}
|
||||
private void labelObject_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Label)?.DoDragDrop((sender as Label)?.Name ?? string.Empty, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
private void panelObject_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
private void panelObject_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
switch (e.Data?.GetData(DataFormats.Text)?.ToString())
|
||||
{
|
||||
case "labelSimpleObject":
|
||||
_linkor = new DrawningLinkorSimple((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White);
|
||||
break;
|
||||
case "labelModifiedObject":
|
||||
_linkor = new DrawningLinkor((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White,
|
||||
Color.Black, checkBoxFlag.Checked, checkBoxStripes.Checked, checkBoxHelicopterLandingSite.Checked);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
DrawObject();
|
||||
}
|
||||
|
||||
private void chooseColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data?.GetDataPresent(typeof(Color)) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
}
|
||||
|
||||
private void chooseColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_linkor == null || e?.Data == null) return;
|
||||
|
||||
var colorData = e.Data.GetData(typeof(Color));
|
||||
if (colorData is not Color objColor) return;
|
||||
|
||||
switch ((sender as Label)?.Name)
|
||||
{
|
||||
case "labelBodyColor":
|
||||
_linkor.Entity_Linkor_Simple?.setMainColor(objColor);
|
||||
break;
|
||||
|
||||
case "labelAdditionalColor":
|
||||
(_linkor.Entity_Linkor_Simple as Entity_Linkor)?.setSecondColor(objColor);
|
||||
break;
|
||||
}
|
||||
|
||||
DrawObject();
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_linkor != null)
|
||||
{
|
||||
_linkorDelegate.Invoke(_linkor);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
Linkor_8/Linkor_8/FormLinkorConfig.resx
Normal file
120
Linkor_8/Linkor_8/FormLinkorConfig.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>
|
||||
7
Linkor_8/Linkor_8/LinkorDelegate.cs
Normal file
7
Linkor_8/Linkor_8/LinkorDelegate.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Linkor_8.Drawings;
|
||||
|
||||
namespace Linkor_8
|
||||
{
|
||||
public delegate void LinkorDelegate(DrawningLinkorSimple linkor);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,19 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</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>
|
||||
143
Linkor_8/Linkor_8/MovingStrategy/AbstractStrategy.cs
Normal file
143
Linkor_8/Linkor_8/MovingStrategy/AbstractStrategy.cs
Normal file
@@ -0,0 +1,143 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.MovingStrategy;
|
||||
|
||||
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; }
|
||||
|
||||
/// <summary>
|
||||
/// Установка данных
|
||||
/// </summary>
|
||||
/// <param name="moveableObject">Перемещаемый объект</param>
|
||||
/// <param name="width">Ширина поля</param>
|
||||
/// <param name="height">Высота поля</param>
|
||||
public void SetData(IMoveableObject moveableObject, int width, int height)
|
||||
{
|
||||
if (moveableObject == null)
|
||||
{
|
||||
_state = StrategyStatus.NotInit;
|
||||
return;
|
||||
}
|
||||
|
||||
_state = StrategyStatus.InProgress;
|
||||
_moveableObject = moveableObject;
|
||||
FieldWidth = width;
|
||||
FieldHeight = height;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Шаг перемещения
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
29
Linkor_8/Linkor_8/MovingStrategy/IMoveableObject.cs
Normal file
29
Linkor_8/Linkor_8/MovingStrategy/IMoveableObject.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.MovingStrategy;
|
||||
/// <summary>
|
||||
/// Интрерфейс для работы с перемещаемым объектом
|
||||
/// </summary>
|
||||
public interface IMoveableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Получение координаты объекта
|
||||
/// </summary>
|
||||
ObjectParameters? GetObjectPosition { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Шаг объекта
|
||||
/// </summary>
|
||||
int GetStep { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Попытка переместить объект в указанном направлении
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
/// <returns>true - объект перемещен, false - перемещение невозможно</returns>
|
||||
bool TryMoveObject(MovementDirection direction);
|
||||
}
|
||||
42
Linkor_8/Linkor_8/MovingStrategy/MoveToBorder.cs
Normal file
42
Linkor_8/Linkor_8/MovingStrategy/MoveToBorder.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.MovingStrategy;
|
||||
|
||||
public class MoveToBorder : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestinaion()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return objParams.DownBorder + GetStep() >= FieldHeight && objParams.RightBorder + GetStep() >= FieldWidth;
|
||||
}
|
||||
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int diffX = objParams.RightBorder - FieldWidth;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
|
||||
int diffY = objParams.DownBorder - FieldHeight;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
57
Linkor_8/Linkor_8/MovingStrategy/MoveToCenter.cs
Normal file
57
Linkor_8/Linkor_8/MovingStrategy/MoveToCenter.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.MovingStrategy;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
71
Linkor_8/Linkor_8/MovingStrategy/MoveableLinkor.cs
Normal file
71
Linkor_8/Linkor_8/MovingStrategy/MoveableLinkor.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using Linkor_8.Drawings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.MovingStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Класс - реализация IMoveableObject с использованием DrawningLinkorSimple
|
||||
/// </summary>
|
||||
|
||||
public class MoveableLinkor : IMoveableObject
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Поле-объект класса DrawningCar или его наследника
|
||||
/// </summary>
|
||||
private readonly DrawningLinkorSimple? _linkor = null;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="car">Объект класса DrawningCar</param>
|
||||
public MoveableLinkor(DrawningLinkorSimple linkor)
|
||||
{
|
||||
_linkor = linkor;
|
||||
}
|
||||
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_linkor == null || _linkor.Entity_Linkor_Simple == null || !_linkor.GetPosX.HasValue || !_linkor.GetPosY.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_linkor.GetPosX.Value, _linkor.GetPosY.Value, _linkor.GetWidth, _linkor.GetHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetStep => (int)(_linkor?.Entity_Linkor_Simple?.Step ?? 0);
|
||||
|
||||
public bool TryMoveObject(MovementDirection direction)
|
||||
{
|
||||
if (_linkor == null || _linkor.Entity_Linkor_Simple == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _linkor.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,
|
||||
};
|
||||
}
|
||||
}
|
||||
27
Linkor_8/Linkor_8/MovingStrategy/MovementDirection.cs
Normal file
27
Linkor_8/Linkor_8/MovingStrategy/MovementDirection.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.MovingStrategy;
|
||||
|
||||
public enum MovementDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Вверх
|
||||
/// </summary>
|
||||
Up = 1,
|
||||
/// <summary>
|
||||
/// Вниз
|
||||
/// </summary>
|
||||
Down = 2,
|
||||
/// <summary>
|
||||
/// Влево
|
||||
/// </summary>
|
||||
Left = 3,
|
||||
/// <summary>
|
||||
/// Вправо
|
||||
/// </summary>
|
||||
Right = 4,
|
||||
}
|
||||
75
Linkor_8/Linkor_8/MovingStrategy/ObjectParameters.cs
Normal file
75
Linkor_8/Linkor_8/MovingStrategy/ObjectParameters.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.MovingStrategy;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
28
Linkor_8/Linkor_8/MovingStrategy/StrategyStatus.cs
Normal file
28
Linkor_8/Linkor_8/MovingStrategy/StrategyStatus.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Linkor_8.MovingStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Статус выполнения операции перемещения
|
||||
/// </summary>
|
||||
public enum StrategyStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Все готово к началу
|
||||
/// </summary>
|
||||
NotInit,
|
||||
/// <summary>
|
||||
/// Выполняется
|
||||
/// </summary>
|
||||
InProgress,
|
||||
/// <summary>
|
||||
/// Завершено
|
||||
/// </summary>
|
||||
Finish
|
||||
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@ namespace Linkor_8
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
Application.Run(new FormLinkorCollection());
|
||||
}
|
||||
}
|
||||
}
|
||||
103
Linkor_8/Linkor_8/Properties/Resources.Designer.cs
generated
Normal file
103
Linkor_8/Linkor_8/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Linkor_8.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("Linkor_8.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 bottom_arrow {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("bottom arrow", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap left_arrow {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("left arrow", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap right_arrow {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("right arrow", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap up_arrow {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("up arrow", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
133
Linkor_8/Linkor_8/Properties/Resources.resx
Normal file
133
Linkor_8/Linkor_8/Properties/Resources.resx
Normal file
@@ -0,0 +1,133 @@
|
||||
<?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="bottom arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\bottom arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="left arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\left arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="right arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\right arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="up arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\up arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
Linkor_8/Linkor_8/Resources/bottom arrow.png
Normal file
BIN
Linkor_8/Linkor_8/Resources/bottom arrow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
Linkor_8/Linkor_8/Resources/left arrow.png
Normal file
BIN
Linkor_8/Linkor_8/Resources/left arrow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
Linkor_8/Linkor_8/Resources/right arrow.png
Normal file
BIN
Linkor_8/Linkor_8/Resources/right arrow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
Linkor_8/Linkor_8/Resources/up arrow.png
Normal file
BIN
Linkor_8/Linkor_8/Resources/up arrow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user