Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b8f5f48a24 | ||
|
6b6b89fcf0 | ||
|
29cd0d9ced | ||
|
484d9e6cba | ||
|
6f933314ab | ||
|
0e2ce08130 | ||
|
c5f197893f | ||
|
468abaf5f8 | ||
|
e464cbb14e | ||
|
9632e3e1d0 |
132
ProjStormtrooper/ProjStormtrooper/AbstractStrategy.cs
Normal file
132
ProjStormtrooper/ProjStormtrooper/AbstractStrategy.cs
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-стратегия перемещения объекта
|
||||||
|
/// </summary>
|
||||||
|
public abstract class AbstractStrategy
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещаемый объект
|
||||||
|
/// </summary>
|
||||||
|
private IMoveableObject? _moveableObject;
|
||||||
|
/// <summary>
|
||||||
|
/// Статус перемещения
|
||||||
|
/// </summary>
|
||||||
|
private Status _state = Status.NotInit;
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина поля
|
||||||
|
/// </summary>
|
||||||
|
protected int FieldWidth { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Высота поля
|
||||||
|
/// </summary>
|
||||||
|
protected int FieldHeight { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Статус перемещения
|
||||||
|
/// </summary>
|
||||||
|
public Status 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 = Status.NotInit;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_state = Status.InProgress;
|
||||||
|
_moveableObject = moveableObject;
|
||||||
|
FieldWidth = width;
|
||||||
|
FieldHeight = height;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг перемещения
|
||||||
|
/// </summary>
|
||||||
|
public void MakeStep()
|
||||||
|
{
|
||||||
|
if (_state != Status.InProgress)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (IsTargetDestinaion())
|
||||||
|
{
|
||||||
|
_state = Status.Finish;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveToTarget();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение влево
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
protected bool MoveLeft() => MoveTo(Direction.Left);
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение вправо
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
protected bool MoveRight() => MoveTo(Direction.Right);
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение вверх
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
protected bool MoveUp() => MoveTo(Direction.Up);
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение вниз
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
protected bool MoveDown() => MoveTo(Direction.Down);
|
||||||
|
/// <summary>
|
||||||
|
/// Параметры объекта
|
||||||
|
/// </summary>
|
||||||
|
protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition;
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected int? GetStep()
|
||||||
|
{
|
||||||
|
if (_state != Status.InProgress)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return _moveableObject?.GetStep;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение к цели
|
||||||
|
/// </summary>
|
||||||
|
protected abstract void MoveToTarget();
|
||||||
|
/// <summary>
|
||||||
|
/// Достигнута ли цель
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected abstract bool IsTargetDestinaion();
|
||||||
|
/// <summary>
|
||||||
|
/// Попытка перемещения в требуемом направлении
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="directionType">Направление</param>
|
||||||
|
/// <returns>Результат попытки (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
private bool MoveTo(Direction directionType)
|
||||||
|
{
|
||||||
|
if (_state != Status.InProgress)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (_moveableObject?.CheckCanMove(directionType) ?? false)
|
||||||
|
{
|
||||||
|
_moveableObject.MoveObject(directionType);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
ProjStormtrooper/ProjStormtrooper/AppSettings.json
Normal file
15
ProjStormtrooper/ProjStormtrooper/AppSettings.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"Serilog": {
|
||||||
|
"Using": [ "Serilog.Sinks.File" ],
|
||||||
|
"MinimumLevel": "Debug",
|
||||||
|
"WriteTo": [
|
||||||
|
{
|
||||||
|
"Name": "File",
|
||||||
|
"Args": {"path": "log.txt"}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Properties": {
|
||||||
|
"Application": "Planes"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
28
ProjStormtrooper/ProjStormtrooper/Direction.cs
Normal file
28
ProjStormtrooper/ProjStormtrooper/Direction.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
public enum Direction
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Вверх
|
||||||
|
/// </summary>
|
||||||
|
Up = 1,
|
||||||
|
/// <summary>
|
||||||
|
/// Вниз
|
||||||
|
/// </summary>
|
||||||
|
Down = 2,
|
||||||
|
/// <summary>
|
||||||
|
/// Влево
|
||||||
|
/// </summary>
|
||||||
|
Left = 3,
|
||||||
|
/// <summary>
|
||||||
|
/// Вправо
|
||||||
|
/// </summary>
|
||||||
|
Right = 4
|
||||||
|
}
|
||||||
|
}
|
38
ProjStormtrooper/ProjStormtrooper/DrawingObjectPlane.cs
Normal file
38
ProjStormtrooper/ProjStormtrooper/DrawingObjectPlane.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Реализация интерфейса IDrawningObject для работы с объектом DrawningPlane (паттерн Adapter)
|
||||||
|
/// </summary>
|
||||||
|
public class DrawingObjectPlane : IMoveableObject
|
||||||
|
{
|
||||||
|
private readonly DrawingPlane? _drawingPlane = null;
|
||||||
|
public DrawingObjectPlane(DrawingPlane drawingPlane)
|
||||||
|
{
|
||||||
|
_drawingPlane = drawingPlane;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObjectParameters? GetObjectPosition
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_drawingPlane == null || _drawingPlane.EntityPlane == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new ObjectParameters(_drawingPlane.GetPosX, _drawingPlane.GetPosY, _drawingPlane.GetWidth, _drawingPlane.GetHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetStep => (int)(_drawingPlane?.EntityPlane?.Step ?? 0);
|
||||||
|
|
||||||
|
public bool CheckCanMove(Direction direction) => _drawingPlane?.CanMove(direction) ?? false;
|
||||||
|
|
||||||
|
public void MoveObject(Direction direction) => _drawingPlane?.MoveTransport(direction);
|
||||||
|
}
|
||||||
|
}
|
243
ProjStormtrooper/ProjStormtrooper/DrawingPlane.cs
Normal file
243
ProjStormtrooper/ProjStormtrooper/DrawingPlane.cs
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Класс отвечающий за прорисовку и перемещение объекта-сущности
|
||||||
|
/// </summary>
|
||||||
|
public class DrawingPlane
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-сущность
|
||||||
|
/// </summary>
|
||||||
|
public EntityPlane? EntityPlane { get; protected set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина окна
|
||||||
|
/// </summary>
|
||||||
|
public int _pictureWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота окна
|
||||||
|
/// </summary>
|
||||||
|
public int _pictureHeight;
|
||||||
|
/// <summary>
|
||||||
|
/// Левая координата начала прорисовки
|
||||||
|
/// </summary>
|
||||||
|
protected int _startPosX;
|
||||||
|
/// <summary>
|
||||||
|
/// Верхняя координата начала прорисовки
|
||||||
|
/// </summary>
|
||||||
|
protected int _startPosY;
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина прорисовки
|
||||||
|
/// </summary>
|
||||||
|
protected readonly int _planeWidth = 110;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота прорисовки
|
||||||
|
/// </summary>
|
||||||
|
protected readonly int _planeHeight = 110;
|
||||||
|
/// <summary>
|
||||||
|
/// Координата X объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetPosX => _startPosX;
|
||||||
|
/// <summary>
|
||||||
|
/// Координата Y объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetPosY => _startPosY;
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetWidth => _planeWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetHeight => _planeHeight;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
/// <param name="width">Ширина картинки</param>
|
||||||
|
/// <param name="height">Высота картинки</param>
|
||||||
|
public DrawingPlane(int speed, double weight, Color bodyColor, int width, int height)
|
||||||
|
{
|
||||||
|
if (width < _planeWidth && height < _planeHeight)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_pictureWidth = width;
|
||||||
|
_pictureHeight = height;
|
||||||
|
EntityPlane = new EntityPlane(speed, weight, bodyColor);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
/// <param name="width">Ширина окна</param>
|
||||||
|
/// <param name="height">Высота окна</param>
|
||||||
|
/// <param name="planeWidth">Ширина объекта</param>
|
||||||
|
/// <param name="planeHeight">Высота объекта</param>
|
||||||
|
protected DrawingPlane(int speed, double weight, Color bodyColor,
|
||||||
|
int width, int height, int planeWidth, int planeHeight)
|
||||||
|
{
|
||||||
|
if (width < planeWidth && height < planeHeight)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_pictureWidth = width;
|
||||||
|
_pictureHeight = height;
|
||||||
|
_planeWidth = planeWidth;
|
||||||
|
_planeHeight = planeHeight;
|
||||||
|
EntityPlane = new EntityPlane(speed, weight, bodyColor);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Проверка, что объект может переместится по указанному направлению
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction">Направление</param>
|
||||||
|
/// <returns>true - можно переместится по указанному направлению</returns>
|
||||||
|
public bool CanMove(Direction direction)
|
||||||
|
{
|
||||||
|
if (EntityPlane == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return direction switch
|
||||||
|
{
|
||||||
|
//вверх
|
||||||
|
Direction.Up => _startPosY - EntityPlane.Step > 0,
|
||||||
|
//вниз
|
||||||
|
Direction.Down => _startPosY + _planeHeight + EntityPlane.Step < _pictureHeight,
|
||||||
|
//влево
|
||||||
|
Direction.Left => _startPosX - EntityPlane.Step > 0,
|
||||||
|
//вправо
|
||||||
|
Direction.Right => _startPosX + _planeWidth + EntityPlane.Step < _pictureWidth,
|
||||||
|
_ => false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Установка позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">Координата X</param>
|
||||||
|
/// <param name="y">Координата Y</param>
|
||||||
|
public void SetPosition(int x, int y)
|
||||||
|
{
|
||||||
|
if (x < 0)
|
||||||
|
{
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
else if (x > _pictureWidth - _planeWidth)
|
||||||
|
{
|
||||||
|
x = _pictureWidth - _planeWidth;
|
||||||
|
}
|
||||||
|
_startPosX = x;
|
||||||
|
|
||||||
|
if (y < 0)
|
||||||
|
{
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
else if (y > _pictureHeight - _planeHeight)
|
||||||
|
{
|
||||||
|
y = _pictureHeight - _planeHeight;
|
||||||
|
}
|
||||||
|
_startPosY = y;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction">Направление перемещения</param>
|
||||||
|
public void MoveTransport(Direction direction)
|
||||||
|
{
|
||||||
|
if (!CanMove(direction) || EntityPlane == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
// Вверх
|
||||||
|
case Direction.Up:
|
||||||
|
_startPosY -= (int)EntityPlane.Step;
|
||||||
|
break;
|
||||||
|
// Вниз
|
||||||
|
case Direction.Down:
|
||||||
|
_startPosY += (int)EntityPlane.Step;
|
||||||
|
break;
|
||||||
|
// Влево
|
||||||
|
case Direction.Left:
|
||||||
|
_startPosX -= (int)EntityPlane.Step;
|
||||||
|
break;
|
||||||
|
// Вправо
|
||||||
|
case Direction.Right:
|
||||||
|
_startPosX += (int)EntityPlane.Step;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Прорисовка объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
public virtual void DrawTransport(Graphics g)
|
||||||
|
{
|
||||||
|
if (EntityPlane == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Pen penBlack = new Pen(Color.Black);
|
||||||
|
Brush brushBlack = new SolidBrush(Color.Black);
|
||||||
|
Brush brushBodyColor = new SolidBrush(EntityPlane.BodyColor);
|
||||||
|
|
||||||
|
// Высота фюзеляжа
|
||||||
|
int bodyHeight = _planeHeight / 9;
|
||||||
|
|
||||||
|
// Рисуем нос
|
||||||
|
|
||||||
|
Point[] pointsCockPit = {
|
||||||
|
new Point(_startPosX, _startPosY + _planeHeight / 2),
|
||||||
|
new Point(_startPosX + _planeWidth / 8, _startPosY + _planeHeight / 2 - bodyHeight / 2),
|
||||||
|
new Point(_startPosX + _planeWidth / 8, _startPosY + _planeHeight / 2 + bodyHeight / 2)
|
||||||
|
};
|
||||||
|
|
||||||
|
g.FillPolygon(brushBlack, pointsCockPit);
|
||||||
|
|
||||||
|
// Рисуем крылья
|
||||||
|
|
||||||
|
Point[] pointsWings = {
|
||||||
|
new Point(_startPosX + _planeWidth / 2, _startPosY),
|
||||||
|
new Point(_startPosX + _planeWidth / 2 + _planeWidth / 15, _startPosY),
|
||||||
|
new Point(_startPosX + _planeWidth / 2 + _planeWidth / 6, _startPosY + _planeHeight / 2),
|
||||||
|
new Point(_startPosX + _planeWidth / 2 + _planeWidth / 15, _startPosY + _planeHeight),
|
||||||
|
new Point(_startPosX + _planeWidth / 2 , _startPosY + _planeHeight)
|
||||||
|
};
|
||||||
|
|
||||||
|
g.FillPolygon(brushBodyColor, pointsWings);
|
||||||
|
g.DrawPolygon(penBlack, pointsWings);
|
||||||
|
|
||||||
|
// Рисуем хвостовое оперение
|
||||||
|
|
||||||
|
Point[] pointsTail = {
|
||||||
|
new Point(_startPosX + _planeWidth, _startPosY + _planeHeight / 2 - _planeHeight / 3),
|
||||||
|
new Point(_startPosX + _planeWidth - _planeWidth / 8, _startPosY + _planeHeight / 2 - _planeHeight / 8),
|
||||||
|
new Point(_startPosX + _planeWidth - _planeWidth / 8, _startPosY + _planeHeight / 2 + _planeHeight / 8),
|
||||||
|
new Point(_startPosX + _planeWidth, _startPosY + _planeHeight / 2 + _planeHeight / 3)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
g.FillPolygon(brushBodyColor, pointsTail);
|
||||||
|
g.DrawPolygon(penBlack, pointsTail);
|
||||||
|
|
||||||
|
// Рисуем фюзеляж
|
||||||
|
|
||||||
|
g.FillRectangle(brushBodyColor, _startPosX + _planeWidth / 8, _startPosY + _planeHeight / 2 - bodyHeight / 2, _planeWidth - _planeWidth / 8, bodyHeight);
|
||||||
|
g.DrawRectangle(penBlack, _startPosX + _planeWidth / 8, _startPosY + _planeHeight / 2 - bodyHeight / 2, _planeWidth - _planeWidth / 8, bodyHeight);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение объекта IMoveableObject из объекта DrawingPlane
|
||||||
|
/// </summary>
|
||||||
|
public IMoveableObject GetMoveableObject => new DrawingObjectPlane(this);
|
||||||
|
}
|
||||||
|
}
|
63
ProjStormtrooper/ProjStormtrooper/DrawingPlaneEqutables.cs
Normal file
63
ProjStormtrooper/ProjStormtrooper/DrawingPlaneEqutables.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
public class DrawingPlaneEqutables : IEqualityComparer<DrawingPlane>
|
||||||
|
{
|
||||||
|
public bool Equals(DrawingPlane? x, DrawingPlane? y)
|
||||||
|
{
|
||||||
|
if (x == null || x.EntityPlane == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(x));
|
||||||
|
}
|
||||||
|
if (y == null || y.EntityPlane == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(y));
|
||||||
|
}
|
||||||
|
if (x.GetType().Name != y.GetType().Name)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (x.EntityPlane.Speed != y.EntityPlane.Speed)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (x.EntityPlane.Weight != y.EntityPlane.Weight)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (x.EntityPlane.BodyColor != y.EntityPlane.BodyColor)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (x is DrawingStormtrooper && y is DrawingStormtrooper)
|
||||||
|
{
|
||||||
|
var xStormtrooper = (x.EntityPlane as EntityStormtrooper);
|
||||||
|
var yStormtrooper = (y.EntityPlane as EntityStormtrooper);
|
||||||
|
if (xStormtrooper?.AdditionalColor != yStormtrooper?.AdditionalColor)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (xStormtrooper?.Bombs != yStormtrooper?.Bombs)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (xStormtrooper?.Rockets != yStormtrooper?.Rockets)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetHashCode([DisallowNull] DrawingPlane obj)
|
||||||
|
{
|
||||||
|
return obj.GetHashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
176
ProjStormtrooper/ProjStormtrooper/DrawingStormtrooper.cs
Normal file
176
ProjStormtrooper/ProjStormtrooper/DrawingStormtrooper.cs
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
public class DrawingStormtrooper : DrawingPlane
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
|
/// <param name="rockets">Признак наличия ракет</param>
|
||||||
|
/// <param name="bombs">Признак наличия бомб</param>
|
||||||
|
/// <param name="width">Ширина картинки</param>
|
||||||
|
/// <param name="height">Высота картинки</param>
|
||||||
|
public DrawingStormtrooper(int speed, double weight, Color bodyColor,
|
||||||
|
Color additionalColor, bool rockets, bool bombs,
|
||||||
|
int width, int height) : base(speed, weight, bodyColor, width, height, 140, 90)
|
||||||
|
{
|
||||||
|
if (EntityPlane != null)
|
||||||
|
{
|
||||||
|
EntityPlane = new EntityStormtrooper(speed, weight, bodyColor, additionalColor, rockets, bombs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Прорисовка объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
public override void DrawTransport(Graphics g)
|
||||||
|
{
|
||||||
|
if (EntityPlane is not EntityStormtrooper stormtrooper)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Pen penBlack = new Pen(Color.Black);
|
||||||
|
Brush brushBlack = new SolidBrush(Color.Black);
|
||||||
|
Brush brushAdditionalColor = new SolidBrush(stormtrooper.AdditionalColor);
|
||||||
|
|
||||||
|
// Высота фюзеляжа
|
||||||
|
int bodyHeight = _planeHeight / 9;
|
||||||
|
|
||||||
|
// Рисуем бомбы
|
||||||
|
if (stormtrooper.Bombs)
|
||||||
|
{
|
||||||
|
Point[] pointsBombTail = {
|
||||||
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 8 + bodyHeight * 3 - 5,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 - _planeHeight / 3 + bodyHeight / 2),
|
||||||
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 8 + bodyHeight * 3 + 5,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 - _planeHeight / 3 + bodyHeight / 2 - 5),
|
||||||
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 8 + bodyHeight * 3 + 5,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 - _planeHeight / 3 + bodyHeight / 2 + 5),
|
||||||
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 8 + bodyHeight * 3 - 5,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 - _planeHeight / 3 + bodyHeight / 2)
|
||||||
|
};
|
||||||
|
|
||||||
|
g.FillPolygon(brushAdditionalColor, pointsBombTail);
|
||||||
|
g.DrawPolygon(penBlack, pointsBombTail);
|
||||||
|
|
||||||
|
for (int i = 0; i < pointsBombTail.Length; i++)
|
||||||
|
{
|
||||||
|
Point p = pointsBombTail[i];
|
||||||
|
p.Y = _startPosY + _planeHeight - (p.Y - _startPosY);
|
||||||
|
pointsBombTail[i] = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
g.FillPolygon(brushAdditionalColor, pointsBombTail);
|
||||||
|
g.DrawPolygon(penBlack, pointsBombTail);
|
||||||
|
|
||||||
|
g.FillEllipse(brushAdditionalColor,
|
||||||
|
_startPosX + _planeWidth / 2 - _planeWidth / 8,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 - _planeHeight / 3,
|
||||||
|
bodyHeight * 3,
|
||||||
|
bodyHeight);
|
||||||
|
g.DrawEllipse(penBlack,
|
||||||
|
_startPosX + _planeWidth / 2 - _planeWidth / 8,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 - _planeHeight / 3,
|
||||||
|
bodyHeight * 3,
|
||||||
|
bodyHeight);
|
||||||
|
|
||||||
|
g.FillEllipse(brushAdditionalColor,
|
||||||
|
_startPosX + _planeWidth / 2 - _planeWidth / 8,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 + _planeHeight / 3,
|
||||||
|
bodyHeight * 3,
|
||||||
|
bodyHeight);
|
||||||
|
g.DrawEllipse(penBlack,
|
||||||
|
_startPosX + _planeWidth / 2 - _planeWidth / 8,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 + _planeHeight / 3,
|
||||||
|
bodyHeight * 3,
|
||||||
|
bodyHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Рисуем ракеты
|
||||||
|
if (stormtrooper.Rockets)
|
||||||
|
{
|
||||||
|
int rocketWidth = bodyHeight * 4;
|
||||||
|
int rocketHeight = bodyHeight / 2;
|
||||||
|
|
||||||
|
Brush brushRed = new SolidBrush(Color.Red);
|
||||||
|
|
||||||
|
Point[] pointsRocketCockPit = {
|
||||||
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 5 - rocketHeight,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight / 2),
|
||||||
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 5,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight - bodyHeight / 2),
|
||||||
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 5,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight)
|
||||||
|
};
|
||||||
|
|
||||||
|
Point[] pointsRocketTail = {
|
||||||
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 5 - rocketHeight + rocketWidth - 10,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight / 2),
|
||||||
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 5 + rocketWidth,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight * 2 + rocketHeight / 2),
|
||||||
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 5 + rocketWidth,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight + bodyHeight / 2 - rocketHeight / 2)
|
||||||
|
};
|
||||||
|
|
||||||
|
g.FillPolygon(brushRed, pointsRocketCockPit);
|
||||||
|
g.DrawPolygon(penBlack, pointsRocketCockPit);
|
||||||
|
|
||||||
|
g.FillPolygon(brushBlack, pointsRocketTail);
|
||||||
|
g.DrawPolygon(penBlack, pointsRocketTail);
|
||||||
|
|
||||||
|
for (int i = 0; i < pointsRocketCockPit.Length; i++)
|
||||||
|
{
|
||||||
|
Point p = pointsRocketCockPit[i];
|
||||||
|
p.Y = _startPosY + _planeHeight - (p.Y - _startPosY);
|
||||||
|
pointsRocketCockPit[i] = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < pointsRocketTail.Length; i++)
|
||||||
|
{
|
||||||
|
Point p = pointsRocketTail[i];
|
||||||
|
p.Y = _startPosY + _planeHeight - (p.Y - _startPosY);
|
||||||
|
pointsRocketTail[i] = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
g.FillPolygon(brushRed, pointsRocketCockPit);
|
||||||
|
g.DrawPolygon(penBlack, pointsRocketCockPit);
|
||||||
|
|
||||||
|
g.FillPolygon(brushBlack, pointsRocketTail);
|
||||||
|
g.DrawPolygon(penBlack, pointsRocketTail);
|
||||||
|
|
||||||
|
g.FillRectangle(brushAdditionalColor,
|
||||||
|
_startPosX + _planeWidth / 2 - _planeWidth / 5,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight - bodyHeight / 2,
|
||||||
|
rocketWidth,
|
||||||
|
rocketHeight);
|
||||||
|
g.DrawRectangle(penBlack,
|
||||||
|
_startPosX + _planeWidth / 2 - _planeWidth / 5,
|
||||||
|
_startPosY + _planeHeight / 2 - bodyHeight - bodyHeight / 2,
|
||||||
|
rocketWidth,
|
||||||
|
rocketHeight);
|
||||||
|
|
||||||
|
g.FillRectangle(brushAdditionalColor,
|
||||||
|
_startPosX + _planeWidth / 2 - _planeWidth / 5,
|
||||||
|
_startPosY + _planeHeight / 2 + bodyHeight / 2 + bodyHeight / 2,
|
||||||
|
rocketWidth,
|
||||||
|
rocketHeight);
|
||||||
|
g.DrawRectangle(penBlack,
|
||||||
|
_startPosX + _planeWidth / 2 - _planeWidth / 5,
|
||||||
|
_startPosY + _planeHeight / 2 + bodyHeight / 2 + bodyHeight / 2,
|
||||||
|
rocketWidth,
|
||||||
|
rocketHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
base.DrawTransport(g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
49
ProjStormtrooper/ProjStormtrooper/EntityPlane.cs
Normal file
49
ProjStormtrooper/ProjStormtrooper/EntityPlane.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using static System.Reflection.Metadata.BlobBuilder;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-сущность "Самолет"
|
||||||
|
/// </summary>
|
||||||
|
public class EntityPlane
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Скорость
|
||||||
|
/// </summary>
|
||||||
|
public int Speed { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Вес
|
||||||
|
/// </summary>
|
||||||
|
public double Weight { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Основной цвет
|
||||||
|
/// </summary>
|
||||||
|
public Color BodyColor { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг перемещения
|
||||||
|
/// </summary>
|
||||||
|
public double Step => (double)Speed * 250 / Weight;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed"></param>
|
||||||
|
/// <param name="weight"></param>
|
||||||
|
/// <param name="bodyColor"></param>
|
||||||
|
public EntityPlane(int speed, double weight, Color bodyColor)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
BodyColor = bodyColor;
|
||||||
|
}
|
||||||
|
public void SetColor(Color color)
|
||||||
|
{
|
||||||
|
BodyColor = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
32
ProjStormtrooper/ProjStormtrooper/EntityStormtrooper.cs
Normal file
32
ProjStormtrooper/ProjStormtrooper/EntityStormtrooper.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
public class EntityStormtrooper : EntityPlane
|
||||||
|
{
|
||||||
|
public Color AdditionalColor { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Признак (опция) наличия ракет
|
||||||
|
/// </summary>
|
||||||
|
public bool Rockets { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Признак (опция) наличия бомб
|
||||||
|
/// </summary>
|
||||||
|
public bool Bombs { get; private set; }
|
||||||
|
public EntityStormtrooper(int speed, double weight, Color bodyColor,
|
||||||
|
Color additionalColor, bool rockets, bool bombs) : base(speed, weight, bodyColor)
|
||||||
|
{
|
||||||
|
AdditionalColor = additionalColor;
|
||||||
|
Rockets = rockets;
|
||||||
|
Bombs = bombs;
|
||||||
|
}
|
||||||
|
public void SetAdditionalColor(Color color)
|
||||||
|
{
|
||||||
|
AdditionalColor = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
53
ProjStormtrooper/ProjStormtrooper/ExtensionDrawingPlane.cs
Normal file
53
ProjStormtrooper/ProjStormtrooper/ExtensionDrawingPlane.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
public static class ExtensionDrawingPlane
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Создание объекта из строки
|
||||||
|
/// </summary>
|
||||||
|
public static DrawingPlane? CreateDrawingPlane(this string info, char separatorForObject, int width, int height)
|
||||||
|
{
|
||||||
|
string[] strs = info.Split(separatorForObject);
|
||||||
|
if (strs.Length == 3)
|
||||||
|
{
|
||||||
|
return new DrawingPlane(Convert.ToInt32(strs[0]), Convert.ToInt32(strs[1]), Color.FromName(strs[2]), width, height);
|
||||||
|
}
|
||||||
|
if (strs.Length == 6)
|
||||||
|
{
|
||||||
|
return new DrawingStormtrooper(
|
||||||
|
Convert.ToInt32(strs[0]),
|
||||||
|
Convert.ToInt32(strs[1]),
|
||||||
|
Color.FromName(strs[2]),
|
||||||
|
Color.FromName(strs[3]),
|
||||||
|
Convert.ToBoolean(strs[4]),
|
||||||
|
Convert.ToBoolean(strs[5]),
|
||||||
|
width,
|
||||||
|
height);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение данных для сохранения в файл
|
||||||
|
/// </summary>
|
||||||
|
public static string GetDataForSave(this DrawingPlane drawningPlane, char separatorForObject)
|
||||||
|
{
|
||||||
|
var plane = drawningPlane.EntityPlane;
|
||||||
|
if (plane == null)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
var str = $"{plane.Speed}{separatorForObject}{plane.Weight}{separatorForObject}{plane.BodyColor.Name}";
|
||||||
|
if (plane is not EntityStormtrooper stormtrooper)
|
||||||
|
{
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
return $"{str}{separatorForObject}{stormtrooper.AdditionalColor.Name}{separatorForObject}{stormtrooper.Rockets}{separatorForObject}{stormtrooper.Bombs}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
34
ProjStormtrooper/ProjStormtrooper/IMoveableObject.cs
Normal file
34
ProjStormtrooper/ProjStormtrooper/IMoveableObject.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Интерфейс для работы с перемещаемым объектом
|
||||||
|
/// </summary>
|
||||||
|
public interface IMoveableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Получение координаты X объекта
|
||||||
|
/// </summary>
|
||||||
|
ObjectParameters? GetObjectPosition { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг объекта
|
||||||
|
/// </summary>
|
||||||
|
int GetStep { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Проверка, можно ли переместиться по нужному направлению
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool CheckCanMove(Direction direction);
|
||||||
|
/// <summary>
|
||||||
|
/// Изменение направления перемещения объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction">Направление</param>
|
||||||
|
void MoveObject(Direction direction);
|
||||||
|
}
|
||||||
|
}
|
58
ProjStormtrooper/ProjStormtrooper/MoveToCenter.cs
Normal file
58
ProjStormtrooper/ProjStormtrooper/MoveToCenter.cs
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Стратегия перемещения объекта в центр экрана
|
||||||
|
/// </summary>
|
||||||
|
public class MoveToCenter : AbstractStrategy
|
||||||
|
{
|
||||||
|
protected override bool IsTargetDestinaion()
|
||||||
|
{
|
||||||
|
var objParams = GetObjectParameters;
|
||||||
|
if (objParams == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return objParams.ObjectMiddleHorizontal <= FieldWidth / 2 && objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
||||||
|
objParams.ObjectMiddleVertical <= FieldHeight / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void MoveToTarget()
|
||||||
|
{
|
||||||
|
var objParams = GetObjectParameters;
|
||||||
|
if (objParams == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
|
||||||
|
if (Math.Abs(diffX) > GetStep())
|
||||||
|
{
|
||||||
|
if (diffX > 0)
|
||||||
|
{
|
||||||
|
MoveLeft();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MoveRight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
|
||||||
|
if (Math.Abs(diffY) > GetStep())
|
||||||
|
{
|
||||||
|
if (diffY > 0)
|
||||||
|
{
|
||||||
|
MoveUp();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MoveDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
ProjStormtrooper/ProjStormtrooper/MoveToRightBottom.cs
Normal file
38
ProjStormtrooper/ProjStormtrooper/MoveToRightBottom.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
public class MoveToRightBottom : AbstractStrategy
|
||||||
|
{
|
||||||
|
protected override bool IsTargetDestinaion()
|
||||||
|
{
|
||||||
|
var objParams = GetObjectParameters;
|
||||||
|
if (objParams == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return objParams.RightBorder >= FieldWidth - GetStep() && objParams.DownBorder >= FieldHeight - GetStep();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void MoveToTarget()
|
||||||
|
{
|
||||||
|
var objParams = GetObjectParameters;
|
||||||
|
if (objParams == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (objParams.RightBorder < FieldWidth - GetStep())
|
||||||
|
{
|
||||||
|
MoveRight();
|
||||||
|
}
|
||||||
|
if (objParams.TopBorder < FieldHeight - GetStep())
|
||||||
|
{
|
||||||
|
MoveDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
57
ProjStormtrooper/ProjStormtrooper/ObjectParameters.cs
Normal file
57
ProjStormtrooper/ProjStormtrooper/ObjectParameters.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Параметры-координаты объекта
|
||||||
|
/// </summary>
|
||||||
|
public class ObjectParameters
|
||||||
|
{
|
||||||
|
private readonly int _x;
|
||||||
|
private readonly int _y;
|
||||||
|
private readonly int _width;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
276
ProjStormtrooper/ProjStormtrooper/PlaneCollection.Designer.cs
generated
Normal file
276
ProjStormtrooper/ProjStormtrooper/PlaneCollection.Designer.cs
generated
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
partial class PlaneCollection
|
||||||
|
{
|
||||||
|
/// <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();
|
||||||
|
buttonSortByType = new Button();
|
||||||
|
buttonSortByColor = new Button();
|
||||||
|
groupBoxStorages = new GroupBox();
|
||||||
|
buttonRemoveStorage = new Button();
|
||||||
|
listBoxStorages = new ListBox();
|
||||||
|
buttonAddStorage = new Button();
|
||||||
|
textBoxStorageName = new TextBox();
|
||||||
|
maskedTextBoxNumber = new MaskedTextBox();
|
||||||
|
buttonRefreshCollection = new Button();
|
||||||
|
buttonRemovePlane = new Button();
|
||||||
|
buttonAddPlane = new Button();
|
||||||
|
pictureBoxCollection = new PictureBox();
|
||||||
|
menuStrip = new MenuStrip();
|
||||||
|
файлToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
сохранитьToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
загрузитьToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
openFileDialog = new OpenFileDialog();
|
||||||
|
saveFileDialog = new SaveFileDialog();
|
||||||
|
groupBoxTools.SuspendLayout();
|
||||||
|
groupBoxStorages.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit();
|
||||||
|
menuStrip.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// groupBoxTools
|
||||||
|
//
|
||||||
|
groupBoxTools.Controls.Add(buttonSortByType);
|
||||||
|
groupBoxTools.Controls.Add(buttonSortByColor);
|
||||||
|
groupBoxTools.Controls.Add(groupBoxStorages);
|
||||||
|
groupBoxTools.Controls.Add(maskedTextBoxNumber);
|
||||||
|
groupBoxTools.Controls.Add(buttonRefreshCollection);
|
||||||
|
groupBoxTools.Controls.Add(buttonRemovePlane);
|
||||||
|
groupBoxTools.Controls.Add(buttonAddPlane);
|
||||||
|
groupBoxTools.Dock = DockStyle.Right;
|
||||||
|
groupBoxTools.Location = new Point(787, 28);
|
||||||
|
groupBoxTools.Name = "groupBoxTools";
|
||||||
|
groupBoxTools.Size = new Size(230, 510);
|
||||||
|
groupBoxTools.TabIndex = 0;
|
||||||
|
groupBoxTools.TabStop = false;
|
||||||
|
groupBoxTools.Text = "Инструменты";
|
||||||
|
//
|
||||||
|
// buttonSortByType
|
||||||
|
//
|
||||||
|
buttonSortByType.Location = new Point(6, 273);
|
||||||
|
buttonSortByType.Name = "buttonSortByType";
|
||||||
|
buttonSortByType.Size = new Size(218, 29);
|
||||||
|
buttonSortByType.TabIndex = 7;
|
||||||
|
buttonSortByType.Text = "Сортировка по типу";
|
||||||
|
buttonSortByType.UseVisualStyleBackColor = true;
|
||||||
|
buttonSortByType.Click += buttonSortByType_Click;
|
||||||
|
//
|
||||||
|
// buttonSortByColor
|
||||||
|
//
|
||||||
|
buttonSortByColor.Location = new Point(6, 305);
|
||||||
|
buttonSortByColor.Name = "buttonSortByColor";
|
||||||
|
buttonSortByColor.Size = new Size(218, 29);
|
||||||
|
buttonSortByColor.TabIndex = 6;
|
||||||
|
buttonSortByColor.Text = "Сортировка по цвету";
|
||||||
|
buttonSortByColor.UseVisualStyleBackColor = true;
|
||||||
|
buttonSortByColor.Click += buttonSortByColor_Click;
|
||||||
|
//
|
||||||
|
// groupBoxStorages
|
||||||
|
//
|
||||||
|
groupBoxStorages.Controls.Add(buttonRemoveStorage);
|
||||||
|
groupBoxStorages.Controls.Add(listBoxStorages);
|
||||||
|
groupBoxStorages.Controls.Add(buttonAddStorage);
|
||||||
|
groupBoxStorages.Controls.Add(textBoxStorageName);
|
||||||
|
groupBoxStorages.Location = new Point(6, 26);
|
||||||
|
groupBoxStorages.Name = "groupBoxStorages";
|
||||||
|
groupBoxStorages.Size = new Size(218, 241);
|
||||||
|
groupBoxStorages.TabIndex = 5;
|
||||||
|
groupBoxStorages.TabStop = false;
|
||||||
|
groupBoxStorages.Text = "Наборы";
|
||||||
|
//
|
||||||
|
// buttonRemoveStorage
|
||||||
|
//
|
||||||
|
buttonRemoveStorage.Location = new Point(6, 204);
|
||||||
|
buttonRemoveStorage.Name = "buttonRemoveStorage";
|
||||||
|
buttonRemoveStorage.Size = new Size(206, 29);
|
||||||
|
buttonRemoveStorage.TabIndex = 3;
|
||||||
|
buttonRemoveStorage.Text = "Удалить набор";
|
||||||
|
buttonRemoveStorage.UseVisualStyleBackColor = true;
|
||||||
|
buttonRemoveStorage.Click += buttonDelStorage_Click;
|
||||||
|
//
|
||||||
|
// listBoxStorages
|
||||||
|
//
|
||||||
|
listBoxStorages.FormattingEnabled = true;
|
||||||
|
listBoxStorages.ItemHeight = 20;
|
||||||
|
listBoxStorages.Location = new Point(6, 94);
|
||||||
|
listBoxStorages.Name = "listBoxStorages";
|
||||||
|
listBoxStorages.Size = new Size(206, 104);
|
||||||
|
listBoxStorages.TabIndex = 2;
|
||||||
|
listBoxStorages.SelectedIndexChanged += listBoxStorages_SelectedIndexChanged;
|
||||||
|
//
|
||||||
|
// buttonAddStorage
|
||||||
|
//
|
||||||
|
buttonAddStorage.Location = new Point(6, 59);
|
||||||
|
buttonAddStorage.Name = "buttonAddStorage";
|
||||||
|
buttonAddStorage.Size = new Size(206, 29);
|
||||||
|
buttonAddStorage.TabIndex = 1;
|
||||||
|
buttonAddStorage.Text = "Добавить набор";
|
||||||
|
buttonAddStorage.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddStorage.Click += buttonAddStorage_Click;
|
||||||
|
//
|
||||||
|
// textBoxStorageName
|
||||||
|
//
|
||||||
|
textBoxStorageName.Location = new Point(6, 26);
|
||||||
|
textBoxStorageName.Name = "textBoxStorageName";
|
||||||
|
textBoxStorageName.Size = new Size(206, 27);
|
||||||
|
textBoxStorageName.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// maskedTextBoxNumber
|
||||||
|
//
|
||||||
|
maskedTextBoxNumber.Location = new Point(6, 404);
|
||||||
|
maskedTextBoxNumber.Mask = "00";
|
||||||
|
maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||||
|
maskedTextBoxNumber.Size = new Size(218, 27);
|
||||||
|
maskedTextBoxNumber.TabIndex = 4;
|
||||||
|
maskedTextBoxNumber.TextAlign = HorizontalAlignment.Center;
|
||||||
|
maskedTextBoxNumber.ValidatingType = typeof(int);
|
||||||
|
//
|
||||||
|
// buttonRefreshCollection
|
||||||
|
//
|
||||||
|
buttonRefreshCollection.Location = new Point(6, 497);
|
||||||
|
buttonRefreshCollection.Name = "buttonRefreshCollection";
|
||||||
|
buttonRefreshCollection.Size = new Size(218, 29);
|
||||||
|
buttonRefreshCollection.TabIndex = 3;
|
||||||
|
buttonRefreshCollection.Text = "Обновить коллекцию";
|
||||||
|
buttonRefreshCollection.UseVisualStyleBackColor = true;
|
||||||
|
buttonRefreshCollection.Click += buttonRefreshCollection_Click;
|
||||||
|
//
|
||||||
|
// buttonRemovePlane
|
||||||
|
//
|
||||||
|
buttonRemovePlane.Location = new Point(6, 437);
|
||||||
|
buttonRemovePlane.Name = "buttonRemovePlane";
|
||||||
|
buttonRemovePlane.Size = new Size(218, 29);
|
||||||
|
buttonRemovePlane.TabIndex = 2;
|
||||||
|
buttonRemovePlane.Text = "Удалить самолет";
|
||||||
|
buttonRemovePlane.UseVisualStyleBackColor = true;
|
||||||
|
buttonRemovePlane.Click += buttonRemovePlane_Click;
|
||||||
|
//
|
||||||
|
// buttonAddPlane
|
||||||
|
//
|
||||||
|
buttonAddPlane.Location = new Point(6, 349);
|
||||||
|
buttonAddPlane.Name = "buttonAddPlane";
|
||||||
|
buttonAddPlane.Size = new Size(218, 29);
|
||||||
|
buttonAddPlane.TabIndex = 0;
|
||||||
|
buttonAddPlane.Text = "Добавить самолет";
|
||||||
|
buttonAddPlane.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddPlane.Click += buttonAddPlane_Click;
|
||||||
|
//
|
||||||
|
// pictureBoxCollection
|
||||||
|
//
|
||||||
|
pictureBoxCollection.Dock = DockStyle.Fill;
|
||||||
|
pictureBoxCollection.Location = new Point(0, 28);
|
||||||
|
pictureBoxCollection.Name = "pictureBoxCollection";
|
||||||
|
pictureBoxCollection.Size = new Size(787, 510);
|
||||||
|
pictureBoxCollection.TabIndex = 1;
|
||||||
|
pictureBoxCollection.TabStop = false;
|
||||||
|
//
|
||||||
|
// menuStrip
|
||||||
|
//
|
||||||
|
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||||
|
menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem });
|
||||||
|
menuStrip.Location = new Point(0, 0);
|
||||||
|
menuStrip.Name = "menuStrip";
|
||||||
|
menuStrip.Size = new Size(1017, 28);
|
||||||
|
menuStrip.TabIndex = 2;
|
||||||
|
menuStrip.Text = "menuStrip1";
|
||||||
|
//
|
||||||
|
// файлToolStripMenuItem
|
||||||
|
//
|
||||||
|
файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { сохранитьToolStripMenuItem, загрузитьToolStripMenuItem });
|
||||||
|
файлToolStripMenuItem.Name = "файлToolStripMenuItem";
|
||||||
|
файлToolStripMenuItem.Size = new Size(59, 24);
|
||||||
|
файлToolStripMenuItem.Text = "Файл";
|
||||||
|
//
|
||||||
|
// сохранитьToolStripMenuItem
|
||||||
|
//
|
||||||
|
сохранитьToolStripMenuItem.Name = "сохранитьToolStripMenuItem";
|
||||||
|
сохранитьToolStripMenuItem.Size = new Size(166, 26);
|
||||||
|
сохранитьToolStripMenuItem.Text = "Сохранить";
|
||||||
|
сохранитьToolStripMenuItem.Click += saveToFileToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// загрузитьToolStripMenuItem
|
||||||
|
//
|
||||||
|
загрузитьToolStripMenuItem.Name = "загрузитьToolStripMenuItem";
|
||||||
|
загрузитьToolStripMenuItem.Size = new Size(166, 26);
|
||||||
|
загрузитьToolStripMenuItem.Text = "Загрузить";
|
||||||
|
загрузитьToolStripMenuItem.Click += loadFromFileToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// openFileDialog
|
||||||
|
//
|
||||||
|
openFileDialog.FileName = "openFileDialog1";
|
||||||
|
openFileDialog.Filter = "txt file | *.txt";
|
||||||
|
//
|
||||||
|
// saveFileDialog
|
||||||
|
//
|
||||||
|
saveFileDialog.Filter = "txt file | *.txt";
|
||||||
|
//
|
||||||
|
// FormPlaneCollection
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1017, 538);
|
||||||
|
Controls.Add(pictureBoxCollection);
|
||||||
|
Controls.Add(groupBoxTools);
|
||||||
|
Controls.Add(menuStrip);
|
||||||
|
MainMenuStrip = menuStrip;
|
||||||
|
Name = "FormPlaneCollection";
|
||||||
|
Text = "Набор самолетов";
|
||||||
|
groupBoxTools.ResumeLayout(false);
|
||||||
|
groupBoxTools.PerformLayout();
|
||||||
|
groupBoxStorages.ResumeLayout(false);
|
||||||
|
groupBoxStorages.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).EndInit();
|
||||||
|
menuStrip.ResumeLayout(false);
|
||||||
|
menuStrip.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private GroupBox groupBoxTools;
|
||||||
|
private Button buttonRefreshCollection;
|
||||||
|
private Button buttonRemovePlane;
|
||||||
|
private Button buttonAddPlane;
|
||||||
|
private MaskedTextBox maskedTextBoxNumber;
|
||||||
|
private PictureBox pictureBoxCollection;
|
||||||
|
private GroupBox groupBoxStorages;
|
||||||
|
private Button buttonRemoveStorage;
|
||||||
|
private ListBox listBoxStorages;
|
||||||
|
private Button buttonAddStorage;
|
||||||
|
private TextBox textBoxStorageName;
|
||||||
|
private MenuStrip menuStrip;
|
||||||
|
private ToolStripMenuItem файлToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem сохранитьToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem загрузитьToolStripMenuItem;
|
||||||
|
private OpenFileDialog openFileDialog;
|
||||||
|
private SaveFileDialog saveFileDialog;
|
||||||
|
private Button buttonSortByType;
|
||||||
|
private Button buttonSortByColor;
|
||||||
|
}
|
||||||
|
}
|
276
ProjStormtrooper/ProjStormtrooper/PlaneCollection.cs
Normal file
276
ProjStormtrooper/ProjStormtrooper/PlaneCollection.cs
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
using ProjStormtrooper.Properties;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
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 System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Форма для работы с набором объектов класса DrawningPlane
|
||||||
|
/// </summary>
|
||||||
|
public partial class PlaneCollection : Form
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логер
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
/// <summary>
|
||||||
|
/// Набор объектов
|
||||||
|
/// </summary>
|
||||||
|
private readonly PlanesGenericStorage _storage;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
public PlaneCollection(ILogger<PlaneCollection> logger)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_storage = new PlanesGenericStorage(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Заполнение listBoxObjects
|
||||||
|
/// </summary>
|
||||||
|
private void ReloadObjects()
|
||||||
|
{
|
||||||
|
int index = listBoxStorages.SelectedIndex;
|
||||||
|
listBoxStorages.Items.Clear();
|
||||||
|
for (int i = 0; i < _storage.Keys.Count; i++)
|
||||||
|
{
|
||||||
|
listBoxStorages.Items.Add(_storage.Keys[i]);
|
||||||
|
}
|
||||||
|
if (listBoxStorages.Items.Count > 0 && (index == -1 || index >= listBoxStorages.Items.Count))
|
||||||
|
{
|
||||||
|
listBoxStorages.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
else if (listBoxStorages.Items.Count > 0 && index > -1 && index < listBoxStorages.Items.Count)
|
||||||
|
{
|
||||||
|
listBoxStorages.SelectedIndex = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление набора в коллекцию
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void buttonAddStorage_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.LogWarning("Неудачная попытка добавить хранилище: не все данные заполнены");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_storage.AddSet(textBoxStorageName.Text);
|
||||||
|
_logger.LogInformation($"Добавлен набор: {textBoxStorageName.Text}");
|
||||||
|
ReloadObjects();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Выбор набора
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void listBoxStorages_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
pictureBoxCollection.Image = _storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowPlanes();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление набора
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void buttonDelStorage_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MessageBox.Show($"Удалить объект {listBoxStorages.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
string? name = listBoxStorages.SelectedItem.ToString();
|
||||||
|
_storage.DelSet(name ?? string.Empty);
|
||||||
|
_logger.LogInformation($"Удален набор: {name}");
|
||||||
|
ReloadObjects();
|
||||||
|
}
|
||||||
|
_logger.LogWarning("Отмена удаления набора");
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление объекта в набор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void buttonAddPlane_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var formPlaneConfig = new PlaneConfig();
|
||||||
|
formPlaneConfig.AddEvent(AddPlaneListener);
|
||||||
|
formPlaneConfig.Show();
|
||||||
|
}
|
||||||
|
public void AddPlaneListener(DrawingPlane plane)
|
||||||
|
{
|
||||||
|
plane._pictureWidth = pictureBoxCollection.Width;
|
||||||
|
plane._pictureHeight = pictureBoxCollection.Height;
|
||||||
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (obj + plane > -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект добавлен");
|
||||||
|
_logger.LogInformation($"Добавлен объект {plane}");
|
||||||
|
pictureBoxCollection.Image = obj.ShowPlanes();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (StorageOverflowException ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка добавления", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.LogWarning("Ошибка добавления: " + ex.Message);
|
||||||
|
}
|
||||||
|
catch (ApplicationException ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка добавления", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.LogWarning("Ошибка добавления: " + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление объекта из набора
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void buttonRemovePlane_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Отмена удаления объекта");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
||||||
|
var removedObj = obj - pos;
|
||||||
|
if (removedObj != null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект удален");
|
||||||
|
_logger.LogInformation($"Удален объект {removedObj} с позиции {pos}");
|
||||||
|
pictureBoxCollection.Image = obj.ShowPlanes();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось удалить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (PlaneNotFoundException ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
_logger.LogWarning("Ошибка удаления: " + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Обновление рисунка по набору
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void buttonRefreshCollection_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
RefreshCollection();
|
||||||
|
}
|
||||||
|
private void RefreshCollection()
|
||||||
|
{
|
||||||
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pictureBoxCollection.Image = obj.ShowPlanes();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveToFileToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_storage.SaveData(saveFileDialog.FileName);
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
_logger.LogInformation($"Данные сохранены в файл {saveFileDialog.FileName}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Не сохранилось: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.LogWarning($"Не удалось сохранить информацию в файл: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadFromFileToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_storage.LoadData(openFileDialog.FileName);
|
||||||
|
ReloadObjects();
|
||||||
|
RefreshCollection();
|
||||||
|
MessageBox.Show("Загрузка прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
_logger.LogInformation($"Данные загружены из файла {openFileDialog.FileName}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Не загрузилось: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.LogWarning($"Не удалось загрузить информацию из файла: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Сортировка по сравнителю
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comparer"></param>
|
||||||
|
private void ComparePlanes(IComparer<DrawingPlane?> comparer)
|
||||||
|
{
|
||||||
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
obj.Sort(comparer);
|
||||||
|
pictureBoxCollection.Image = obj.ShowPlanes();
|
||||||
|
}
|
||||||
|
private void buttonSortByType_Click(object sender, EventArgs e) => ComparePlanes(new PlaneCompareByType());
|
||||||
|
|
||||||
|
private void buttonSortByColor_Click(object sender, EventArgs e) => ComparePlanes(new PlaneCompareByColor());
|
||||||
|
}
|
||||||
|
}
|
129
ProjStormtrooper/ProjStormtrooper/PlaneCollection.resx
Normal file
129
ProjStormtrooper/ProjStormtrooper/PlaneCollection.resx
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
<?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>
|
||||||
|
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>152, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>319, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
35
ProjStormtrooper/ProjStormtrooper/PlaneCompareByColor.cs
Normal file
35
ProjStormtrooper/ProjStormtrooper/PlaneCompareByColor.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
public class PlaneCompareByColor : IComparer<DrawingPlane?>
|
||||||
|
{
|
||||||
|
public int Compare(DrawingPlane? x, DrawingPlane? y)
|
||||||
|
{
|
||||||
|
if (x == null || x.EntityPlane == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(x));
|
||||||
|
}
|
||||||
|
if (y == null || y.EntityPlane == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(y));
|
||||||
|
}
|
||||||
|
if (x.EntityPlane.BodyColor != y.EntityPlane.BodyColor)
|
||||||
|
{
|
||||||
|
return x.EntityPlane.BodyColor.Name.CompareTo(y.EntityPlane.BodyColor.Name);
|
||||||
|
}
|
||||||
|
if (x.EntityPlane is EntityStormtrooper xStormtrooper && y.EntityPlane is EntityStormtrooper yStormtrooper)
|
||||||
|
{
|
||||||
|
if (xStormtrooper.AdditionalColor != yStormtrooper.AdditionalColor)
|
||||||
|
{
|
||||||
|
return xStormtrooper.AdditionalColor.Name.CompareTo(yStormtrooper.AdditionalColor.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
ProjStormtrooper/ProjStormtrooper/PlaneCompareByType.cs
Normal file
33
ProjStormtrooper/ProjStormtrooper/PlaneCompareByType.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
public class PlaneCompareByType : IComparer<DrawingPlane?>
|
||||||
|
{
|
||||||
|
public int Compare(DrawingPlane? x, DrawingPlane? y)
|
||||||
|
{
|
||||||
|
if (x == null || x.EntityPlane == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(x));
|
||||||
|
}
|
||||||
|
if (y == null || y.EntityPlane == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(y));
|
||||||
|
}
|
||||||
|
if (x.GetType().Name != y.GetType().Name)
|
||||||
|
{
|
||||||
|
return x.GetType().Name.CompareTo(y.GetType().Name);
|
||||||
|
}
|
||||||
|
var speedCompare = x.EntityPlane.Speed.CompareTo(y.EntityPlane.Speed);
|
||||||
|
if (speedCompare != 0)
|
||||||
|
{
|
||||||
|
return speedCompare;
|
||||||
|
}
|
||||||
|
return x.EntityPlane.Weight.CompareTo(y.EntityPlane.Weight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
381
ProjStormtrooper/ProjStormtrooper/PlaneConfig.Designer.cs
generated
Normal file
381
ProjStormtrooper/ProjStormtrooper/PlaneConfig.Designer.cs
generated
Normal file
@ -0,0 +1,381 @@
|
|||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
partial class PlaneConfig
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
groupBoxParams = new GroupBox();
|
||||||
|
groupBoxColors = new GroupBox();
|
||||||
|
panelColorPink = new Panel();
|
||||||
|
panelColorPurple = new Panel();
|
||||||
|
panelColorBlue = new Panel();
|
||||||
|
panelColorBrown = new Panel();
|
||||||
|
panelColorGreen = new Panel();
|
||||||
|
panelColorLightBlue = new Panel();
|
||||||
|
panelColorYellow = new Panel();
|
||||||
|
panelColorRed = new Panel();
|
||||||
|
labelStormtrooper = new Label();
|
||||||
|
labelPlane = new Label();
|
||||||
|
checkBoxRockets = new CheckBox();
|
||||||
|
checkBoxBombs = new CheckBox();
|
||||||
|
numericUpDownWeight = new NumericUpDown();
|
||||||
|
numericUpDownSpeed = new NumericUpDown();
|
||||||
|
labelWeight = new Label();
|
||||||
|
labelSpeed = new Label();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
buttonApply = new Button();
|
||||||
|
pictureBoxObject = new PictureBox();
|
||||||
|
labelAddColor = new Label();
|
||||||
|
labelColor = new Label();
|
||||||
|
panelControl = new Panel();
|
||||||
|
groupBoxParams.SuspendLayout();
|
||||||
|
groupBoxColors.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
||||||
|
panelControl.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// groupBoxParams
|
||||||
|
//
|
||||||
|
groupBoxParams.Controls.Add(groupBoxColors);
|
||||||
|
groupBoxParams.Controls.Add(labelStormtrooper);
|
||||||
|
groupBoxParams.Controls.Add(labelPlane);
|
||||||
|
groupBoxParams.Controls.Add(checkBoxRockets);
|
||||||
|
groupBoxParams.Controls.Add(checkBoxBombs);
|
||||||
|
groupBoxParams.Controls.Add(numericUpDownWeight);
|
||||||
|
groupBoxParams.Controls.Add(numericUpDownSpeed);
|
||||||
|
groupBoxParams.Controls.Add(labelWeight);
|
||||||
|
groupBoxParams.Controls.Add(labelSpeed);
|
||||||
|
groupBoxParams.Location = new Point(2, 5);
|
||||||
|
groupBoxParams.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
groupBoxParams.Name = "groupBoxParams";
|
||||||
|
groupBoxParams.Padding = new Padding(3, 2, 3, 2);
|
||||||
|
groupBoxParams.Size = new Size(435, 196);
|
||||||
|
groupBoxParams.TabIndex = 0;
|
||||||
|
groupBoxParams.TabStop = false;
|
||||||
|
groupBoxParams.Text = "Параметры";
|
||||||
|
//
|
||||||
|
// groupBoxColors
|
||||||
|
//
|
||||||
|
groupBoxColors.Controls.Add(panelColorPink);
|
||||||
|
groupBoxColors.Controls.Add(panelColorPurple);
|
||||||
|
groupBoxColors.Controls.Add(panelColorBlue);
|
||||||
|
groupBoxColors.Controls.Add(panelColorBrown);
|
||||||
|
groupBoxColors.Controls.Add(panelColorGreen);
|
||||||
|
groupBoxColors.Controls.Add(panelColorLightBlue);
|
||||||
|
groupBoxColors.Controls.Add(panelColorYellow);
|
||||||
|
groupBoxColors.Controls.Add(panelColorRed);
|
||||||
|
groupBoxColors.Location = new Point(154, 20);
|
||||||
|
groupBoxColors.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
groupBoxColors.Name = "groupBoxColors";
|
||||||
|
groupBoxColors.Padding = new Padding(3, 2, 3, 2);
|
||||||
|
groupBoxColors.Size = new Size(270, 117);
|
||||||
|
groupBoxColors.TabIndex = 8;
|
||||||
|
groupBoxColors.TabStop = false;
|
||||||
|
groupBoxColors.Text = "Цвета";
|
||||||
|
//
|
||||||
|
// panelColorPink
|
||||||
|
//
|
||||||
|
panelColorPink.BackColor = Color.FromArgb(255, 192, 192);
|
||||||
|
panelColorPink.Location = new Point(211, 67);
|
||||||
|
panelColorPink.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
panelColorPink.Name = "panelColorPink";
|
||||||
|
panelColorPink.Size = new Size(44, 38);
|
||||||
|
panelColorPink.TabIndex = 1;
|
||||||
|
panelColorPink.Paint += panelColorPink_Paint;
|
||||||
|
//
|
||||||
|
// panelColorPurple
|
||||||
|
//
|
||||||
|
panelColorPurple.BackColor = Color.Fuchsia;
|
||||||
|
panelColorPurple.Location = new Point(144, 67);
|
||||||
|
panelColorPurple.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
panelColorPurple.Name = "panelColorPurple";
|
||||||
|
panelColorPurple.Size = new Size(44, 38);
|
||||||
|
panelColorPurple.TabIndex = 1;
|
||||||
|
panelColorPurple.Paint += panelColorPurple_Paint;
|
||||||
|
//
|
||||||
|
// panelColorBlue
|
||||||
|
//
|
||||||
|
panelColorBlue.BackColor = Color.SlateGray;
|
||||||
|
panelColorBlue.Location = new Point(76, 67);
|
||||||
|
panelColorBlue.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
panelColorBlue.Name = "panelColorBlue";
|
||||||
|
panelColorBlue.Size = new Size(44, 38);
|
||||||
|
panelColorBlue.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panelColorBrown
|
||||||
|
//
|
||||||
|
panelColorBrown.BackColor = Color.FromArgb(192, 64, 0);
|
||||||
|
panelColorBrown.Location = new Point(15, 67);
|
||||||
|
panelColorBrown.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
panelColorBrown.Name = "panelColorBrown";
|
||||||
|
panelColorBrown.Size = new Size(44, 38);
|
||||||
|
panelColorBrown.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// panelColorGreen
|
||||||
|
//
|
||||||
|
panelColorGreen.BackColor = Color.Lime;
|
||||||
|
panelColorGreen.Location = new Point(211, 20);
|
||||||
|
panelColorGreen.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
panelColorGreen.Name = "panelColorGreen";
|
||||||
|
panelColorGreen.Size = new Size(44, 38);
|
||||||
|
panelColorGreen.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panelColorLightBlue
|
||||||
|
//
|
||||||
|
panelColorLightBlue.BackColor = Color.FromArgb(64, 0, 64);
|
||||||
|
panelColorLightBlue.Location = new Point(144, 20);
|
||||||
|
panelColorLightBlue.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
panelColorLightBlue.Name = "panelColorLightBlue";
|
||||||
|
panelColorLightBlue.Size = new Size(44, 38);
|
||||||
|
panelColorLightBlue.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// panelColorYellow
|
||||||
|
//
|
||||||
|
panelColorYellow.BackColor = Color.Yellow;
|
||||||
|
panelColorYellow.Location = new Point(76, 20);
|
||||||
|
panelColorYellow.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
panelColorYellow.Name = "panelColorYellow";
|
||||||
|
panelColorYellow.Size = new Size(44, 38);
|
||||||
|
panelColorYellow.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panelColorRed
|
||||||
|
//
|
||||||
|
panelColorRed.BackColor = Color.Blue;
|
||||||
|
panelColorRed.Location = new Point(15, 20);
|
||||||
|
panelColorRed.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
panelColorRed.Name = "panelColorRed";
|
||||||
|
panelColorRed.Size = new Size(44, 38);
|
||||||
|
panelColorRed.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// labelStormtrooper
|
||||||
|
//
|
||||||
|
labelStormtrooper.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
labelStormtrooper.Location = new Point(298, 152);
|
||||||
|
labelStormtrooper.Name = "labelStormtrooper";
|
||||||
|
labelStormtrooper.Padding = new Padding(9, 8, 9, 8);
|
||||||
|
labelStormtrooper.Size = new Size(111, 32);
|
||||||
|
labelStormtrooper.TabIndex = 7;
|
||||||
|
labelStormtrooper.Text = "Продвинутый";
|
||||||
|
labelStormtrooper.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelStormtrooper.MouseDown += labelObject_MouseDown;
|
||||||
|
//
|
||||||
|
// labelPlane
|
||||||
|
//
|
||||||
|
labelPlane.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
labelPlane.Location = new Point(169, 152);
|
||||||
|
labelPlane.Name = "labelPlane";
|
||||||
|
labelPlane.Padding = new Padding(9, 8, 9, 8);
|
||||||
|
labelPlane.Size = new Size(105, 32);
|
||||||
|
labelPlane.TabIndex = 6;
|
||||||
|
labelPlane.Text = "Простой";
|
||||||
|
labelPlane.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelPlane.MouseDown += labelObject_MouseDown;
|
||||||
|
//
|
||||||
|
// checkBoxRockets
|
||||||
|
//
|
||||||
|
checkBoxRockets.AutoSize = true;
|
||||||
|
checkBoxRockets.Location = new Point(5, 109);
|
||||||
|
checkBoxRockets.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
checkBoxRockets.Name = "checkBoxRockets";
|
||||||
|
checkBoxRockets.Size = new Size(65, 19);
|
||||||
|
checkBoxRockets.TabIndex = 5;
|
||||||
|
checkBoxRockets.Text = "Ракеты";
|
||||||
|
checkBoxRockets.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// checkBoxBombs
|
||||||
|
//
|
||||||
|
checkBoxBombs.AutoSize = true;
|
||||||
|
checkBoxBombs.Location = new Point(5, 86);
|
||||||
|
checkBoxBombs.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
checkBoxBombs.Name = "checkBoxBombs";
|
||||||
|
checkBoxBombs.Size = new Size(65, 19);
|
||||||
|
checkBoxBombs.TabIndex = 4;
|
||||||
|
checkBoxBombs.Text = "Бомбы";
|
||||||
|
checkBoxBombs.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// numericUpDownWeight
|
||||||
|
//
|
||||||
|
numericUpDownWeight.Location = new Point(77, 55);
|
||||||
|
numericUpDownWeight.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
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(72, 23);
|
||||||
|
numericUpDownWeight.TabIndex = 3;
|
||||||
|
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// numericUpDownSpeed
|
||||||
|
//
|
||||||
|
numericUpDownSpeed.Location = new Point(77, 22);
|
||||||
|
numericUpDownSpeed.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
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(72, 23);
|
||||||
|
numericUpDownSpeed.TabIndex = 2;
|
||||||
|
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// labelWeight
|
||||||
|
//
|
||||||
|
labelWeight.AutoSize = true;
|
||||||
|
labelWeight.Location = new Point(5, 56);
|
||||||
|
labelWeight.Name = "labelWeight";
|
||||||
|
labelWeight.Size = new Size(29, 15);
|
||||||
|
labelWeight.TabIndex = 1;
|
||||||
|
labelWeight.Text = "Вес:";
|
||||||
|
//
|
||||||
|
// labelSpeed
|
||||||
|
//
|
||||||
|
labelSpeed.AutoSize = true;
|
||||||
|
labelSpeed.Location = new Point(5, 23);
|
||||||
|
labelSpeed.Name = "labelSpeed";
|
||||||
|
labelSpeed.Size = new Size(62, 15);
|
||||||
|
labelSpeed.TabIndex = 0;
|
||||||
|
labelSpeed.Text = "Скорость:";
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(156, 165);
|
||||||
|
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(82, 22);
|
||||||
|
buttonCancel.TabIndex = 4;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// buttonApply
|
||||||
|
//
|
||||||
|
buttonApply.Location = new Point(18, 165);
|
||||||
|
buttonApply.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonApply.Name = "buttonApply";
|
||||||
|
buttonApply.Size = new Size(82, 22);
|
||||||
|
buttonApply.TabIndex = 3;
|
||||||
|
buttonApply.Text = "Добавить";
|
||||||
|
buttonApply.UseVisualStyleBackColor = true;
|
||||||
|
buttonApply.Click += buttonApply_Click;
|
||||||
|
//
|
||||||
|
// pictureBoxObject
|
||||||
|
//
|
||||||
|
pictureBoxObject.Location = new Point(18, 51);
|
||||||
|
pictureBoxObject.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
pictureBoxObject.Name = "pictureBoxObject";
|
||||||
|
pictureBoxObject.Size = new Size(220, 110);
|
||||||
|
pictureBoxObject.TabIndex = 2;
|
||||||
|
pictureBoxObject.TabStop = false;
|
||||||
|
//
|
||||||
|
// labelAddColor
|
||||||
|
//
|
||||||
|
labelAddColor.AllowDrop = true;
|
||||||
|
labelAddColor.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
labelAddColor.Location = new Point(150, 12);
|
||||||
|
labelAddColor.Name = "labelAddColor";
|
||||||
|
labelAddColor.Size = new Size(88, 30);
|
||||||
|
labelAddColor.TabIndex = 1;
|
||||||
|
labelAddColor.Text = "Доп. цвет";
|
||||||
|
labelAddColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelAddColor.DragDrop += labelAddColor_DragDrop;
|
||||||
|
labelAddColor.DragEnter += labelColor_DragEnter;
|
||||||
|
//
|
||||||
|
// labelColor
|
||||||
|
//
|
||||||
|
labelColor.AllowDrop = true;
|
||||||
|
labelColor.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
labelColor.Location = new Point(18, 12);
|
||||||
|
labelColor.Name = "labelColor";
|
||||||
|
labelColor.Size = new Size(88, 30);
|
||||||
|
labelColor.TabIndex = 0;
|
||||||
|
labelColor.Text = "Цвет";
|
||||||
|
labelColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelColor.DragDrop += labelColor_DragDrop;
|
||||||
|
labelColor.DragEnter += labelColor_DragEnter;
|
||||||
|
//
|
||||||
|
// panelControl
|
||||||
|
//
|
||||||
|
panelControl.AllowDrop = true;
|
||||||
|
panelControl.Controls.Add(labelColor);
|
||||||
|
panelControl.Controls.Add(buttonCancel);
|
||||||
|
panelControl.Controls.Add(buttonApply);
|
||||||
|
panelControl.Controls.Add(pictureBoxObject);
|
||||||
|
panelControl.Controls.Add(labelAddColor);
|
||||||
|
panelControl.Location = new Point(442, 9);
|
||||||
|
panelControl.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
panelControl.Name = "panelControl";
|
||||||
|
panelControl.Size = new Size(261, 192);
|
||||||
|
panelControl.TabIndex = 5;
|
||||||
|
panelControl.DragDrop += panelControlObject_DragDrop;
|
||||||
|
panelControl.DragEnter += panelControlObject_DragEnter;
|
||||||
|
//
|
||||||
|
// PlaneConfig
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(708, 206);
|
||||||
|
Controls.Add(panelControl);
|
||||||
|
Controls.Add(groupBoxParams);
|
||||||
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
|
Name = "PlaneConfig";
|
||||||
|
Text = "Создание объекта";
|
||||||
|
groupBoxParams.ResumeLayout(false);
|
||||||
|
groupBoxParams.PerformLayout();
|
||||||
|
groupBoxColors.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
||||||
|
panelControl.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private GroupBox groupBoxParams;
|
||||||
|
private GroupBox groupBoxColors;
|
||||||
|
private Label labelStormtrooper;
|
||||||
|
private Label labelPlane;
|
||||||
|
private CheckBox checkBoxRockets;
|
||||||
|
private CheckBox checkBoxBombs;
|
||||||
|
private NumericUpDown numericUpDownWeight;
|
||||||
|
private NumericUpDown numericUpDownSpeed;
|
||||||
|
private Label labelWeight;
|
||||||
|
private Label labelSpeed;
|
||||||
|
private Panel panelColorRed;
|
||||||
|
private Panel panelColorPink;
|
||||||
|
private Panel panelColorPurple;
|
||||||
|
private Panel panelColorBlue;
|
||||||
|
private Panel panelColorBrown;
|
||||||
|
private Panel panelColorGreen;
|
||||||
|
private Panel panelColorLightBlue;
|
||||||
|
private Panel panelColorYellow;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonApply;
|
||||||
|
private PictureBox pictureBoxObject;
|
||||||
|
private Label labelAddColor;
|
||||||
|
private Label labelColor;
|
||||||
|
private Panel panelControl;
|
||||||
|
}
|
||||||
|
}
|
127
ProjStormtrooper/ProjStormtrooper/PlaneConfig.cs
Normal file
127
ProjStormtrooper/ProjStormtrooper/PlaneConfig.cs
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
public partial class PlaneConfig : Form
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Переменная-выбранный самолет
|
||||||
|
/// </summary>
|
||||||
|
DrawingPlane? _plane = null;
|
||||||
|
/// <summary>
|
||||||
|
/// Событие
|
||||||
|
/// </summary>
|
||||||
|
private event Action<DrawingPlane>? EventAddPlane;
|
||||||
|
public PlaneConfig()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
panelColorRed.MouseDown += panelColor_MouseDown;
|
||||||
|
panelColorYellow.MouseDown += panelColor_MouseDown;
|
||||||
|
panelColorLightBlue.MouseDown += panelColor_MouseDown;
|
||||||
|
panelColorGreen.MouseDown += panelColor_MouseDown;
|
||||||
|
panelColorBrown.MouseDown += panelColor_MouseDown;
|
||||||
|
panelColorBlue.MouseDown += panelColor_MouseDown;
|
||||||
|
panelColorPurple.MouseDown += panelColor_MouseDown;
|
||||||
|
panelColorPink.MouseDown += panelColor_MouseDown;
|
||||||
|
|
||||||
|
buttonCancel.Click += (sender, e) => Close();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление события
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ev">Привязанный метод</param>
|
||||||
|
public void AddEvent(Action<DrawingPlane> ev)
|
||||||
|
{
|
||||||
|
if (EventAddPlane == null)
|
||||||
|
{
|
||||||
|
EventAddPlane = ev;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EventAddPlane += ev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Отрисовать машину
|
||||||
|
/// </summary>
|
||||||
|
private void DrawPlane()
|
||||||
|
{
|
||||||
|
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_plane?.SetPosition((int)((pictureBoxObject.Width - _plane?.GetWidth) / 2), (int)((pictureBoxObject.Height - _plane?.GetHeight) / 2));
|
||||||
|
_plane?.DrawTransport(gr);
|
||||||
|
pictureBoxObject.Image = bmp;
|
||||||
|
}
|
||||||
|
private void buttonApply_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
EventAddPlane?.Invoke(_plane);
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
private void panelControlObject_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void panelControlObject_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||||
|
{
|
||||||
|
case "labelPlane":
|
||||||
|
_plane = new DrawingPlane((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||||
|
break;
|
||||||
|
case "labelStormtrooper":
|
||||||
|
_plane = new DrawingStormtrooper((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxRockets.Checked, checkBoxBombs.Checked, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DrawPlane();
|
||||||
|
}
|
||||||
|
private void labelObject_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
private void panelColor_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
private void labelColor_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data?.GetDataPresent(typeof(Color)) ?? false)
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void labelColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_plane == null)
|
||||||
|
return;
|
||||||
|
_plane.EntityPlane.SetColor((Color)e.Data.GetData(typeof(Color).ToString()));
|
||||||
|
DrawPlane();
|
||||||
|
}
|
||||||
|
private void labelAddColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_plane == null || _plane is not DrawingStormtrooper)
|
||||||
|
return;
|
||||||
|
(_plane.EntityPlane as EntityStormtrooper).SetAdditionalColor((Color)e.Data.GetData(typeof(Color).ToString()));
|
||||||
|
DrawPlane();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ProjStormtrooper/ProjStormtrooper/PlaneConfig.resx
Normal file
120
ProjStormtrooper/ProjStormtrooper/PlaneConfig.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>
|
31
ProjStormtrooper/ProjStormtrooper/PlanesCollectionInfo.cs
Normal file
31
ProjStormtrooper/ProjStormtrooper/PlanesCollectionInfo.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
public class PlanesCollectionInfo : IEquatable<PlanesCollectionInfo>
|
||||||
|
{
|
||||||
|
public string Name { get; private set; }
|
||||||
|
public string Description { get; private set; }
|
||||||
|
public PlanesCollectionInfo(string name, string description)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Description = description;
|
||||||
|
}
|
||||||
|
public bool Equals(PlanesCollectionInfo? other)
|
||||||
|
{
|
||||||
|
return Name == other.Name;
|
||||||
|
}
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return Name.GetHashCode();
|
||||||
|
}
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
148
ProjStormtrooper/ProjStormtrooper/PlanesGenericCollection.cs
Normal file
148
ProjStormtrooper/ProjStormtrooper/PlanesGenericCollection.cs
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Параметризованный класс для набора объектов DrawningPlane
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <typeparam name="U"></typeparam>
|
||||||
|
internal class PlanesGenericCollection<T, U>
|
||||||
|
where T : DrawingPlane
|
||||||
|
where U : IMoveableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина окна прорисовки
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _pictureWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота окна прорисовки
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _pictureHeight;
|
||||||
|
/// <summary>
|
||||||
|
/// Размер занимаемого объектом места (ширина)
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _placeSizeWidth = 160;
|
||||||
|
/// <summary>
|
||||||
|
/// Размер занимаемого объектом места (высота)
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _placeSizeHeight = 120;
|
||||||
|
/// <summary>
|
||||||
|
/// Набор объектов
|
||||||
|
/// </summary>
|
||||||
|
private readonly SetGeneric<T> _collection;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="picWidth"></param>
|
||||||
|
/// <param name="picHeight"></param>
|
||||||
|
public PlanesGenericCollection(int picWidth, int picHeight)
|
||||||
|
{
|
||||||
|
int horizontalObjectsCount = picWidth / _placeSizeWidth;
|
||||||
|
int verticalObjectsCount = picHeight / _placeSizeHeight;
|
||||||
|
_pictureWidth = picWidth;
|
||||||
|
_pictureHeight = picHeight;
|
||||||
|
_collection = new SetGeneric<T>(horizontalObjectsCount * verticalObjectsCount);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Сортировка
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comparer"></param>
|
||||||
|
public void Sort(IComparer<T?> comparer) => _collection.SortSet(comparer);
|
||||||
|
/// <summary>
|
||||||
|
/// Перегрузка оператора сложения
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="collect"></param>
|
||||||
|
/// <param name="obj"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int operator +(PlanesGenericCollection<T, U> collect, T? obj)
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return collect?._collection.Insert(obj, new DrawingPlaneEqutables()) ?? -1;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перегрузка оператора вычитания
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="collect"></param>
|
||||||
|
/// <param name="pos"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static T? operator -(PlanesGenericCollection<T, U> collect, int pos)
|
||||||
|
{
|
||||||
|
T? obj = collect._collection[pos];
|
||||||
|
collect._collection.Remove(pos);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение объекта IMoveableObject
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pos"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public U? GetU(int pos)
|
||||||
|
{
|
||||||
|
return (U?)_collection[pos]?.GetMoveableObject;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Вывод всего набора объектов
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Bitmap ShowPlanes()
|
||||||
|
{
|
||||||
|
Bitmap bmp = new(_pictureWidth, _pictureHeight);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
DrawBackground(gr);
|
||||||
|
DrawObjects(gr);
|
||||||
|
return bmp;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Метод отрисовки фона
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
private void DrawBackground(Graphics g)
|
||||||
|
{
|
||||||
|
Pen pen = new(Color.Black, 3);
|
||||||
|
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j)
|
||||||
|
{
|
||||||
|
// Линия разметки места
|
||||||
|
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j * _placeSizeHeight);
|
||||||
|
}
|
||||||
|
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// Метод прорисовки объектов
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
private void DrawObjects(Graphics g)
|
||||||
|
{
|
||||||
|
int placesColumnCount = _pictureHeight / _placeSizeHeight;
|
||||||
|
int placesRowCount = _pictureWidth / _placeSizeWidth;
|
||||||
|
int i = 0;
|
||||||
|
foreach (var plane in _collection.GetPlanes())
|
||||||
|
{
|
||||||
|
if (plane != null)
|
||||||
|
{
|
||||||
|
// установка позиции
|
||||||
|
plane.SetPosition(
|
||||||
|
(int)((placesRowCount - 1) * _placeSizeWidth - (i % placesColumnCount * _placeSizeWidth) + (_placeSizeWidth - plane.GetWidth) / 2),
|
||||||
|
(int)(i / placesColumnCount * _placeSizeHeight + (_placeSizeHeight - plane.GetHeight) / 2)
|
||||||
|
);
|
||||||
|
// прорисовка объекта
|
||||||
|
plane.DrawTransport(g);
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение объектов коллекции
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<T?> GetPlanes => _collection.GetPlanes();
|
||||||
|
}
|
||||||
|
}
|
164
ProjStormtrooper/ProjStormtrooper/PlanesGenericStorage.cs
Normal file
164
ProjStormtrooper/ProjStormtrooper/PlanesGenericStorage.cs
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
internal class PlanesGenericStorage
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Разделитель для записи ключа и значения элемента словаря
|
||||||
|
/// </summary>
|
||||||
|
private static readonly char _separatorForKeyValue = '|';
|
||||||
|
/// <summary>
|
||||||
|
/// Разделитель для записей коллекции данных в файл
|
||||||
|
/// </summary>
|
||||||
|
private readonly char _separatorRecords = ';';
|
||||||
|
/// <summary>
|
||||||
|
/// Разделитель для записи информации по объекту в файл
|
||||||
|
/// </summary>
|
||||||
|
private static readonly char _separatorForObject = ':';
|
||||||
|
/// <summary>
|
||||||
|
/// Словарь (хранилище)
|
||||||
|
/// </summary>
|
||||||
|
readonly Dictionary<PlanesCollectionInfo, PlanesGenericCollection<DrawingPlane, DrawingObjectPlane>> _planeStorages;
|
||||||
|
/// <summary>
|
||||||
|
/// Возвращение списка названий наборов
|
||||||
|
/// </summary>
|
||||||
|
public List<PlanesCollectionInfo> Keys => _planeStorages.Keys.ToList();
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина окна отрисовки
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _pictureWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота окна отрисовки
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _pictureHeight;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pictureWidth"></param>
|
||||||
|
/// <param name="pictureHeight"></param>
|
||||||
|
public PlanesGenericStorage(int pictureWidth, int pictureHeight)
|
||||||
|
{
|
||||||
|
_planeStorages = new Dictionary<PlanesCollectionInfo, PlanesGenericCollection<DrawingPlane, DrawingObjectPlane>>();
|
||||||
|
_pictureWidth = pictureWidth;
|
||||||
|
_pictureHeight = pictureHeight;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление набора
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">Название набора</param>
|
||||||
|
public void AddSet(string name)
|
||||||
|
{
|
||||||
|
_planeStorages.Add(new PlanesCollectionInfo(name, ""), new PlanesGenericCollection<DrawingPlane, DrawingObjectPlane>(_pictureWidth, _pictureHeight));
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление набора
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">Название набора</param>
|
||||||
|
public void DelSet(string name)
|
||||||
|
{
|
||||||
|
var info = new PlanesCollectionInfo(name, "");
|
||||||
|
if (_planeStorages.ContainsKey(info))
|
||||||
|
_planeStorages.Remove(info);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Доступ к набору
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ind"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public PlanesGenericCollection<DrawingPlane, DrawingObjectPlane>? this[string ind]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var info = new PlanesCollectionInfo(ind, "");
|
||||||
|
if (_planeStorages.ContainsKey(info))
|
||||||
|
return _planeStorages[info];
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение информации в файл
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filename">Путь и имя файла</param>
|
||||||
|
/// <returns>true - сохранение прошло успешно, false - ошибка при сохранении данных</returns>
|
||||||
|
public void SaveData(string filename)
|
||||||
|
{
|
||||||
|
if (File.Exists(filename))
|
||||||
|
{
|
||||||
|
File.Delete(filename);
|
||||||
|
}
|
||||||
|
using (StreamWriter sw = File.CreateText(filename))
|
||||||
|
{
|
||||||
|
sw.WriteLine($"PlaneStorage");
|
||||||
|
string storageString;
|
||||||
|
foreach (var storage in _planeStorages)
|
||||||
|
{
|
||||||
|
storageString = "";
|
||||||
|
foreach (var plane in storage.Value.GetPlanes)
|
||||||
|
{
|
||||||
|
storageString += $"{plane?.GetDataForSave(_separatorForObject)}{_separatorRecords}";
|
||||||
|
}
|
||||||
|
if (storageString == "")
|
||||||
|
{
|
||||||
|
throw new Exception("Невалиданя операция, нет данных для сохранения");
|
||||||
|
}
|
||||||
|
sw.WriteLine($"{storage.Key.Name}{_separatorForKeyValue}{storageString}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Загрузка информации по автомобилям в хранилище из файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filename">Путь и имя файла</param>
|
||||||
|
/// <returns>true - загрузка прошла успешно, false - ошибка при загрузке данных</returns>
|
||||||
|
public void LoadData(string filename)
|
||||||
|
{
|
||||||
|
if (!File.Exists(filename))
|
||||||
|
{
|
||||||
|
throw new FileNotFoundException("Ошибка открытия файла");
|
||||||
|
}
|
||||||
|
using (StreamReader sr = new StreamReader(filename))
|
||||||
|
{
|
||||||
|
string? currentLine = sr.ReadLine();
|
||||||
|
if (currentLine == null)
|
||||||
|
{
|
||||||
|
throw new IOException("Нет данных для загрузки");
|
||||||
|
}
|
||||||
|
if (!currentLine.Contains("PlaneStorage"))
|
||||||
|
{
|
||||||
|
throw new FileFormatException("Неверный формат данных");
|
||||||
|
}
|
||||||
|
_planeStorages.Clear();
|
||||||
|
currentLine = sr.ReadLine();
|
||||||
|
while (currentLine != null)
|
||||||
|
{
|
||||||
|
string[] record = currentLine.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (record.Length != 2)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
PlanesGenericCollection<DrawingPlane, DrawingObjectPlane> collection = new(_pictureWidth, _pictureHeight);
|
||||||
|
string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
foreach (string elem in set)
|
||||||
|
{
|
||||||
|
DrawingPlane? plane = elem?.CreateDrawingPlane(_separatorForObject, _pictureWidth, _pictureHeight);
|
||||||
|
if (plane != null)
|
||||||
|
{
|
||||||
|
if (collection + plane == -1)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка добавления в коллекцию");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_planeStorages.Add(new PlanesCollectionInfo(record[0], ""), collection);
|
||||||
|
currentLine = sr.ReadLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
ProjStormtrooper/ProjStormtrooper/Program.cs
Normal file
45
ProjStormtrooper/ProjStormtrooper/Program.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The main entry point for the application.
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
|
// see https://aka.ms/applicationconfiguration.
|
||||||
|
ApplicationConfiguration.Initialize();
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
ConfigureServices(services);
|
||||||
|
using (ServiceProvider serviceProvider = services.BuildServiceProvider())
|
||||||
|
{
|
||||||
|
Application.Run(serviceProvider.GetRequiredService<PlaneCollection>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddSingleton<PlaneCollection>()
|
||||||
|
.AddLogging(option =>
|
||||||
|
{
|
||||||
|
var configuration = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.AddJsonFile(path: "AppSettings.json", optional: false, reloadOnChange: true)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var logger = new LoggerConfiguration()
|
||||||
|
.ReadFrom.Configuration(configuration)
|
||||||
|
.CreateLogger();
|
||||||
|
|
||||||
|
option.SetMinimumLevel(LogLevel.Information);
|
||||||
|
option.AddSerilog(logger);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
36
ProjStormtrooper/ProjStormtrooper/ProjStormtrooper.csproj
Normal file
36
ProjStormtrooper/ProjStormtrooper/ProjStormtrooper.csproj
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||||
|
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.7" />
|
||||||
|
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.1-dev-10370" />
|
||||||
|
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.1-dev-00561" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.1-dev-00968" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<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>
|
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper.Properties
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
internal class PlaneNotFoundException : ApplicationException
|
||||||
|
{
|
||||||
|
public PlaneNotFoundException(int i) : base($"Не найден объект по позиции {i}") { }
|
||||||
|
public PlaneNotFoundException() : base() { }
|
||||||
|
public PlaneNotFoundException(string message) : base(message) { }
|
||||||
|
public PlaneNotFoundException(string message, Exception exception) : base(message, exception) { }
|
||||||
|
protected PlaneNotFoundException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
||||||
|
}
|
||||||
|
}
|
63
ProjStormtrooper/ProjStormtrooper/Properties/Resources.Designer.cs
generated
Normal file
63
ProjStormtrooper/ProjStormtrooper/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace ProjStormtrooper.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("ProjStormtrooper.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ProjStormtrooper/ProjStormtrooper/Properties/Resources.resx
Normal file
120
ProjStormtrooper/ProjStormtrooper/Properties/Resources.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper.Properties
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
internal class StorageOverflowException : ApplicationException
|
||||||
|
{
|
||||||
|
public StorageOverflowException(int count) : base($"В наборе превышено допустимое количество: {count}") { }
|
||||||
|
public StorageOverflowException() : base() { }
|
||||||
|
public StorageOverflowException(string message) : base(message) { }
|
||||||
|
public StorageOverflowException(string message, Exception exception) : base(message, exception) { }
|
||||||
|
protected StorageOverflowException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
||||||
|
}
|
||||||
|
}
|
146
ProjStormtrooper/ProjStormtrooper/SetGeneric.cs
Normal file
146
ProjStormtrooper/ProjStormtrooper/SetGeneric.cs
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
using ProjStormtrooper.Properties;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Параметризованный набор объектов
|
||||||
|
/// </summary>
|
||||||
|
internal class SetGeneric<T> where T : class
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Список объектов, которые храним
|
||||||
|
/// </summary>
|
||||||
|
private readonly List<T?> _places;
|
||||||
|
/// <summary>
|
||||||
|
/// Количество объектов в массиве
|
||||||
|
/// </summary>
|
||||||
|
public int Count => _places.Count;
|
||||||
|
/// <summary>
|
||||||
|
/// Максимальное количество объектов в списке
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _maxCount;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="count"></param>
|
||||||
|
public SetGeneric(int count)
|
||||||
|
{
|
||||||
|
_maxCount = count;
|
||||||
|
_places = new List<T?>(count);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Сортировка набора объектов
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comparer"></param>
|
||||||
|
public void SortSet(IComparer<T?> comparer) => _places.Sort(comparer);
|
||||||
|
/// <summary>
|
||||||
|
/// Добавления объекта в набор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="plane"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int Insert(T plane, IEqualityComparer<T?>? equal = null)
|
||||||
|
{
|
||||||
|
return Insert(plane, 0, equal);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление объекта в набор на конкретную позицию
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="plane"></param>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int Insert(T plane, int position, IEqualityComparer<T?>? equal = null)
|
||||||
|
{
|
||||||
|
if (_places.Count == _maxCount)
|
||||||
|
{
|
||||||
|
throw new StorageOverflowException(_maxCount);
|
||||||
|
}
|
||||||
|
// Проверка позиции
|
||||||
|
if (position < 0 || position >= _maxCount)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (equal != null)
|
||||||
|
{
|
||||||
|
foreach (var otherPlane in _places)
|
||||||
|
{
|
||||||
|
if (equal.Equals(otherPlane, plane))
|
||||||
|
{
|
||||||
|
throw new ApplicationException("Такой объект уже есть в коллекции!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Вставка по позиции
|
||||||
|
_places.Insert(position, plane);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление объекта из набора с конкретной позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public T? Remove(int position)
|
||||||
|
{
|
||||||
|
// Проверка позиции
|
||||||
|
if (position < 0 || position >= _maxCount)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (position >= Count && position < _maxCount)
|
||||||
|
{
|
||||||
|
throw new PlaneNotFoundException(position);
|
||||||
|
}
|
||||||
|
// Удаление объекта из массива, присвоив элементу массива значение null
|
||||||
|
T? plane = _places[position];
|
||||||
|
_places.RemoveAt(position);
|
||||||
|
return plane;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение объекта из набора по позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public T? this[int position]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// Проверка позиции
|
||||||
|
if (position < 0 || position >= Count)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return _places[position];
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
// Проверка позиции
|
||||||
|
// Проверка свободных мест в списке
|
||||||
|
if (position < 0 || position >= _maxCount || Count == _maxCount)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Вставка в список по позиции
|
||||||
|
_places.Insert(position, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Проход по списку
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<T?> GetPlanes(int? maxPlanes = null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _places.Count; ++i)
|
||||||
|
{
|
||||||
|
yield return _places[i];
|
||||||
|
if (maxPlanes.HasValue && i == maxPlanes.Value)
|
||||||
|
{
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
ProjStormtrooper/ProjStormtrooper/Status.cs
Normal file
18
ProjStormtrooper/ProjStormtrooper/Status.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Статус выполнения операции перемещения
|
||||||
|
/// </summary>
|
||||||
|
public enum Status
|
||||||
|
{
|
||||||
|
NotInit,
|
||||||
|
InProgress,
|
||||||
|
Finish
|
||||||
|
}
|
||||||
|
}
|
196
ProjStormtrooper/ProjStormtrooper/Stormtrooper.Designer.cs
generated
Normal file
196
ProjStormtrooper/ProjStormtrooper/Stormtrooper.Designer.cs
generated
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
partial class Stormtrooper
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Stormtrooper));
|
||||||
|
pictureBoxStormtrooper = new PictureBox();
|
||||||
|
buttonDown = new Button();
|
||||||
|
buttonUp = new Button();
|
||||||
|
buttonLeft = new Button();
|
||||||
|
buttonRight = new Button();
|
||||||
|
buttonCreateStormtrooper = new Button();
|
||||||
|
buttonCreatePlane = new Button();
|
||||||
|
buttonStep = new Button();
|
||||||
|
comboBoxStrategy = new ComboBox();
|
||||||
|
buttonSelectPlane = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxStormtrooper).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// pictureBoxStormtrooper
|
||||||
|
//
|
||||||
|
pictureBoxStormtrooper.Dock = DockStyle.Fill;
|
||||||
|
pictureBoxStormtrooper.Location = new Point(0, 0);
|
||||||
|
pictureBoxStormtrooper.Name = "pictureBoxStormtrooper";
|
||||||
|
pictureBoxStormtrooper.Size = new Size(884, 461);
|
||||||
|
pictureBoxStormtrooper.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||||
|
pictureBoxStormtrooper.TabIndex = 0;
|
||||||
|
pictureBoxStormtrooper.TabStop = false;
|
||||||
|
pictureBoxStormtrooper.Click += buttonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonDown
|
||||||
|
//
|
||||||
|
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonDown.BackgroundImage = (Image)resources.GetObject("buttonDown.BackgroundImage");
|
||||||
|
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonDown.Location = new Point(806, 419);
|
||||||
|
buttonDown.Name = "buttonDown";
|
||||||
|
buttonDown.Size = new Size(30, 30);
|
||||||
|
buttonDown.TabIndex = 2;
|
||||||
|
buttonDown.UseVisualStyleBackColor = true;
|
||||||
|
buttonDown.Click += buttonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonUp
|
||||||
|
//
|
||||||
|
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonUp.BackgroundImage = (Image)resources.GetObject("buttonUp.BackgroundImage");
|
||||||
|
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonUp.Location = new Point(806, 383);
|
||||||
|
buttonUp.Name = "buttonUp";
|
||||||
|
buttonUp.Size = new Size(30, 30);
|
||||||
|
buttonUp.TabIndex = 3;
|
||||||
|
buttonUp.UseVisualStyleBackColor = true;
|
||||||
|
buttonUp.Click += buttonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonLeft
|
||||||
|
//
|
||||||
|
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonLeft.BackgroundImage = (Image)resources.GetObject("buttonLeft.BackgroundImage");
|
||||||
|
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonLeft.Location = new Point(770, 419);
|
||||||
|
buttonLeft.Name = "buttonLeft";
|
||||||
|
buttonLeft.Size = new Size(30, 30);
|
||||||
|
buttonLeft.TabIndex = 4;
|
||||||
|
buttonLeft.UseVisualStyleBackColor = true;
|
||||||
|
buttonLeft.Click += buttonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonRight
|
||||||
|
//
|
||||||
|
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonRight.BackgroundImage = (Image)resources.GetObject("buttonRight.BackgroundImage");
|
||||||
|
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonRight.Location = new Point(842, 419);
|
||||||
|
buttonRight.Name = "buttonRight";
|
||||||
|
buttonRight.Size = new Size(30, 30);
|
||||||
|
buttonRight.TabIndex = 5;
|
||||||
|
buttonRight.UseVisualStyleBackColor = true;
|
||||||
|
buttonRight.Click += buttonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonCreateStormtrooper
|
||||||
|
//
|
||||||
|
buttonCreateStormtrooper.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
buttonCreateStormtrooper.Location = new Point(12, 428);
|
||||||
|
buttonCreateStormtrooper.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonCreateStormtrooper.Name = "buttonCreateStormtrooper";
|
||||||
|
buttonCreateStormtrooper.Size = new Size(176, 22);
|
||||||
|
buttonCreateStormtrooper.TabIndex = 7;
|
||||||
|
buttonCreateStormtrooper.Text = "Создать штурмовик";
|
||||||
|
buttonCreateStormtrooper.UseVisualStyleBackColor = true;
|
||||||
|
buttonCreateStormtrooper.Click += buttonCreateStormtrooper_Click;
|
||||||
|
//
|
||||||
|
// buttonCreatePlane
|
||||||
|
//
|
||||||
|
buttonCreatePlane.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
buttonCreatePlane.Location = new Point(194, 428);
|
||||||
|
buttonCreatePlane.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonCreatePlane.Name = "buttonCreatePlane";
|
||||||
|
buttonCreatePlane.Size = new Size(176, 22);
|
||||||
|
buttonCreatePlane.TabIndex = 8;
|
||||||
|
buttonCreatePlane.Text = "Создать самолет";
|
||||||
|
buttonCreatePlane.UseVisualStyleBackColor = true;
|
||||||
|
buttonCreatePlane.Click += buttonCreatePlane_Click;
|
||||||
|
//
|
||||||
|
// buttonStep
|
||||||
|
//
|
||||||
|
buttonStep.Location = new Point(790, 38);
|
||||||
|
buttonStep.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonStep.Name = "buttonStep";
|
||||||
|
buttonStep.Size = new Size(82, 22);
|
||||||
|
buttonStep.TabIndex = 9;
|
||||||
|
buttonStep.Text = "Шаг";
|
||||||
|
buttonStep.UseVisualStyleBackColor = true;
|
||||||
|
buttonStep.Click += buttonStep_Click;
|
||||||
|
//
|
||||||
|
// comboBoxStrategy
|
||||||
|
//
|
||||||
|
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxStrategy.FormattingEnabled = true;
|
||||||
|
comboBoxStrategy.Items.AddRange(new object[] { "MoveToCenter", "MoveToRightBottom" });
|
||||||
|
comboBoxStrategy.Location = new Point(739, 11);
|
||||||
|
comboBoxStrategy.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||||
|
comboBoxStrategy.Size = new Size(133, 23);
|
||||||
|
comboBoxStrategy.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// buttonSelectPlane
|
||||||
|
//
|
||||||
|
buttonSelectPlane.Location = new Point(376, 428);
|
||||||
|
buttonSelectPlane.Name = "buttonSelectPlane";
|
||||||
|
buttonSelectPlane.Size = new Size(198, 23);
|
||||||
|
buttonSelectPlane.TabIndex = 11;
|
||||||
|
buttonSelectPlane.Text = "выбрать";
|
||||||
|
buttonSelectPlane.UseVisualStyleBackColor = true;
|
||||||
|
buttonSelectPlane.Click += buttonSelectPlane_Click;
|
||||||
|
//
|
||||||
|
// Stormtrooper
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(884, 461);
|
||||||
|
Controls.Add(buttonSelectPlane);
|
||||||
|
Controls.Add(comboBoxStrategy);
|
||||||
|
Controls.Add(buttonStep);
|
||||||
|
Controls.Add(buttonCreatePlane);
|
||||||
|
Controls.Add(buttonCreateStormtrooper);
|
||||||
|
Controls.Add(buttonRight);
|
||||||
|
Controls.Add(buttonLeft);
|
||||||
|
Controls.Add(buttonUp);
|
||||||
|
Controls.Add(buttonDown);
|
||||||
|
Controls.Add(pictureBoxStormtrooper);
|
||||||
|
Name = "Stormtrooper";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Form1";
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxStormtrooper).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private PictureBox pictureBoxStormtrooper;
|
||||||
|
private Button buttonDown;
|
||||||
|
private Button buttonUp;
|
||||||
|
private Button buttonLeft;
|
||||||
|
private Button buttonRight;
|
||||||
|
private Button buttonCreateStormtrooper;
|
||||||
|
private Button buttonCreatePlane;
|
||||||
|
private Button buttonStep;
|
||||||
|
private ComboBox comboBoxStrategy;
|
||||||
|
private Button buttonSelectPlane;
|
||||||
|
}
|
||||||
|
}
|
180
ProjStormtrooper/ProjStormtrooper/Stormtrooper.cs
Normal file
180
ProjStormtrooper/ProjStormtrooper/Stormtrooper.cs
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
using ProjStormtrooper;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Windows.Forms.Layout;
|
||||||
|
|
||||||
|
namespace ProjStormtrooper
|
||||||
|
{
|
||||||
|
public partial class Stormtrooper : Form
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Ïîëå-îáúåêò äëÿ ïðîðèñîâêè îáúåêòà
|
||||||
|
/// </summary>
|
||||||
|
private DrawingPlane? _drawingPlane;
|
||||||
|
/// <summary>
|
||||||
|
/// Ñòðàòåãèÿ ïåðåìåùåíèÿ
|
||||||
|
/// </summary>
|
||||||
|
private AbstractStrategy? _strategy;
|
||||||
|
/// <summary>
|
||||||
|
/// Âûáðàííûé àâòîìîáèëü
|
||||||
|
/// </summary>
|
||||||
|
public DrawingPlane? SelectedPlane { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Èíèöèàëèçàöèÿ ôîðìû
|
||||||
|
/// </summary>
|
||||||
|
public Stormtrooper()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_strategy = null;
|
||||||
|
SelectedPlane = null;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Ìåòîä ïðîðèñîâêè îáúåêòà
|
||||||
|
/// </summary>
|
||||||
|
private void Draw()
|
||||||
|
{
|
||||||
|
if (_drawingPlane == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Bitmap bmp = new(pictureBoxStormtrooper.Width, pictureBoxStormtrooper.Height);
|
||||||
|
Graphics g = Graphics.FromImage(bmp);
|
||||||
|
_drawingPlane.DrawTransport(g);
|
||||||
|
pictureBoxStormtrooper.Image = bmp;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Îáðàáîò÷èê íàæàòèÿ êíîïêè "Ñîçäàòü øòóðìîâèê"
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void buttonCreateStormtrooper_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Random random = new();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
Color dopColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
|
dialog = new();
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
dopColor = dialog.Color;
|
||||||
|
}
|
||||||
|
_drawingPlane = new DrawingStormtrooper(
|
||||||
|
random.Next(100, 300),
|
||||||
|
random.Next(1000, 3000),
|
||||||
|
color,
|
||||||
|
dopColor,
|
||||||
|
Convert.ToBoolean(random.Next(0, 2)),
|
||||||
|
Convert.ToBoolean(random.Next(0, 2)),
|
||||||
|
pictureBoxStormtrooper.Width,
|
||||||
|
pictureBoxStormtrooper.Height
|
||||||
|
);
|
||||||
|
_drawingPlane.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Îáðàáîò÷èê íàæàòèÿ êíîïêè "Ñîçäàòü ñàìîëåò"
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void buttonCreatePlane_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Random random = new();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
_drawingPlane = new DrawingPlane(
|
||||||
|
random.Next(100, 300),
|
||||||
|
random.Next(1000, 3000),
|
||||||
|
color,
|
||||||
|
pictureBoxStormtrooper.Width,
|
||||||
|
pictureBoxStormtrooper.Height
|
||||||
|
);
|
||||||
|
_drawingPlane.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Îáðàáîò÷èê íàæàòèÿ êíîïîê ïåðåìåùåíèÿ
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void buttonMove_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawingPlane == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string buttonName = ((Button)sender)?.Name ?? string.Empty;
|
||||||
|
switch (buttonName)
|
||||||
|
{
|
||||||
|
case "buttonUp":
|
||||||
|
_drawingPlane.MoveTransport(Direction.Up);
|
||||||
|
break;
|
||||||
|
case "buttonDown":
|
||||||
|
_drawingPlane.MoveTransport(Direction.Down);
|
||||||
|
break;
|
||||||
|
case "buttonLeft":
|
||||||
|
_drawingPlane.MoveTransport(Direction.Left);
|
||||||
|
break;
|
||||||
|
case "buttonRight":
|
||||||
|
_drawingPlane.MoveTransport(Direction.Right);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Øàã"
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void buttonStep_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawingPlane == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (comboBoxStrategy.Enabled)
|
||||||
|
{
|
||||||
|
_strategy = comboBoxStrategy.SelectedIndex switch
|
||||||
|
{
|
||||||
|
0 => new MoveToCenter(),
|
||||||
|
1 => new MoveToRightBottom(),
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
if (_strategy == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_strategy.SetData(new DrawingObjectPlane(_drawingPlane), pictureBoxStormtrooper.Width, pictureBoxStormtrooper.Height);
|
||||||
|
}
|
||||||
|
if (_strategy == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
comboBoxStrategy.Enabled = false;
|
||||||
|
_strategy.MakeStep();
|
||||||
|
Draw();
|
||||||
|
if (_strategy.GetStatus() == Status.Finish)
|
||||||
|
{
|
||||||
|
comboBoxStrategy.Enabled = true;
|
||||||
|
_strategy = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Âûáîð ñàìîëåòà
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
|
||||||
|
private void buttonSelectPlane_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SelectedPlane = _drawingPlane;
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
328
ProjStormtrooper/ProjStormtrooper/Stormtrooper.resx
Normal file
328
ProjStormtrooper/ProjStormtrooper/Stormtrooper.resx
Normal file
@ -0,0 +1,328 @@
|
|||||||
|
<?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.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<data name="buttonDown.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAANQAAADuCAMAAAB24dnhAAAABGdBTUEAALGPC/xhBQAAAHtQTFRFAAAA
|
||||||
|
////7u7u7e3t9fX1+Pj48/Pz+/v79PT0fn5+UFBQ5+fnMzMzs7Oz19fXb29vjY2NtLS00tLSpaWlHh4e
|
||||||
|
vLy8U1NTOzs7CgoKTExMysrK4eHhLy8vFBQUNzc3a2trk5OTXV1denp6JycnnJycIyMjWlpaREREw8PD
|
||||||
|
TPw7owAAAAlwSFlzAAAOvAAADrwBlbxySQAACpZJREFUeF7tnel2ozgQhQNiceI4e2dzMr1MT3e//xNO
|
||||||
|
lbgFRVo2SyQWH30/cuIbTOmmMCoJgc/SNDVJjaGXlgJCkpSimQxKkmS1lifJmWfObYhchwAbSKkpoSQJ
|
||||||
|
lJaLaApKNDWcaMqjqVZEtMUbMVMxU8vMVK11m0rxO+EyBSVNlSkoaRrOFALYEKDOVNqYKqC0TPEPI2h7
|
||||||
|
QmMvh2Ja/7wApjiEPiyEJmwBxSgrKRRjKlMwq3JWH3QqZ+7DPIQpCnHgWAeu/EAhPmsqC5KpmU3FTPUj
|
||||||
|
Zipm6rQz1eqnRJs/U7UGgYBCWFP4XWelqSM2UMgUFN3JZ0UAUxxCmbIhGUemXLVFesY9MFTCdsiMsgfl
|
||||||
|
YCePtnhDaj+hsbKBYnTtB0W7iEMPKNHUcKKpaCqa8kswU61+SrT5TdWaMlVrEIizgihr+JVlA6EscyhF
|
||||||
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3WotqlgXbLMVUv88URXQ/LwZ3QWGjAKa4B8bvhO2QGR1R0JkSlCko7U7eNRdzUdht
|
||||||
|
XSGa/+Wn5ij4R/2PUnEg6JwN7uRtnL9u6n6yGxF1WFcI9R+EMt1XYDSfrkOmPpYW/PTbCoep4R9gCAQU
|
||||||
|
IkiVDkkitmYt3vnptxWOEOsxpV09V0+KtThCrMiUmrVQntZuqvwFT9+SJsTaTSVJVVrwc1kgEI4Q6zJl
|
||||||
|
O+HvHBgC4QixLlP8FJzq6bcQCEeIdZky+etLaf8AgXCE8GEqTf8HdnQJUTEEfskAAAAASUVORK5CYII=
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<data name="buttonUp.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAANQAAADuCAMAAAB24dnhAAAABGdBTUEAALGPC/xhBQAAAHtQTFRFAAAA
|
||||||
|
////7u7u7e3t9fX1+Pj48/Pz+/v79PT0fn5+UFBQ5+fnMzMzs7Oz19fXb29vjY2NtLS00tLSpaWlHh4e
|
||||||
|
vLy8U1NTOzs7CgoKTExMysrK4eHhLy8vFBQUNzc3a2trk5OTXV1denp6JycnnJycIyMjWlpaREREw8PD
|
||||||
|
TPw7owAAAAlwSFlzAAAOvAAADrwBlbxySQAACthJREFUeF7tnet62ygURSXr5tS5p0kTO22nTWam7/+E
|
||||||
|
c4ANHNlYxjLIyMP60a/aUYJWkMwRwk6xMJSGCsmiRVCWjc6qGklZ1ibrkJRli2hRISDEZtu9rRuWOZro
|
||||||
|
HE3YZhskvAnbLBI0O5VUc1W8V0sEhKOJ2UmVv4qi+FghIBxNzEyqKp/IqSjeEBCOJmYmVf4lnYriH7Oj
|
||||||
|
o4l5SZXPcCqKn0jmL/X8CiXiHpmjiVlJPX6HkARWjibmJHV7DR1wI1NHE95SjmaRoFmXlPnpXArJYsGk
|
||||||
|
kNA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Iogtd2EBAGBgEBAICDE1mXWfvg/Ya4kLoVk
|
||||||
|
vlW62oFAkKXCkaUUWersUqoJQe4p/J+QL/gCLqXhUpqIUhoupWFSSHbGKbkMQeC7eiL+yszad2WmzY78
|
||||||
|
Exhg3xlxjirdZLbPhj5eEug98v1UMPL9FECSsFTuKQWShKVyTymQaCk5IAu4lIZLabgUEaOn9pcvAo85
|
||||||
|
CjkgSzAkEwiSX5nZryMUYstR0PZqP53tPyPCS+0911Vm+8fjfb56D3Z15fupUGQpRZbKUqHIUooBKQ2X
|
||||||
|
0nApTUQpDZfSMCkkO3MUSpWwJZH9FApWJiGZ4hOuWtuE65Mplkj4p1CYPpMdMljQzmiOQiP7LN9PCRLo
|
||||||
|
KUS5p3JP5Z7yI/cUQKKl5IAs4FIaLqXhUkSMntpfvghcdcTWHIXMJI7+sbUFawfJJJ9wxX6DSJx1BNcj
|
||||||
|
XFK2z0xBm+gcBSIuJXbzlBo4zaNK2ZPugqRyT0nEbrmnJFlqDFlKcflSi8V/mZMJUYvwpvEAAAAASUVO
|
||||||
|
RK5CYII=
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<data name="buttonLeft.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAAO4AAADUCAMAAACs0e/bAAAABGdBTUEAALGPC/xhBQAAAHtQTFRFAAAA
|
||||||
|
////7u7u7e3t9fX1+Pj48/Pz+/v79PT0fn5+UFBQ5+fnMzMzs7Oz19fXb29vjY2NtLS00tLSpaWlHh4e
|
||||||
|
vLy8U1NTOzs7CgoKTExMysrK4eHhLy8vFBQUNzc3a2trk5OTXV1denp6JycnnJycIyMjWlpaREREw8PD
|
||||||
|
TPw7owAAAAlwSFlzAAAOvAAADrwBlbxySQAACkhJREFUeF7lnQ17ozYWhSMEiNq7aZNt2k4yu/3Ybjv/
|
||||||
|
/xfukThCF1s2AmM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S6wjZ0PbKuR9b1yLoe1NWTDcdY13NjWTIxVsWZ6YBzqQCDs5u5
|
||||||
|
OGomMmuYGFPjddqpU6IHFUqsVpaEjAFgAK4eIoiFO2xfU706Go5mas7KxCHCsrLMwnoeeimxnlc5IpJ1
|
||||||
|
7cO2vj6ClfkB4Hnd699CKk63unqZ5/J0tXqjW4TydPFylydBF6iLuq+XbjdQpu7FSdCfqMt2AzABDG4f
|
||||||
|
NDrGRzis7kD/exYGdx2r4p94ZS6L0cJlUlXi9rdMqipUq5nIzC7wOr4DPqiwTu9RtieIhyzxEGHUvPpM
|
||||||
|
1B0yUQMZfi3mm3yIsLBsnzEATMD6R0Qet0jxfiMjHCUdAHr6ulHfcnVBc3YKqWhdfXZ7vcJ1T+folK6r
|
||||||
|
jqObRRavq46ywdqGrkfW9ci6HlnXI+oyYVPTiknQY13PXco6GIBoz8xALtzQ6IhujolsajomZ01NI+as
|
||||||
|
XOiZGaxa1sEArH6IENm++sfiOjp3OES4VNYi1vNdj4gIkzCiU+gBIGESfHeiq3kdnd3o9iNY+9F1V0be
|
||||||
|
ka69y9OedJX68nVXuu2fn6Sr1P8BtxoJUcy/fqEAAAAASUVORK5CYII=
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<data name="buttonRight.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAAO4AAADUCAMAAACs0e/bAAAABGdBTUEAALGPC/xhBQAAAHtQTFRFAAAA
|
||||||
|
////7u7u7e3t9fX1+Pj48/Pz+/v79PT0fn5+UFBQ5+fnMzMzs7Oz19fXb29vjY2NtLS00tLSpaWlHh4e
|
||||||
|
vLy8U1NTOzs7CgoKTExMysrK4eHhLy8vFBQUNzc3a2trk5OTXV1denp6JycnnJycIyMjWlpaREREw8PD
|
||||||
|
TPw7owAAAAlwSFlzAAAOvAAADrwBlbxySQAACPxJREFUeF7ln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
||||||
|
3K2/5gqNQsbV42ngCcC96za2hmvFc614rhXPtWK5cBrLNeDq655gdBN7zR88l/d6S4ZBQqOLFpH4lElw
|
||||||
|
SA3bktu+9tXqDdsXnNr2lUQrdW9mAIPUQez1zohmpp+m49ir4eZj7GhgkC4eG0V/AWaKCVFAjQwfAAAA
|
||||||
|
AElFTkSuQmCC
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
25
ProjStormtrooper/Stormtrooper.sln
Normal file
25
ProjStormtrooper/Stormtrooper.sln
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.7.34221.43
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjStormtrooper", "ProjStormtrooper\ProjStormtrooper.csproj", "{92C8545F-7184-42F3-A9D8-DEF885CC394F}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{92C8545F-7184-42F3-A9D8-DEF885CC394F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{92C8545F-7184-42F3-A9D8-DEF885CC394F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{92C8545F-7184-42F3-A9D8-DEF885CC394F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{92C8545F-7184-42F3-A9D8-DEF885CC394F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {DAC0834C-1138-4E6E-AAFC-4189DB0D3D25}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
Loading…
x
Reference in New Issue
Block a user