Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 713f348d06 | |||
| 3df532a330 |
@@ -0,0 +1,106 @@
|
|||||||
|
using ProjectBattleship.DrawingObject;
|
||||||
|
|
||||||
|
namespace ProjectBattleship.CollectionGenericObjects;
|
||||||
|
/// <summary>
|
||||||
|
/// Абстракция компании, хранящий коллекцию автомобилей
|
||||||
|
/// </summary>
|
||||||
|
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<DrawingWarship>? _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<DrawingWarship> collection)
|
||||||
|
{
|
||||||
|
_pictureWidth = picWidth;
|
||||||
|
_pictureHeight = picHeight;
|
||||||
|
_collection = collection;
|
||||||
|
_collection.SetMaxCount = GetMaxCount;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перегрузка оператора сложения для класса
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="company">Компания</param>
|
||||||
|
/// <param name="warship">Добавляемый объект</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int operator +(AbstractCompany company,
|
||||||
|
DrawingWarship warship)
|
||||||
|
{
|
||||||
|
return company._collection?.Insert(warship) ?? 0;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перегрузка оператора удаления для класса
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="company">Компания</param>
|
||||||
|
/// <param name="position">Номер удаляемого объекта</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static DrawingWarship? operator -(AbstractCompany company,
|
||||||
|
int position)
|
||||||
|
{
|
||||||
|
return company._collection?.Remove(position);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение случайного объекта из коллекции
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DrawingWarship? 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)
|
||||||
|
{
|
||||||
|
DrawingWarship? obj = _collection?.Get(i);
|
||||||
|
obj?.DrawTransport(graphics);
|
||||||
|
}
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Вывод заднего фона
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
protected abstract void DrawBackgound(Graphics g);
|
||||||
|
/// <summary>
|
||||||
|
/// Расстановка объектов
|
||||||
|
/// </summary>
|
||||||
|
protected abstract void SetObjectsPosition();
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
namespace ProjectBattleship.CollectionGenericObjects;
|
||||||
|
/// <summary>
|
||||||
|
/// Тип коллекции
|
||||||
|
/// </summary>
|
||||||
|
public enum CollectionType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Неопределено
|
||||||
|
/// </summary>
|
||||||
|
None = 0,
|
||||||
|
/// <summary>
|
||||||
|
/// Массив
|
||||||
|
/// </summary>
|
||||||
|
Massive = 1,
|
||||||
|
/// <summary>
|
||||||
|
/// Список
|
||||||
|
/// </summary>
|
||||||
|
List = 2
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
using ProjectBattleship.DrawingObject;
|
||||||
|
|
||||||
|
namespace ProjectBattleship.CollectionGenericObjects;
|
||||||
|
/// <summary>
|
||||||
|
/// Реализация абстрактной компании - доки
|
||||||
|
/// </summary>
|
||||||
|
public class Docks : AbstractCompany
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="picWidth"></param>
|
||||||
|
/// <param name="picHeight"></param>
|
||||||
|
/// <param name="collection"></param>
|
||||||
|
public Docks(int picWidth, int picHeight,
|
||||||
|
ICollectionGenericObjects<DrawingWarship> collection) :
|
||||||
|
base(picWidth, picHeight, collection)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
protected override void DrawBackgound(Graphics g)
|
||||||
|
{
|
||||||
|
int width = _pictureWidth / _placeSizeWidth;
|
||||||
|
int height = _pictureHeight / _placeSizeHeight;
|
||||||
|
Brush brush = new SolidBrush(Color.Black);
|
||||||
|
for (int i = 0; i < width; ++i)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < height; ++j)
|
||||||
|
{
|
||||||
|
g.FillRectangle(brush, i * _placeSizeWidth,
|
||||||
|
j * _placeSizeHeight, 200, 5);
|
||||||
|
g.FillRectangle(brush, i * _placeSizeWidth,
|
||||||
|
j * _placeSizeHeight, 5, 80);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int j = 0; j < height - 4; ++j)
|
||||||
|
{
|
||||||
|
g.FillRectangle(brush, j * _placeSizeWidth,
|
||||||
|
height * _placeSizeHeight, 200, 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected override void SetObjectsPosition()
|
||||||
|
{
|
||||||
|
if (_collection == null) return;
|
||||||
|
int width = _pictureWidth / _placeSizeWidth;
|
||||||
|
int height = _pictureHeight / _placeSizeHeight;
|
||||||
|
|
||||||
|
int curWidth = width - 1;
|
||||||
|
int curHeight = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < _collection.Count; i++)
|
||||||
|
{
|
||||||
|
DrawingWarship? _warship = _collection.Get(i);
|
||||||
|
if (_warship != null)
|
||||||
|
{
|
||||||
|
if (_warship.SetPictureSize(_pictureWidth, _pictureHeight))
|
||||||
|
{
|
||||||
|
_warship.SetPosition(_placeSizeWidth * curWidth + 20,
|
||||||
|
curHeight * _placeSizeHeight + 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
curWidth--;
|
||||||
|
if (curWidth < 0)
|
||||||
|
{
|
||||||
|
curHeight++;
|
||||||
|
curWidth = width - 1;
|
||||||
|
}
|
||||||
|
if (curHeight >= height)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
namespace ProjectBattleship.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>
|
||||||
|
int Insert(T obj);
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление объекта в коллекцию на конкретную позицию
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">Добавляемый объект</param>
|
||||||
|
/// <param name="position">Позиция</param>
|
||||||
|
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
|
||||||
|
int Insert(T obj, int position);
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление объекта из коллекции с конкретной позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position">Позиция</param>
|
||||||
|
/// <returns>true - удаление прошло удачно, false - удаление не удалось</returns>
|
||||||
|
T? Remove(int position);
|
||||||
|
/// <summary>
|
||||||
|
/// Получение объекта по позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position">Позиция</param>
|
||||||
|
/// <returns>Объект</returns>
|
||||||
|
T? Get(int position);
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
namespace ProjectBattleship.CollectionGenericObjects;
|
||||||
|
/// <summary>
|
||||||
|
/// Параметризованный набор объектов
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">Параметр: ограничение - ссылочный тип</typeparam>
|
||||||
|
public class ListGenericObjects<T> : ICollectionGenericObjects<T>
|
||||||
|
where T : class
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Список объектов, которые храним
|
||||||
|
/// </summary>
|
||||||
|
private readonly List<T?> _collection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Максимально допустимое число объектов в списке
|
||||||
|
/// </summary>
|
||||||
|
private int _maxCount;
|
||||||
|
|
||||||
|
public int Count => _collection.Count;
|
||||||
|
|
||||||
|
public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
public ListGenericObjects()
|
||||||
|
{
|
||||||
|
_collection = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public T? Get(int position)
|
||||||
|
{
|
||||||
|
if (position < 0 || position >= Count) return null;
|
||||||
|
return _collection[position];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Insert(T? obj)
|
||||||
|
{
|
||||||
|
if (Count == _maxCount) return -1;
|
||||||
|
_collection.Add(obj);
|
||||||
|
return Count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Insert(T? obj, int position)
|
||||||
|
{
|
||||||
|
if (Count == _maxCount) return -1;
|
||||||
|
if (position < 0 || position >= Count) return -1;
|
||||||
|
_collection.Insert(position, obj);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T? Remove(int position)
|
||||||
|
{
|
||||||
|
if (position < 0 || position >= Count) return null;
|
||||||
|
T? obj = _collection[position];
|
||||||
|
_collection.RemoveAt(position);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
namespace ProjectBattleship.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)
|
||||||
|
{
|
||||||
|
if (position < 0 || position > Count)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return _collection[position];
|
||||||
|
}
|
||||||
|
public int Insert(T obj)
|
||||||
|
{
|
||||||
|
return Insert(obj, 0);
|
||||||
|
}
|
||||||
|
public int Insert(T obj, int position)
|
||||||
|
{
|
||||||
|
if (position < 0 || position > Count)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_collection[position] == null)
|
||||||
|
{
|
||||||
|
_collection[position] = obj;
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = position + 1; i < Count; i++)
|
||||||
|
{
|
||||||
|
if (_collection[i] == null)
|
||||||
|
{
|
||||||
|
_collection[i] = obj;
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = position - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (_collection[i] == null)
|
||||||
|
{
|
||||||
|
_collection[i] = obj;
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
public T? Remove(int position)
|
||||||
|
{
|
||||||
|
if (position < 0 || position > Count || _collection[position] == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
T? obj = _collection[position];
|
||||||
|
_collection[position] = null;
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
namespace ProjectBattleship.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 (string.IsNullOrEmpty(name)) return;
|
||||||
|
if (_storages.ContainsKey(name)) return;
|
||||||
|
if (collectionType == CollectionType.None) return;
|
||||||
|
if (collectionType == CollectionType.Massive)
|
||||||
|
{
|
||||||
|
_storages[name] = new MassiveGenericObjects<T>();
|
||||||
|
}
|
||||||
|
else if (collectionType == CollectionType.List)
|
||||||
|
{
|
||||||
|
_storages[name] = new ListGenericObjects<T>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление коллекции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">Название коллекции</param>
|
||||||
|
public void DelCollection(string name)
|
||||||
|
{
|
||||||
|
if (_storages.ContainsKey(name))
|
||||||
|
{
|
||||||
|
_storages.Remove(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Доступ к коллекции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">Название коллекции</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ICollectionGenericObjects<T>? this[string name]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_storages.ContainsKey(name))
|
||||||
|
{
|
||||||
|
return _storages[name];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace ProjectBattleship;
|
namespace ProjectBattleship.DrawingObject;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Направление перемещения
|
/// Направление перемещения
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -29,14 +29,12 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
pictureBoxBattleship = new PictureBox();
|
pictureBoxBattleship = new PictureBox();
|
||||||
buttonCreateBattleship = new Button();
|
|
||||||
buttonLeft = new Button();
|
buttonLeft = new Button();
|
||||||
buttonDown = new Button();
|
buttonDown = new Button();
|
||||||
buttonRight = new Button();
|
buttonRight = new Button();
|
||||||
buttonUp = new Button();
|
buttonUp = new Button();
|
||||||
comboBoxStrategy = new ComboBox();
|
comboBoxStrategy = new ComboBox();
|
||||||
button1 = new Button();
|
buttonStrategyStep = new Button();
|
||||||
buttonCreateWarship = new Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxBattleship).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureBoxBattleship).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
@@ -50,18 +48,6 @@
|
|||||||
pictureBoxBattleship.TabIndex = 0;
|
pictureBoxBattleship.TabIndex = 0;
|
||||||
pictureBoxBattleship.TabStop = false;
|
pictureBoxBattleship.TabStop = false;
|
||||||
//
|
//
|
||||||
// buttonCreateBattleship
|
|
||||||
//
|
|
||||||
buttonCreateBattleship.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
buttonCreateBattleship.Location = new Point(11, 384);
|
|
||||||
buttonCreateBattleship.Margin = new Padding(2);
|
|
||||||
buttonCreateBattleship.Name = "buttonCreateBattleship";
|
|
||||||
buttonCreateBattleship.Size = new Size(201, 40);
|
|
||||||
buttonCreateBattleship.TabIndex = 1;
|
|
||||||
buttonCreateBattleship.Text = "Создать линкор";
|
|
||||||
buttonCreateBattleship.UseVisualStyleBackColor = true;
|
|
||||||
buttonCreateBattleship.Click += ButtonCreateBattleship_Click;
|
|
||||||
//
|
|
||||||
// buttonLeft
|
// buttonLeft
|
||||||
//
|
//
|
||||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
@@ -126,38 +112,26 @@
|
|||||||
//
|
//
|
||||||
// button1
|
// button1
|
||||||
//
|
//
|
||||||
button1.Location = new Point(752, 72);
|
buttonStrategyStep.Location = new Point(752, 72);
|
||||||
button1.Name = "button1";
|
buttonStrategyStep.Name = "button1";
|
||||||
button1.Size = new Size(104, 43);
|
buttonStrategyStep.Size = new Size(104, 43);
|
||||||
button1.TabIndex = 7;
|
buttonStrategyStep.TabIndex = 7;
|
||||||
button1.Text = "шаг";
|
buttonStrategyStep.Text = "шаг";
|
||||||
button1.TextAlign = ContentAlignment.TopCenter;
|
buttonStrategyStep.TextAlign = ContentAlignment.TopCenter;
|
||||||
button1.UseVisualStyleBackColor = true;
|
buttonStrategyStep.UseVisualStyleBackColor = true;
|
||||||
button1.Click += ButtonStrategyStep_Click;
|
buttonStrategyStep.Click += ButtonStrategyStep_Click;
|
||||||
//
|
|
||||||
// buttonCreateWarship
|
|
||||||
//
|
|
||||||
buttonCreateWarship.Location = new Point(217, 384);
|
|
||||||
buttonCreateWarship.Name = "buttonCreateWarship";
|
|
||||||
buttonCreateWarship.Size = new Size(200, 40);
|
|
||||||
buttonCreateWarship.TabIndex = 8;
|
|
||||||
buttonCreateWarship.Text = "Создать корабль";
|
|
||||||
buttonCreateWarship.UseVisualStyleBackColor = true;
|
|
||||||
buttonCreateWarship.Click += ButtonCreateWarship_Click;
|
|
||||||
//
|
//
|
||||||
// FormBattleship
|
// FormBattleship
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(12F, 30F);
|
AutoScaleDimensions = new SizeF(12F, 30F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(876, 436);
|
ClientSize = new Size(876, 436);
|
||||||
Controls.Add(buttonCreateWarship);
|
Controls.Add(buttonStrategyStep);
|
||||||
Controls.Add(button1);
|
|
||||||
Controls.Add(comboBoxStrategy);
|
Controls.Add(comboBoxStrategy);
|
||||||
Controls.Add(buttonUp);
|
Controls.Add(buttonUp);
|
||||||
Controls.Add(buttonRight);
|
Controls.Add(buttonRight);
|
||||||
Controls.Add(buttonDown);
|
Controls.Add(buttonDown);
|
||||||
Controls.Add(buttonLeft);
|
Controls.Add(buttonLeft);
|
||||||
Controls.Add(buttonCreateBattleship);
|
|
||||||
Controls.Add(pictureBoxBattleship);
|
Controls.Add(pictureBoxBattleship);
|
||||||
Margin = new Padding(2);
|
Margin = new Padding(2);
|
||||||
Name = "FormBattleship";
|
Name = "FormBattleship";
|
||||||
@@ -171,13 +145,11 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private PictureBox pictureBoxBattleship;
|
private PictureBox pictureBoxBattleship;
|
||||||
private Button buttonCreateBattleship;
|
|
||||||
private Button buttonLeft;
|
private Button buttonLeft;
|
||||||
private Button buttonDown;
|
private Button buttonDown;
|
||||||
private Button buttonRight;
|
private Button buttonRight;
|
||||||
private Button buttonUp;
|
private Button buttonUp;
|
||||||
private ComboBox comboBoxStrategy;
|
private ComboBox comboBoxStrategy;
|
||||||
private Button button1;
|
private Button buttonStrategyStep;
|
||||||
private Button buttonCreateWarship;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,21 @@ public partial class FormBattleship : Form
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private AbstractStrategy? _strategy;
|
private AbstractStrategy? _strategy;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
/// </summary>
|
||||||
|
public DrawingWarship SetWarship
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_drawingWarship = value;
|
||||||
|
_drawingWarship.SetPictureSize(pictureBoxBattleship.Width,
|
||||||
|
pictureBoxBattleship.Height);
|
||||||
|
comboBoxStrategy.Enabled = true;
|
||||||
|
_strategy = null;
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public FormBattleship()
|
public FormBattleship()
|
||||||
@@ -23,7 +38,7 @@ public partial class FormBattleship : Form
|
|||||||
_strategy = null;
|
_strategy = null;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
/// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void Draw()
|
private void Draw()
|
||||||
{
|
{
|
||||||
@@ -38,55 +53,6 @@ public partial class FormBattleship : Form
|
|||||||
pictureBoxBattleship.Image = bmp;
|
pictureBoxBattleship.Image = bmp;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="type"><3E><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|
||||||
private void CreateObject(string type)
|
|
||||||
{
|
|
||||||
Random random = new();
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case nameof(DrawingWarship):
|
|
||||||
_drawingWarship = new DrawingWarship(random.Next(100, 300),
|
|
||||||
random.Next(1000, 3000),
|
|
||||||
Color.FromArgb(random.Next(0, 256),
|
|
||||||
random.Next(0, 256), random.Next(0, 256)));
|
|
||||||
break;
|
|
||||||
case nameof(DrawingBattleship):
|
|
||||||
_drawingWarship = new DrawingBattleship(random.Next(100,
|
|
||||||
300), random.Next(1000, 3000),
|
|
||||||
Color.FromArgb(random.Next(0, 256),
|
|
||||||
random.Next(0, 256), random.Next(0, 256)),
|
|
||||||
Color.FromArgb(random.Next(0, 256),
|
|
||||||
random.Next(0, 256), random.Next(0, 256)),
|
|
||||||
Convert.ToBoolean(random.Next(0, 2)),
|
|
||||||
Convert.ToBoolean(random.Next(0, 2)));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_drawingWarship.SetPictureSize(pictureBoxBattleship.Width,
|
|
||||||
pictureBoxBattleship.Height);
|
|
||||||
_drawingWarship.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
|
||||||
_strategy = null;
|
|
||||||
comboBoxStrategy.Enabled = true;
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void ButtonCreateBattleship_Click(object sender, EventArgs e) =>
|
|
||||||
CreateObject(nameof(DrawingBattleship));
|
|
||||||
/// <summary>
|
|
||||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void ButtonCreateWarship_Click(object sender, EventArgs e) =>
|
|
||||||
CreateObject(nameof(DrawingWarship));
|
|
||||||
/// <summary>
|
|
||||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
@@ -111,8 +77,7 @@ public partial class FormBattleship : Form
|
|||||||
result = _drawingWarship.MoveTransport(DirectionType.Left);
|
result = _drawingWarship.MoveTransport(DirectionType.Left);
|
||||||
break;
|
break;
|
||||||
case "buttonRight":
|
case "buttonRight":
|
||||||
result =
|
result = _drawingWarship.MoveTransport(DirectionType.Right);
|
||||||
_drawingWarship.MoveTransport(DirectionType.Right);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (result)
|
if (result)
|
||||||
@@ -159,6 +124,4 @@ public partial class FormBattleship : Form
|
|||||||
_strategy = null;
|
_strategy = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
295
ProjectBattleship/ProjectBattleship/FormWarshipCollection.Designer.cs
generated
Normal file
295
ProjectBattleship/ProjectBattleship/FormWarshipCollection.Designer.cs
generated
Normal file
@@ -0,0 +1,295 @@
|
|||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ProjectBattleship
|
||||||
|
{
|
||||||
|
partial class FormWarshipCollection
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
groupBoxCollectionTools = new GroupBox();
|
||||||
|
panelCompanyTools = new Panel();
|
||||||
|
buttonRefresh = new Button();
|
||||||
|
buttonAddBattleship = new Button();
|
||||||
|
maskedTextBoxPosition = new MaskedTextBox();
|
||||||
|
buttonAddWarship = new Button();
|
||||||
|
buttonGoToCheck = new Button();
|
||||||
|
buttonRemoveWarship = new Button();
|
||||||
|
buttonCreateCompany = new Button();
|
||||||
|
comboBoxSelectorCompany = new ComboBox();
|
||||||
|
panelCollection = new Panel();
|
||||||
|
buttonCollectionDel = new Button();
|
||||||
|
listBoxCollection = new ListBox();
|
||||||
|
buttonCollectionAdd = new Button();
|
||||||
|
radioButtonList = new RadioButton();
|
||||||
|
radioButtonMassive = new RadioButton();
|
||||||
|
textBoxCollectionName = new TextBox();
|
||||||
|
labelCollection = new Label();
|
||||||
|
pictureBox = new PictureBox();
|
||||||
|
groupBoxCollectionTools.SuspendLayout();
|
||||||
|
panelCompanyTools.SuspendLayout();
|
||||||
|
panelCollection.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// groupBoxCollectionTools
|
||||||
|
//
|
||||||
|
groupBoxCollectionTools.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
groupBoxCollectionTools.Controls.Add(panelCompanyTools);
|
||||||
|
groupBoxCollectionTools.Controls.Add(buttonCreateCompany);
|
||||||
|
groupBoxCollectionTools.Controls.Add(comboBoxSelectorCompany);
|
||||||
|
groupBoxCollectionTools.Controls.Add(panelCollection);
|
||||||
|
groupBoxCollectionTools.Location = new Point(694, 0);
|
||||||
|
groupBoxCollectionTools.Name = "groupBoxCollectionTools";
|
||||||
|
groupBoxCollectionTools.Size = new Size(279, 594);
|
||||||
|
groupBoxCollectionTools.TabIndex = 1;
|
||||||
|
groupBoxCollectionTools.TabStop = false;
|
||||||
|
groupBoxCollectionTools.Text = "Инструменты";
|
||||||
|
//
|
||||||
|
// panelCompanyTools
|
||||||
|
//
|
||||||
|
panelCompanyTools.Controls.Add(buttonRefresh);
|
||||||
|
panelCompanyTools.Controls.Add(buttonAddBattleship);
|
||||||
|
panelCompanyTools.Controls.Add(maskedTextBoxPosition);
|
||||||
|
panelCompanyTools.Controls.Add(buttonAddWarship);
|
||||||
|
panelCompanyTools.Controls.Add(buttonGoToCheck);
|
||||||
|
panelCompanyTools.Controls.Add(buttonRemoveWarship);
|
||||||
|
panelCompanyTools.Enabled = false;
|
||||||
|
panelCompanyTools.Location = new Point(6, 348);
|
||||||
|
panelCompanyTools.Name = "panelCompanyTools";
|
||||||
|
panelCompanyTools.Size = new Size(267, 240);
|
||||||
|
panelCompanyTools.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// buttonRefresh
|
||||||
|
//
|
||||||
|
buttonRefresh.Location = new Point(8, 203);
|
||||||
|
buttonRefresh.Name = "buttonRefresh";
|
||||||
|
buttonRefresh.Size = new Size(251, 34);
|
||||||
|
buttonRefresh.TabIndex = 7;
|
||||||
|
buttonRefresh.Text = "Обновить";
|
||||||
|
buttonRefresh.UseVisualStyleBackColor = true;
|
||||||
|
buttonRefresh.Click += ButtonRefresh_Click;
|
||||||
|
//
|
||||||
|
// buttonAddBattleship
|
||||||
|
//
|
||||||
|
buttonAddBattleship.Location = new Point(8, 46);
|
||||||
|
buttonAddBattleship.Name = "buttonAddBattleship";
|
||||||
|
buttonAddBattleship.Size = new Size(251, 34);
|
||||||
|
buttonAddBattleship.TabIndex = 3;
|
||||||
|
buttonAddBattleship.Text = "Добавить линкор";
|
||||||
|
buttonAddBattleship.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddBattleship.Click += ButtonAddBattleship_Click;
|
||||||
|
//
|
||||||
|
// maskedTextBoxPosition
|
||||||
|
//
|
||||||
|
maskedTextBoxPosition.Location = new Point(8, 86);
|
||||||
|
maskedTextBoxPosition.Mask = "00";
|
||||||
|
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||||
|
maskedTextBoxPosition.Size = new Size(251, 31);
|
||||||
|
maskedTextBoxPosition.TabIndex = 8;
|
||||||
|
maskedTextBoxPosition.ValidatingType = typeof(int);
|
||||||
|
//
|
||||||
|
// buttonAddWarship
|
||||||
|
//
|
||||||
|
buttonAddWarship.Location = new Point(8, 6);
|
||||||
|
buttonAddWarship.Name = "buttonAddWarship";
|
||||||
|
buttonAddWarship.Size = new Size(251, 34);
|
||||||
|
buttonAddWarship.TabIndex = 2;
|
||||||
|
buttonAddWarship.Text = "Добавить военный корабль";
|
||||||
|
buttonAddWarship.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddWarship.Click += ButtonAddWarship_Click;
|
||||||
|
//
|
||||||
|
// buttonGoToCheck
|
||||||
|
//
|
||||||
|
buttonGoToCheck.Location = new Point(8, 163);
|
||||||
|
buttonGoToCheck.Name = "buttonGoToCheck";
|
||||||
|
buttonGoToCheck.Size = new Size(251, 34);
|
||||||
|
buttonGoToCheck.TabIndex = 6;
|
||||||
|
buttonGoToCheck.Text = "Передать на тесты";
|
||||||
|
buttonGoToCheck.UseVisualStyleBackColor = true;
|
||||||
|
buttonGoToCheck.Click += ButtonGoToCheck_Click;
|
||||||
|
//
|
||||||
|
// buttonRemoveWarship
|
||||||
|
//
|
||||||
|
buttonRemoveWarship.Location = new Point(8, 123);
|
||||||
|
buttonRemoveWarship.Name = "buttonRemoveWarship";
|
||||||
|
buttonRemoveWarship.Size = new Size(251, 34);
|
||||||
|
buttonRemoveWarship.TabIndex = 5;
|
||||||
|
buttonRemoveWarship.Text = "Удалить военный корабль";
|
||||||
|
buttonRemoveWarship.UseVisualStyleBackColor = true;
|
||||||
|
buttonRemoveWarship.Click += ButtonRemoveWarship_Click;
|
||||||
|
//
|
||||||
|
// buttonCreateCompany
|
||||||
|
//
|
||||||
|
buttonCreateCompany.Location = new Point(14, 314);
|
||||||
|
buttonCreateCompany.Name = "buttonCreateCompany";
|
||||||
|
buttonCreateCompany.Size = new Size(251, 34);
|
||||||
|
buttonCreateCompany.TabIndex = 10;
|
||||||
|
buttonCreateCompany.Text = "Создать компанию";
|
||||||
|
buttonCreateCompany.UseVisualStyleBackColor = true;
|
||||||
|
buttonCreateCompany.Click += ButtonCreateCompany_Click;
|
||||||
|
//
|
||||||
|
// comboBoxSelectorCompany
|
||||||
|
//
|
||||||
|
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxSelectorCompany.FormattingEnabled = true;
|
||||||
|
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
||||||
|
comboBoxSelectorCompany.Location = new Point(14, 275);
|
||||||
|
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||||
|
comboBoxSelectorCompany.Size = new Size(251, 33);
|
||||||
|
comboBoxSelectorCompany.TabIndex = 0;
|
||||||
|
comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
|
||||||
|
//
|
||||||
|
// panelCollection
|
||||||
|
//
|
||||||
|
panelCollection.Controls.Add(buttonCollectionDel);
|
||||||
|
panelCollection.Controls.Add(listBoxCollection);
|
||||||
|
panelCollection.Controls.Add(buttonCollectionAdd);
|
||||||
|
panelCollection.Controls.Add(radioButtonList);
|
||||||
|
panelCollection.Controls.Add(radioButtonMassive);
|
||||||
|
panelCollection.Controls.Add(textBoxCollectionName);
|
||||||
|
panelCollection.Controls.Add(labelCollection);
|
||||||
|
panelCollection.Location = new Point(6, 25);
|
||||||
|
panelCollection.Name = "panelCollection";
|
||||||
|
panelCollection.Size = new Size(267, 246);
|
||||||
|
panelCollection.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// buttonCollectionDel
|
||||||
|
//
|
||||||
|
buttonCollectionDel.Location = new Point(8, 210);
|
||||||
|
buttonCollectionDel.Name = "buttonCollectionDel";
|
||||||
|
buttonCollectionDel.Size = new Size(251, 34);
|
||||||
|
buttonCollectionDel.TabIndex = 7;
|
||||||
|
buttonCollectionDel.Text = "Удалить коллекцию";
|
||||||
|
buttonCollectionDel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCollectionDel.Click += ButtonCollectionDel_Click;
|
||||||
|
//
|
||||||
|
// listBoxCollection
|
||||||
|
//
|
||||||
|
listBoxCollection.FormattingEnabled = true;
|
||||||
|
listBoxCollection.ItemHeight = 25;
|
||||||
|
listBoxCollection.Location = new Point(8, 125);
|
||||||
|
listBoxCollection.Name = "listBoxCollection";
|
||||||
|
listBoxCollection.Size = new Size(251, 79);
|
||||||
|
listBoxCollection.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// buttonCollectionAdd
|
||||||
|
//
|
||||||
|
buttonCollectionAdd.Location = new Point(8, 85);
|
||||||
|
buttonCollectionAdd.Name = "buttonCollectionAdd";
|
||||||
|
buttonCollectionAdd.Size = new Size(251, 34);
|
||||||
|
buttonCollectionAdd.TabIndex = 5;
|
||||||
|
buttonCollectionAdd.Text = "Добавить коллекцию";
|
||||||
|
buttonCollectionAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonCollectionAdd.Click += ButtonCollectionAdd_Click;
|
||||||
|
//
|
||||||
|
// radioButtonList
|
||||||
|
//
|
||||||
|
radioButtonList.AutoSize = true;
|
||||||
|
radioButtonList.Location = new Point(150, 58);
|
||||||
|
radioButtonList.Name = "radioButtonList";
|
||||||
|
radioButtonList.Size = new Size(96, 29);
|
||||||
|
radioButtonList.TabIndex = 4;
|
||||||
|
radioButtonList.TabStop = true;
|
||||||
|
radioButtonList.Text = "Список";
|
||||||
|
radioButtonList.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// radioButtonMassive
|
||||||
|
//
|
||||||
|
radioButtonMassive.AutoSize = true;
|
||||||
|
radioButtonMassive.Location = new Point(19, 58);
|
||||||
|
radioButtonMassive.Name = "radioButtonMassive";
|
||||||
|
radioButtonMassive.Size = new Size(98, 29);
|
||||||
|
radioButtonMassive.TabIndex = 3;
|
||||||
|
radioButtonMassive.TabStop = true;
|
||||||
|
radioButtonMassive.Text = "Массив";
|
||||||
|
radioButtonMassive.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// textBoxCollectionName
|
||||||
|
//
|
||||||
|
textBoxCollectionName.Location = new Point(8, 26);
|
||||||
|
textBoxCollectionName.Name = "textBoxCollectionName";
|
||||||
|
textBoxCollectionName.Size = new Size(251, 31);
|
||||||
|
textBoxCollectionName.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// labelCollection
|
||||||
|
//
|
||||||
|
labelCollection.AutoSize = true;
|
||||||
|
labelCollection.Location = new Point(44, 1);
|
||||||
|
labelCollection.Name = "labelCollection";
|
||||||
|
labelCollection.Size = new Size(186, 25);
|
||||||
|
labelCollection.TabIndex = 1;
|
||||||
|
labelCollection.Text = "Название коллекции:";
|
||||||
|
//
|
||||||
|
// pictureBox
|
||||||
|
//
|
||||||
|
pictureBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
pictureBox.Location = new Point(0, 0);
|
||||||
|
pictureBox.Name = "pictureBox";
|
||||||
|
pictureBox.Size = new Size(688, 594);
|
||||||
|
pictureBox.TabIndex = 2;
|
||||||
|
pictureBox.TabStop = false;
|
||||||
|
//
|
||||||
|
// FormWarshipCollection
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(978, 594);
|
||||||
|
Controls.Add(groupBoxCollectionTools);
|
||||||
|
Controls.Add(pictureBox);
|
||||||
|
Name = "FormWarshipCollection";
|
||||||
|
Text = "Коллекция военных кораблей";
|
||||||
|
groupBoxCollectionTools.ResumeLayout(false);
|
||||||
|
panelCompanyTools.ResumeLayout(false);
|
||||||
|
panelCompanyTools.PerformLayout();
|
||||||
|
panelCollection.ResumeLayout(false);
|
||||||
|
panelCollection.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
private GroupBox groupBoxCollectionTools;
|
||||||
|
private Button buttonAddBattleship;
|
||||||
|
private Button buttonAddWarship;
|
||||||
|
private ComboBox comboBoxSelectorCompany;
|
||||||
|
private Button buttonRefresh;
|
||||||
|
private Button buttonGoToCheck;
|
||||||
|
private Button buttonRemoveWarship;
|
||||||
|
private MaskedTextBox maskedTextBoxPosition;
|
||||||
|
private PictureBox pictureBox;
|
||||||
|
private Panel panelCollection;
|
||||||
|
private TextBox textBoxCollectionName;
|
||||||
|
private Label labelCollection;
|
||||||
|
private Button buttonCollectionAdd;
|
||||||
|
private RadioButton radioButtonList;
|
||||||
|
private RadioButton radioButtonMassive;
|
||||||
|
private Button buttonCreateCompany;
|
||||||
|
private Button buttonCollectionDel;
|
||||||
|
private ListBox listBoxCollection;
|
||||||
|
private Panel panelCompanyTools;
|
||||||
|
}
|
||||||
|
}
|
||||||
271
ProjectBattleship/ProjectBattleship/FormWarshipCollection.cs
Normal file
271
ProjectBattleship/ProjectBattleship/FormWarshipCollection.cs
Normal file
@@ -0,0 +1,271 @@
|
|||||||
|
using ProjectBattleship.CollectionGenericObjects;
|
||||||
|
using ProjectBattleship.DrawingObject;
|
||||||
|
|
||||||
|
namespace ProjectBattleship;
|
||||||
|
/// <summary>
|
||||||
|
/// Форма работы с компанией и ее коллекцией
|
||||||
|
/// </summary>
|
||||||
|
public partial class FormWarshipCollection : Form
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Хранилише коллекций
|
||||||
|
/// </summary>
|
||||||
|
private readonly StorageCollection<DrawingWarship> _storageCollection;
|
||||||
|
/// <summary>
|
||||||
|
/// Компания
|
||||||
|
/// </summary>
|
||||||
|
private AbstractCompany? _company = null;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
public FormWarshipCollection()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_storageCollection = new();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Выбор компании
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender,
|
||||||
|
EventArgs e)
|
||||||
|
{
|
||||||
|
panelCompanyTools.Enabled = false;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление военного корабля
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonAddWarship_Click(object sender, EventArgs e) =>
|
||||||
|
CreateObject(nameof(DrawingWarship));
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление линкора
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonAddBattleship_Click(object sender, EventArgs e) =>
|
||||||
|
CreateObject(nameof(DrawingBattleship));
|
||||||
|
/// <summary>
|
||||||
|
/// Создание объекта класса-перемещения
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">Тип создаваемого объекта</param>
|
||||||
|
private void CreateObject(string type)
|
||||||
|
{
|
||||||
|
if (_company == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Random random = new();
|
||||||
|
DrawingWarship drawingWarship;
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case nameof(DrawingWarship):
|
||||||
|
drawingWarship = new DrawingWarship(random.Next(100, 300),
|
||||||
|
random.Next(1000, 3000), GetColor(random));
|
||||||
|
break;
|
||||||
|
case nameof(DrawingBattleship):
|
||||||
|
drawingWarship = new DrawingBattleship(random.Next(100, 300),
|
||||||
|
random.Next(1000, 3000),
|
||||||
|
GetColor(random), GetColor(random),
|
||||||
|
Convert.ToBoolean(random.Next(0, 2)),
|
||||||
|
Convert.ToBoolean(random.Next(0, 2)));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_company + drawingWarship != -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект добавлен");
|
||||||
|
pictureBox.Image = _company.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение цвета
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="random">Генератор случайных чисел</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static Color GetColor(Random random)
|
||||||
|
{
|
||||||
|
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0,
|
||||||
|
256), random.Next(0, 256));
|
||||||
|
ColorDialog dialog = new();
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
color = dialog.Color;
|
||||||
|
}
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonRemoveWarship_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text)
|
||||||
|
|| _company == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MessageBox.Show("Удалить объект?", "Удаление",
|
||||||
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||||
|
if (_company - pos != null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект удален");
|
||||||
|
pictureBox.Image = _company.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось удалить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Передача объекта в другую форму
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonGoToCheck_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_company == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DrawingWarship? warship = null;
|
||||||
|
int counter = 100;
|
||||||
|
while (warship == null)
|
||||||
|
{
|
||||||
|
warship = _company.GetRandomObject();
|
||||||
|
counter--;
|
||||||
|
if (counter <= 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (warship == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FormBattleship form = new()
|
||||||
|
{
|
||||||
|
SetWarship = warship
|
||||||
|
};
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перерисовка коллекции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonRefresh_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_company == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pictureBox.Image = _company.Show();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление коллекции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonCollectionAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(textBoxCollectionName.Text) ||
|
||||||
|
(!radioButtonList.Checked && !radioButtonMassive.Checked))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не все данные заполнены", "Ошибка",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CollectionType collectionType = CollectionType.None;
|
||||||
|
if (radioButtonMassive.Checked)
|
||||||
|
{
|
||||||
|
collectionType = CollectionType.Massive;
|
||||||
|
}
|
||||||
|
else if (radioButtonList.Checked)
|
||||||
|
{
|
||||||
|
collectionType = CollectionType.List;
|
||||||
|
}
|
||||||
|
_storageCollection.AddCollection(textBoxCollectionName.Text,
|
||||||
|
collectionType);
|
||||||
|
RerfreshListBoxItems();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление коллекции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonCollectionDel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Коллекция не выбрана");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MessageBox.Show("Вы хотите удалить эту коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
string? name = listBoxCollection.SelectedItem.ToString();
|
||||||
|
if (!string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
_storageCollection.DelCollection(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RerfreshListBoxItems();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Обновление списка в listBoxCollection
|
||||||
|
/// </summary>
|
||||||
|
private void RerfreshListBoxItems()
|
||||||
|
{
|
||||||
|
listBoxCollection.Items.Clear();
|
||||||
|
for (int i = 0; i < _storageCollection.Keys?.Count; ++i)
|
||||||
|
{
|
||||||
|
string? colName = _storageCollection.Keys?[i];
|
||||||
|
if (!string.IsNullOrEmpty(colName))
|
||||||
|
{
|
||||||
|
listBoxCollection.Items.Add(colName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Создание компании
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonCreateCompany_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listBoxCollection.SelectedIndex < 0 ||
|
||||||
|
listBoxCollection.SelectedItem == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Коллекция не выбрана");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ICollectionGenericObjects<DrawingWarship>? collection =
|
||||||
|
_storageCollection[listBoxCollection.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if (collection == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Коллекция не проинициализирована");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (comboBoxSelectorCompany.Text)
|
||||||
|
{
|
||||||
|
case "Хранилище":
|
||||||
|
_company = new Docks(pictureBox.Width,
|
||||||
|
pictureBox.Height, collection);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
panelCompanyTools.Enabled = true;
|
||||||
|
RerfreshListBoxItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
120
ProjectBattleship/ProjectBattleship/FormWarshipCollection.resx
Normal file
120
ProjectBattleship/ProjectBattleship/FormWarshipCollection.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>
|
||||||
@@ -9,7 +9,7 @@ namespace ProjectBattleship
|
|||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new FormBattleship());
|
Application.Run(new FormWarshipCollection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user