Вторая лабораторная работа
This commit is contained in:
parent
23df8865a7
commit
2bd34526e3
@ -0,0 +1,139 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using projectDoubleDeckerBus.Drawings;
|
||||||
|
using projectDoubleDeckerBus.Entity;
|
||||||
|
|
||||||
|
namespace projectDouble_Decker_Bus.MovementStrategy
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace projectDoubleDeckerBus
|
namespace projectDoubleDeckerBus.Drawings
|
||||||
{
|
{
|
||||||
public enum Direction
|
public enum Direction
|
||||||
{
|
{
|
||||||
|
284
projectDoubleDeckerBus/projectDoubleDeckerBus/DrawningBus.cs
Normal file
284
projectDoubleDeckerBus/projectDoubleDeckerBus/DrawningBus.cs
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using projectDoubleDeckerBus;
|
||||||
|
using System.Drawing;
|
||||||
|
using projectDoubleDeckerBus.Entity;
|
||||||
|
|
||||||
|
namespace projectDoubleDeckerBus.Drawings
|
||||||
|
{
|
||||||
|
public class DrawningBus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-сущность
|
||||||
|
/// </summary>
|
||||||
|
public EntityBus? EntityBus { get; protected set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина окна
|
||||||
|
/// </summary>
|
||||||
|
private int _pictureWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота окна
|
||||||
|
/// </summary>
|
||||||
|
private int _pictureHeight;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// Левая координата прорисовки автобуса
|
||||||
|
/// </summary>
|
||||||
|
protected int _startPosX;
|
||||||
|
/// <summary>
|
||||||
|
/// Верхняя кооридната прорисовки автобуса
|
||||||
|
/// </summary>
|
||||||
|
protected int _startPosY;
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина прорисовки автобуса
|
||||||
|
/// </summary>
|
||||||
|
protected readonly int _busWidth = 172;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота прорисовки автобуса
|
||||||
|
/// </summary>
|
||||||
|
protected readonly int _busHeight = 112;
|
||||||
|
/// <summary>
|
||||||
|
/// Координата X объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetPosX => _startPosX;
|
||||||
|
/// <summary>
|
||||||
|
/// Координата Y объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetPosY => _startPosY;
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetWidth => _busWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetHeight => _busHeight;
|
||||||
|
/// <summary>
|
||||||
|
/// Инициализация свойств
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Цвет кузова</param>
|
||||||
|
/// <param name="width">Ширина картинки</param>
|
||||||
|
/// <param name="height">Высота картинки</param>
|
||||||
|
/// <returns>true - объект создан, false - проверка не пройдена,
|
||||||
|
///
|
||||||
|
public bool CanMove(Direction direction)
|
||||||
|
{
|
||||||
|
if (EntityBus == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return direction switch
|
||||||
|
{
|
||||||
|
//влево
|
||||||
|
Direction.Left => _startPosX - EntityBus.Step > 0,
|
||||||
|
//вверх
|
||||||
|
Direction.Up => _startPosY - EntityBus.Step > 0,
|
||||||
|
//Down
|
||||||
|
Direction.Down => _startPosY + EntityBus.Step < _pictureHeight,
|
||||||
|
//Right
|
||||||
|
Direction.Right => _startPosX + EntityBus.Step < _pictureWidth
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MoveTransport(Direction direction)
|
||||||
|
{
|
||||||
|
if (EntityBus == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
//влево
|
||||||
|
case Direction.Left:
|
||||||
|
if (_startPosX - EntityBus.Step > 0)
|
||||||
|
{
|
||||||
|
_startPosX -= (int)EntityBus.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//вверх
|
||||||
|
case Direction.Up:
|
||||||
|
if (_startPosY - EntityBus.Step > 0)
|
||||||
|
{
|
||||||
|
_startPosY -= (int)EntityBus.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// вправо
|
||||||
|
case Direction.Right:
|
||||||
|
if (_startPosX + _busWidth + EntityBus.Step < _pictureWidth)
|
||||||
|
{
|
||||||
|
_startPosX += (int)EntityBus.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//вниз
|
||||||
|
case Direction.Down:
|
||||||
|
if (_startPosY + _busHeight + EntityBus.Step < _pictureHeight)
|
||||||
|
{
|
||||||
|
_startPosY += (int)EntityBus.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public DrawningBus(int speed, double weight, Color bodyColor, int width, int height)
|
||||||
|
{
|
||||||
|
_pictureWidth = width;
|
||||||
|
_pictureHeight = height;
|
||||||
|
EntityBus = new EntityBus(speed, weight, bodyColor);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Проверка на вместимость обьекта в рамки сцены
|
||||||
|
/// </summary>
|
||||||
|
if ((_busWidth >= _pictureWidth) || (_busHeight >= _pictureHeight))
|
||||||
|
{
|
||||||
|
Console.WriteLine("проверка не пройдена, нельзя создать объект в этих размерах");
|
||||||
|
if (_busWidth >= _pictureWidth)
|
||||||
|
{
|
||||||
|
_busWidth = _pictureWidth - _busWidth;
|
||||||
|
}
|
||||||
|
if (_busHeight >= _pictureWidth)
|
||||||
|
{
|
||||||
|
_busHeight = _pictureWidth - _busHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Console.WriteLine("объект создан");
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
/// <param name="width">Ширина картинки</param>
|
||||||
|
/// <param name="height">Высота картинки</param>
|
||||||
|
/// <param name="busWidth">Ширина прорисовки автомобиля</param>
|
||||||
|
/// <param name="busHeight">Высота прорисовки автомобиля</param>
|
||||||
|
protected DrawningBus(int speed, double weight, Color bodyColor, int
|
||||||
|
width, int height, int busWidth, int busHeight)
|
||||||
|
{
|
||||||
|
if (busWidth >= width || busHeight >= height)
|
||||||
|
{
|
||||||
|
if (busWidth >= width)
|
||||||
|
{
|
||||||
|
busWidth = width - busWidth;
|
||||||
|
}
|
||||||
|
if (busHeight >= height)
|
||||||
|
{
|
||||||
|
busHeight = height - busHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
|
||||||
|
_pictureWidth = width;
|
||||||
|
_pictureHeight = height;
|
||||||
|
_busWidth = busWidth;
|
||||||
|
_busHeight = busHeight;
|
||||||
|
EntityBus = new EntityBus(speed, weight, bodyColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPosition(int x, int y)
|
||||||
|
{
|
||||||
|
if (((x + _busWidth > _pictureWidth)) || ((y >= 0) && (y + _busHeight > _pictureHeight)))
|
||||||
|
{
|
||||||
|
_startPosX = _pictureWidth - _busWidth;
|
||||||
|
_startPosY = _pictureHeight - _busHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_startPosX = x;
|
||||||
|
_startPosY = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MoveBus(Direction direction)
|
||||||
|
{
|
||||||
|
if (EntityBus == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
//влево
|
||||||
|
case Direction.Left:
|
||||||
|
if (_startPosX - EntityBus.Step > 0)
|
||||||
|
{
|
||||||
|
_startPosX -= (int)EntityBus.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//вверх
|
||||||
|
case Direction.Up:
|
||||||
|
if (_startPosY - EntityBus.Step > 0)
|
||||||
|
{
|
||||||
|
_startPosY -= (int)EntityBus.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// вправо
|
||||||
|
case Direction.Right:
|
||||||
|
if (_startPosX + EntityBus.Step + _busWidth < _pictureWidth)
|
||||||
|
{
|
||||||
|
_startPosX += (int)EntityBus.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//вниз
|
||||||
|
case Direction.Down:
|
||||||
|
if (_startPosY + EntityBus.Step + _busHeight < _pictureHeight)
|
||||||
|
{
|
||||||
|
_startPosY += (int)EntityBus.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Изменение направления перемещения
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction">Направление</param>
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Прорисовка объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
public virtual void DrawTransport(Graphics g)
|
||||||
|
{
|
||||||
|
if (EntityBus == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int windowSize = 15;
|
||||||
|
Brush brBlack = new SolidBrush(Color.Black);
|
||||||
|
Brush brRed = new SolidBrush(Color.Red);
|
||||||
|
|
||||||
|
Pen pen = new(Color.Black);
|
||||||
|
|
||||||
|
Brush br = new SolidBrush(EntityBus?.BodyColor ?? Color.Black);
|
||||||
|
g.FillRectangle(br, _startPosX + 40, _startPosY + 34, 130, 52);
|
||||||
|
|
||||||
|
g.DrawEllipse(pen, _startPosX + 46, _startPosY + 50, windowSize, windowSize);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 62, _startPosY + 50, windowSize, windowSize);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 100, _startPosY + 50, windowSize, windowSize);
|
||||||
|
|
||||||
|
g.DrawEllipse(pen, _startPosX + 115, _startPosY + 50, windowSize, windowSize);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 130, _startPosY + 50, windowSize, windowSize);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 145, _startPosY + 50, windowSize, windowSize);
|
||||||
|
|
||||||
|
g.FillRectangle(brBlack, _startPosX + 80, _startPosY + 46, 15, 40);
|
||||||
|
g.FillEllipse(brBlack, _startPosX + 50, _startPosY + 75, 20, 20);
|
||||||
|
g.FillEllipse(brBlack, _startPosX + 140, _startPosY + 75, 20, 20);
|
||||||
|
|
||||||
|
Brush brBlue = new SolidBrush(Color.LightBlue);
|
||||||
|
g.FillEllipse(brBlue, _startPosX + 46, _startPosY + 50, windowSize, windowSize);
|
||||||
|
g.FillEllipse(brBlue, _startPosX + 62, _startPosY + 50, windowSize, windowSize);
|
||||||
|
g.FillEllipse(brBlue, _startPosX + 100, _startPosY + 50, windowSize, windowSize);
|
||||||
|
g.FillEllipse(brBlue, _startPosX + 115, _startPosY + 50, windowSize, windowSize);
|
||||||
|
g.FillEllipse(brBlue, _startPosX + 130, _startPosY + 50, windowSize, windowSize);
|
||||||
|
g.FillEllipse(brBlue, _startPosX + 145, _startPosY + 50, windowSize, windowSize);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,176 +3,53 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using projectDoubleDeckerBus.Entity;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
namespace projectDoubleDeckerBus
|
namespace projectDoubleDeckerBus.Drawings
|
||||||
{
|
{
|
||||||
public class DrawningDoubleDeckerBus
|
public class DrawningDoubleDeckerBus : DrawningBus
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс-сущность
|
/// Конструктор
|
||||||
/// </summary>
|
|
||||||
public EntityDoubleDeckerBus? EntityDoubleDeckerBus { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина окна
|
|
||||||
/// </summary>
|
|
||||||
private int _pictureWidth;
|
|
||||||
/// <summary>
|
|
||||||
/// Высота окна
|
|
||||||
/// </summary>
|
|
||||||
private int _pictureHeight;
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// Левая координата прорисовки автобуса
|
|
||||||
/// </summary>
|
|
||||||
private int _startPosX;
|
|
||||||
/// <summary>
|
|
||||||
/// Верхняя кооридната прорисовки автобуса
|
|
||||||
/// </summary>
|
|
||||||
private int _startPosY;
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина прорисовки автобуса
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _busWidth = 172;
|
|
||||||
/// <summary>
|
|
||||||
/// Высота прорисовки автобуса
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _busHeight = 113;
|
|
||||||
/// <summary>
|
|
||||||
/// Инициализация свойств
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="speed">Скорость</param>
|
/// <param name="speed">Скорость</param>
|
||||||
/// <param name="weight">Вес</param>
|
/// <param name="weight">Вес</param>
|
||||||
/// <param name="bodyColor">Цвет кузова</param>
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
/// <param name="headlight">Признак наличия фары</param>
|
/// <param name="bodyKit">Признак наличия обвеса</param>
|
||||||
/// <param name="floor">Признак наличия этажа</param>
|
/// <param name="wing">Признак наличия антикрыла</param>
|
||||||
/// <param name="tailpipe">Признак наличия выхлопа</param>
|
/// <param name="sportLine">Признак наличия гоночной полосы</param>
|
||||||
/// <param name="width">Ширина картинки</param>
|
/// <param name="width">Ширина картинки</param>
|
||||||
/// <param name="height">Высота картинки</param>
|
/// <param name="height">Высота картинки</param>
|
||||||
/// <returns>true - объект создан, false - проверка не пройдена,
|
public DrawningDoubleDeckerBus(int speed, double weight, Color bodyColor, Color
|
||||||
|
additionalColor, bool floor, bool tailpipe, int width, int height) :
|
||||||
|
|
||||||
public bool Init(int speed, double weight, Color bodyColor, Color
|
base(speed, weight, bodyColor, width, height, 172, 112)
|
||||||
additionalColor, bool headlight, bool floor, bool tailpipe, int width, int height)
|
|
||||||
{
|
{
|
||||||
_pictureWidth = width;
|
if (EntityBus != null)
|
||||||
_pictureHeight = height;
|
|
||||||
EntityDoubleDeckerBus = new EntityDoubleDeckerBus();
|
|
||||||
EntityDoubleDeckerBus.Init(speed, weight, bodyColor, additionalColor, headlight, floor, tailpipe);
|
|
||||||
/// Проверка на вместимость обьекта в рамки сцены
|
|
||||||
/// </summary>
|
|
||||||
if ((_busWidth >= _pictureWidth) || (_busHeight >= _pictureHeight))
|
|
||||||
{
|
{
|
||||||
Console.WriteLine("проверка не пройдена, нельзя создать объект в этих размерах");
|
EntityBus = new EntityDoubleDeckerBus(speed, weight, bodyColor,
|
||||||
return false;
|
additionalColor, floor, tailpipe);
|
||||||
}
|
|
||||||
else
|
|
||||||
Console.WriteLine("объект создан");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Установка позиции
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="x">Координата X</param>
|
|
||||||
/// <param name="y">Координата Y</param>
|
|
||||||
public void SetPosition(int x, int y)
|
|
||||||
{
|
|
||||||
if (((x >= 0) && (x + _busWidth > _pictureWidth)) || ((y >= 0) && (y + _busHeight > _pictureHeight)))
|
|
||||||
{
|
|
||||||
_startPosX = _pictureWidth - _busWidth;
|
|
||||||
_startPosY = _pictureHeight - _busHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_startPosX = x;
|
|
||||||
_startPosY = y;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
public override void DrawTransport(Graphics g)
|
||||||
/// Изменение направления перемещения
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="direction">Направление</param>
|
|
||||||
public void MoveTransport(Direction direction)
|
|
||||||
{
|
{
|
||||||
if (EntityDoubleDeckerBus == null)
|
if (EntityBus is not EntityDoubleDeckerBus doubleDeckerBus)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (direction)
|
Pen pen = new(Color.Black);
|
||||||
{
|
Brush additionalBrush = new
|
||||||
//влево
|
SolidBrush(doubleDeckerBus.AdditionalColor);
|
||||||
case Direction.Left:
|
|
||||||
if (_startPosX - EntityDoubleDeckerBus.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosX -= (int)EntityDoubleDeckerBus.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
//вверх
|
|
||||||
case Direction.Up:
|
|
||||||
if (_startPosY - EntityDoubleDeckerBus.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosY -= (int)EntityDoubleDeckerBus.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// вправо
|
|
||||||
case Direction.Right:
|
|
||||||
if (_startPosX + _busWidth + EntityDoubleDeckerBus.Step < _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX += (int)EntityDoubleDeckerBus.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
//вниз
|
|
||||||
case Direction.Down:
|
|
||||||
if (_startPosY + _busHeight + EntityDoubleDeckerBus.Step < _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY += (int)EntityDoubleDeckerBus.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Прорисовка объекта
|
/// Прорисовка объекта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="g"></param>
|
/// <param name="g"></param>
|
||||||
public void DrawTransport(Graphics g)
|
///
|
||||||
{
|
|
||||||
if (EntityDoubleDeckerBus == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int windowSize = 15;
|
int windowSize = 15;
|
||||||
Brush brBlack = new SolidBrush(Color.Black);
|
|
||||||
Brush brRed = new SolidBrush(Color.Red);
|
|
||||||
|
|
||||||
Pen pen = new(Color.Black);
|
if (doubleDeckerBus.Floor)
|
||||||
Brush additionalBrush = new SolidBrush(EntityDoubleDeckerBus.AdditionalColor);
|
|
||||||
|
|
||||||
Brush br = new SolidBrush(EntityDoubleDeckerBus?.BodyColor ?? Color.Black);
|
|
||||||
g.FillRectangle(br, _startPosX + 40, _startPosY + 34, 130, 52);
|
|
||||||
|
|
||||||
g.DrawEllipse(pen, _startPosX + 46, _startPosY + 50, windowSize, windowSize);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 62, _startPosY + 50, windowSize, windowSize);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 100, _startPosY + 50, windowSize, windowSize);
|
|
||||||
|
|
||||||
g.DrawEllipse(pen, _startPosX + 115, _startPosY + 50, windowSize, windowSize);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 130, _startPosY + 50, windowSize, windowSize);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 145, _startPosY + 50, windowSize, windowSize);
|
|
||||||
|
|
||||||
//колеса
|
|
||||||
g.FillRectangle(brBlack, _startPosX + 80, _startPosY + 46, 15, 40);
|
|
||||||
g.FillEllipse(brBlack, _startPosX + 50, _startPosY + 75, 20, 20);
|
|
||||||
g.FillEllipse(brBlack, _startPosX + 140, _startPosY + 75, 20, 20);
|
|
||||||
|
|
||||||
Brush brBlue = new SolidBrush(Color.LightBlue);
|
|
||||||
g.FillEllipse(brBlue, _startPosX + 46, _startPosY + 50, windowSize, windowSize);
|
|
||||||
g.FillEllipse(brBlue, _startPosX + 62, _startPosY + 50, windowSize, windowSize);
|
|
||||||
g.FillEllipse(brBlue, _startPosX + 100, _startPosY + 50, windowSize, windowSize);
|
|
||||||
g.FillEllipse(brBlue, _startPosX + 115, _startPosY + 50, windowSize, windowSize);
|
|
||||||
g.FillEllipse(brBlue, _startPosX + 130, _startPosY + 50, windowSize, windowSize);
|
|
||||||
g.FillEllipse(brBlue, _startPosX + 145, _startPosY + 50, windowSize, windowSize);
|
|
||||||
|
|
||||||
if (EntityDoubleDeckerBus.Floor)
|
|
||||||
{
|
{
|
||||||
g.DrawEllipse(pen, _startPosX + 46, _startPosY + 10, windowSize, windowSize);
|
g.DrawEllipse(pen, _startPosX + 46, _startPosY + 10, windowSize, windowSize);
|
||||||
g.DrawEllipse(pen, _startPosX + 62, _startPosY + 10, windowSize, windowSize);
|
g.DrawEllipse(pen, _startPosX + 62, _startPosY + 10, windowSize, windowSize);
|
||||||
@ -183,27 +60,23 @@ namespace projectDoubleDeckerBus
|
|||||||
g.DrawEllipse(pen, _startPosX + 145, _startPosY + 10, windowSize, windowSize);
|
g.DrawEllipse(pen, _startPosX + 145, _startPosY + 10, windowSize, windowSize);
|
||||||
|
|
||||||
g.FillRectangle(additionalBrush, _startPosX + 40,
|
g.FillRectangle(additionalBrush, _startPosX + 40,
|
||||||
_startPosY + 1, 130, 32);
|
_startPosY + 2, 130, 32);
|
||||||
|
|
||||||
Brush brBlue1 = new SolidBrush(Color.LightBlue);
|
Brush brBlue1 = new SolidBrush(Color.LightBlue);
|
||||||
g.FillEllipse(brBlue, _startPosX + 46, _startPosY + 10, windowSize, windowSize);
|
g.FillEllipse(brBlue1, _startPosX + 46, _startPosY + 10, windowSize, windowSize);
|
||||||
g.FillEllipse(brBlue, _startPosX + 62, _startPosY + 10, windowSize, windowSize);
|
g.FillEllipse(brBlue1, _startPosX + 62, _startPosY + 10, windowSize, windowSize);
|
||||||
g.FillEllipse(brBlue, _startPosX + 100, _startPosY + 10, windowSize, windowSize);
|
g.FillEllipse(brBlue1, _startPosX + 100, _startPosY + 10, windowSize, windowSize);
|
||||||
g.FillEllipse(brBlue, _startPosX + 115, _startPosY + 10, windowSize, windowSize);
|
g.FillEllipse(brBlue1, _startPosX + 115, _startPosY + 10, windowSize, windowSize);
|
||||||
g.FillEllipse(brBlue, _startPosX + 130, _startPosY + 10, windowSize, windowSize);
|
g.FillEllipse(brBlue1, _startPosX + 130, _startPosY + 10, windowSize, windowSize);
|
||||||
g.FillEllipse(brBlue, _startPosX + 145, _startPosY + 10, windowSize, windowSize);
|
g.FillEllipse(brBlue1, _startPosX + 145, _startPosY + 10, windowSize, windowSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EntityDoubleDeckerBus.Headlight)
|
if (doubleDeckerBus.Tailpipe)
|
||||||
{
|
|
||||||
g.FillEllipse(additionalBrush, _startPosX + 162, _startPosY + 78, 10, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EntityDoubleDeckerBus.Tailpipe)
|
|
||||||
{
|
{
|
||||||
g.FillRectangle(additionalBrush, _startPosX, _startPosY + 76, 40, 10);
|
g.FillRectangle(additionalBrush, _startPosX, _startPosY + 76, 40, 10);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
base.DrawTransport(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using projectDoubleDeckerBus.Entity;
|
||||||
|
using projectDoubleDeckerBus.Drawings;
|
||||||
|
using System.Drawing;
|
||||||
|
using projectDoubleDeckerBus;
|
||||||
|
|
||||||
|
namespace projectDouble_Decker_Bus.MovementStrategy
|
||||||
|
{
|
||||||
|
public class DrawningObjectBus : IMoveableObject
|
||||||
|
{
|
||||||
|
private readonly DrawningBus? _drawningBus = null;
|
||||||
|
public DrawningObjectBus(DrawningBus drawningBus)
|
||||||
|
{
|
||||||
|
_drawningBus = drawningBus;
|
||||||
|
}
|
||||||
|
public ObjectParameters? GetObjectPosition
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_drawningBus == null || _drawningBus.EntityBus ==
|
||||||
|
null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new ObjectParameters(_drawningBus.GetPosX,
|
||||||
|
_drawningBus.GetPosY, _drawningBus.GetWidth, _drawningBus.GetHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int GetStep => (int)(_drawningBus?.EntityBus?.Step ?? 0);
|
||||||
|
public bool CheckCanMove(Direction direction) =>
|
||||||
|
_drawningBus?.CanMove(direction) ?? false;
|
||||||
|
public void MoveObject(Direction direction) =>
|
||||||
|
_drawningBus?.MoveTransport(direction);
|
||||||
|
}
|
||||||
|
}
|
41
projectDoubleDeckerBus/projectDoubleDeckerBus/EntityBus.cs
Normal file
41
projectDoubleDeckerBus/projectDoubleDeckerBus/EntityBus.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace projectDoubleDeckerBus.Entity
|
||||||
|
{
|
||||||
|
public class EntityBus
|
||||||
|
{
|
||||||
|
/// <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 * 100 / Weight;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор с параметрами
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес автомобиля</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
public EntityBus(int speed, double weight, Color bodyColor)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
BodyColor = bodyColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,23 +3,13 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
namespace projectDoubleDeckerBus
|
namespace projectDoubleDeckerBus.Entity
|
||||||
{
|
{
|
||||||
public class EntityDoubleDeckerBus
|
|
||||||
|
public class EntityDoubleDeckerBus : EntityBus
|
||||||
{
|
{
|
||||||
/// <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>
|
||||||
/// Дополнительный цвет (для опциональных элементов)
|
/// Дополнительный цвет (для опциональных элементов)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -27,37 +17,28 @@ namespace projectDoubleDeckerBus
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Признак (опция) наличия фары
|
/// Признак (опция) наличия фары
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Headlight { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Признак (опция) наличия второго этажа
|
|
||||||
/// </summary>
|
|
||||||
public bool Floor { get; private set; }
|
public bool Floor { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Признак (опция) наличия выхлопа
|
/// Признак (опция) наличия выхлопа
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Tailpipe { get; private set; }
|
public bool Tailpipe { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Шаг перемещения автобуса
|
|
||||||
/// </summary>
|
|
||||||
public double Step => (double)Speed * 100 / Weight;
|
|
||||||
/// <summary>
|
|
||||||
/// Инициализация полей объекта-класса спортивного автобуса
|
/// Инициализация полей объекта-класса спортивного автобуса
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// /// <summary>
|
||||||
|
/// Инициализация полей объекта-класса спортивного автомобиля
|
||||||
|
/// </summary>
|
||||||
/// <param name="speed">Скорость</param>
|
/// <param name="speed">Скорость</param>
|
||||||
/// <param name="weight">Вес автобуса</param>
|
/// <param name="weight">Вес автомобиля</param>
|
||||||
/// <param name="bodyColor">Основной цвет</param>
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
/// <param name="headlight">Признак наличия фары</param>
|
/// <param name="headlight">Признак наличия фары</param>
|
||||||
/// <param name="floor">Признак наличия второго этажаы</param>
|
/// <param name="floor">Признак наличия второго этажаы</param>
|
||||||
/// <param name="tailpipe">Признак наличия выхлопа</param>
|
/// <param name="tailpipe">Признак наличия выхлопа</param>
|
||||||
public void Init(int speed, double weight, Color bodyColor, Color
|
public EntityDoubleDeckerBus(int speed, double weight, Color bodyColor, Color additionalColor, bool floor, bool tailpipe)
|
||||||
additionalColor, bool headlight, bool floor, bool tailpipe)
|
: base(speed, weight, bodyColor)
|
||||||
{
|
{
|
||||||
Speed = speed;
|
|
||||||
Weight = weight;
|
|
||||||
BodyColor = bodyColor;
|
|
||||||
AdditionalColor = additionalColor;
|
AdditionalColor = additionalColor;
|
||||||
Headlight = headlight;
|
|
||||||
Floor = floor;
|
Floor = floor;
|
||||||
Tailpipe = tailpipe;
|
Tailpipe = tailpipe;
|
||||||
}
|
}
|
||||||
|
@ -29,17 +29,15 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
pictureBoxDoubleDeckerBus = new PictureBox();
|
pictureBoxDoubleDeckerBus = new PictureBox();
|
||||||
buttonCreate = new Button();
|
buttonCreateDoubleDeckerBus = new Button();
|
||||||
buttonDown = new Button();
|
buttonDown = new Button();
|
||||||
buttonLeft = new Button();
|
buttonLeft = new Button();
|
||||||
buttonUp = new Button();
|
buttonUp = new Button();
|
||||||
buttonRight = new Button();
|
buttonRight = new Button();
|
||||||
statusStrip1 = new StatusStrip();
|
ButtonCreateBus = new Button();
|
||||||
toolStripStatusLabelSpeed = new ToolStripStatusLabel();
|
buttonStep = new Button();
|
||||||
toolStripStatusLabelWeight = new ToolStripStatusLabel();
|
comboBoxStrategy = new ComboBox();
|
||||||
toolStripStatusLabelColor = new ToolStripStatusLabel();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxDoubleDeckerBus).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureBoxDoubleDeckerBus).BeginInit();
|
||||||
statusStrip1.SuspendLayout();
|
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// pictureBoxDoubleDeckerBus
|
// pictureBoxDoubleDeckerBus
|
||||||
@ -52,22 +50,22 @@
|
|||||||
pictureBoxDoubleDeckerBus.TabIndex = 0;
|
pictureBoxDoubleDeckerBus.TabIndex = 0;
|
||||||
pictureBoxDoubleDeckerBus.TabStop = false;
|
pictureBoxDoubleDeckerBus.TabStop = false;
|
||||||
//
|
//
|
||||||
// buttonCreate
|
// buttonCreateDoubleDeckerBus
|
||||||
//
|
//
|
||||||
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonCreateDoubleDeckerBus.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
buttonCreate.Location = new Point(12, 399);
|
buttonCreateDoubleDeckerBus.Location = new Point(12, 414);
|
||||||
buttonCreate.Name = "buttonCreate";
|
buttonCreateDoubleDeckerBus.Name = "buttonCreateDoubleDeckerBus";
|
||||||
buttonCreate.Size = new Size(75, 23);
|
buttonCreateDoubleDeckerBus.Size = new Size(158, 23);
|
||||||
buttonCreate.TabIndex = 1;
|
buttonCreateDoubleDeckerBus.TabIndex = 1;
|
||||||
buttonCreate.Text = "Create";
|
buttonCreateDoubleDeckerBus.Text = "CreateDoubleDeckerBus";
|
||||||
buttonCreate.UseVisualStyleBackColor = true;
|
buttonCreateDoubleDeckerBus.UseVisualStyleBackColor = true;
|
||||||
buttonCreate.Click += ButtonCreate_Click;
|
buttonCreateDoubleDeckerBus.Click += buttonCreateDoubleDeckerBus_Click;
|
||||||
//
|
//
|
||||||
// buttonDown
|
// buttonDown
|
||||||
//
|
//
|
||||||
buttonDown.BackgroundImage = Properties.Resources.вниз;
|
buttonDown.BackgroundImage = Properties.Resources.вниз;
|
||||||
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonDown.Location = new Point(692, 392);
|
buttonDown.Location = new Point(696, 407);
|
||||||
buttonDown.Name = "buttonDown";
|
buttonDown.Name = "buttonDown";
|
||||||
buttonDown.Size = new Size(30, 30);
|
buttonDown.Size = new Size(30, 30);
|
||||||
buttonDown.TabIndex = 2;
|
buttonDown.TabIndex = 2;
|
||||||
@ -78,7 +76,7 @@
|
|||||||
//
|
//
|
||||||
buttonLeft.BackgroundImage = Properties.Resources.влево;
|
buttonLeft.BackgroundImage = Properties.Resources.влево;
|
||||||
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonLeft.Location = new Point(656, 392);
|
buttonLeft.Location = new Point(660, 407);
|
||||||
buttonLeft.Name = "buttonLeft";
|
buttonLeft.Name = "buttonLeft";
|
||||||
buttonLeft.Size = new Size(30, 30);
|
buttonLeft.Size = new Size(30, 30);
|
||||||
buttonLeft.TabIndex = 3;
|
buttonLeft.TabIndex = 3;
|
||||||
@ -89,7 +87,7 @@
|
|||||||
//
|
//
|
||||||
buttonUp.BackgroundImage = Properties.Resources.вверх;
|
buttonUp.BackgroundImage = Properties.Resources.вверх;
|
||||||
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonUp.Location = new Point(692, 356);
|
buttonUp.Location = new Point(696, 371);
|
||||||
buttonUp.Name = "buttonUp";
|
buttonUp.Name = "buttonUp";
|
||||||
buttonUp.Size = new Size(30, 30);
|
buttonUp.Size = new Size(30, 30);
|
||||||
buttonUp.TabIndex = 4;
|
buttonUp.TabIndex = 4;
|
||||||
@ -100,71 +98,72 @@
|
|||||||
//
|
//
|
||||||
buttonRight.BackgroundImage = Properties.Resources.вправо;
|
buttonRight.BackgroundImage = Properties.Resources.вправо;
|
||||||
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonRight.Location = new Point(728, 392);
|
buttonRight.Location = new Point(732, 407);
|
||||||
buttonRight.Name = "buttonRight";
|
buttonRight.Name = "buttonRight";
|
||||||
buttonRight.Size = new Size(30, 30);
|
buttonRight.Size = new Size(30, 30);
|
||||||
buttonRight.TabIndex = 5;
|
buttonRight.TabIndex = 5;
|
||||||
buttonRight.UseVisualStyleBackColor = true;
|
buttonRight.UseVisualStyleBackColor = true;
|
||||||
buttonRight.Click += ButtonMove_Click;
|
buttonRight.Click += ButtonMove_Click;
|
||||||
//
|
//
|
||||||
// statusStrip1
|
// ButtonCreateBus
|
||||||
//
|
//
|
||||||
statusStrip1.Items.AddRange(new ToolStripItem[] { toolStripStatusLabelSpeed, toolStripStatusLabelWeight, toolStripStatusLabelColor });
|
ButtonCreateBus.Location = new Point(190, 414);
|
||||||
statusStrip1.Location = new Point(0, 428);
|
ButtonCreateBus.Name = "ButtonCreateBus";
|
||||||
statusStrip1.Name = "statusStrip1";
|
ButtonCreateBus.Size = new Size(128, 23);
|
||||||
statusStrip1.Size = new Size(800, 22);
|
ButtonCreateBus.TabIndex = 7;
|
||||||
statusStrip1.TabIndex = 6;
|
ButtonCreateBus.Text = "CreateBus";
|
||||||
statusStrip1.Text = "statusStrip1";
|
ButtonCreateBus.UseVisualStyleBackColor = true;
|
||||||
|
ButtonCreateBus.Click += buttonCreateBus_Click;
|
||||||
//
|
//
|
||||||
// toolStripStatusLabelSpeed
|
// buttonStep
|
||||||
//
|
//
|
||||||
toolStripStatusLabelSpeed.Name = "toolStripStatusLabelSpeed";
|
buttonStep.Location = new Point(671, 33);
|
||||||
toolStripStatusLabelSpeed.Size = new Size(39, 17);
|
buttonStep.Name = "buttonStep";
|
||||||
toolStripStatusLabelSpeed.Text = "Speed";
|
buttonStep.Size = new Size(117, 26);
|
||||||
|
buttonStep.TabIndex = 8;
|
||||||
|
buttonStep.Text = "Step";
|
||||||
|
buttonStep.UseVisualStyleBackColor = true;
|
||||||
|
buttonStep.Click += buttonStep_Click;
|
||||||
//
|
//
|
||||||
// toolStripStatusLabelWeight
|
// comboBoxStrategy
|
||||||
//
|
//
|
||||||
toolStripStatusLabelWeight.Name = "toolStripStatusLabelWeight";
|
comboBoxStrategy.FormattingEnabled = true;
|
||||||
toolStripStatusLabelWeight.Size = new Size(45, 17);
|
comboBoxStrategy.Items.AddRange(new object[] { "MoveToCenter", "MoveToBorder" });
|
||||||
toolStripStatusLabelWeight.Text = "Weight";
|
comboBoxStrategy.Location = new Point(671, 82);
|
||||||
//
|
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||||
// toolStripStatusLabelColor
|
comboBoxStrategy.Size = new Size(117, 23);
|
||||||
//
|
comboBoxStrategy.TabIndex = 9;
|
||||||
toolStripStatusLabelColor.Name = "toolStripStatusLabelColor";
|
|
||||||
toolStripStatusLabelColor.Size = new Size(36, 17);
|
|
||||||
toolStripStatusLabelColor.Text = "Color";
|
|
||||||
//
|
//
|
||||||
// FormDoubleDeckerBus
|
// FormDoubleDeckerBus
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(800, 450);
|
ClientSize = new Size(800, 450);
|
||||||
Controls.Add(statusStrip1);
|
Controls.Add(comboBoxStrategy);
|
||||||
|
Controls.Add(buttonStep);
|
||||||
|
Controls.Add(ButtonCreateBus);
|
||||||
Controls.Add(buttonRight);
|
Controls.Add(buttonRight);
|
||||||
Controls.Add(buttonUp);
|
Controls.Add(buttonUp);
|
||||||
Controls.Add(buttonLeft);
|
Controls.Add(buttonLeft);
|
||||||
Controls.Add(buttonDown);
|
Controls.Add(buttonDown);
|
||||||
Controls.Add(buttonCreate);
|
Controls.Add(buttonCreateDoubleDeckerBus);
|
||||||
Controls.Add(pictureBoxDoubleDeckerBus);
|
Controls.Add(pictureBoxDoubleDeckerBus);
|
||||||
Name = "FormDoubleDeckerBus";
|
Name = "FormDoubleDeckerBus";
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "DoubleDeckerBus";
|
Text = "DoubleDeckerBus";
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxDoubleDeckerBus).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureBoxDoubleDeckerBus).EndInit();
|
||||||
statusStrip1.ResumeLayout(false);
|
|
||||||
statusStrip1.PerformLayout();
|
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
private PictureBox pictureBoxDoubleDeckerBus;
|
private PictureBox pictureBoxDoubleDeckerBus;
|
||||||
private Button buttonCreate;
|
private Button buttonCreateDoubleDeckerBus;
|
||||||
private Button buttonDown;
|
private Button buttonDown;
|
||||||
private Button buttonLeft;
|
private Button buttonLeft;
|
||||||
private Button buttonUp;
|
private Button buttonUp;
|
||||||
private Button buttonRight;
|
private Button buttonRight;
|
||||||
private StatusStrip statusStrip1;
|
private Button ButtonCreateBus;
|
||||||
private ToolStripStatusLabel toolStripStatusLabelSpeed;
|
private Button buttonStep;
|
||||||
private ToolStripStatusLabel toolStripStatusLabelWeight;
|
private ComboBox comboBoxStrategy;
|
||||||
private ToolStripStatusLabel toolStripStatusLabelColor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,8 +1,14 @@
|
|||||||
|
using projectDoubleDeckerBus.Drawings;
|
||||||
|
using projectDoubleDeckerBus.Entity;
|
||||||
|
using projectDouble_Decker_Bus.MovementStrategy;
|
||||||
|
|
||||||
namespace projectDoubleDeckerBus
|
namespace projectDoubleDeckerBus
|
||||||
{
|
{
|
||||||
public partial class FormDoubleDeckerBus : Form
|
public partial class FormDoubleDeckerBus : Form
|
||||||
{
|
{
|
||||||
private DrawningDoubleDeckerBus? _drawningDoubleDeckerBus;
|
private DrawningBus? _drawningBus;
|
||||||
|
|
||||||
|
private AbstractStrategy? _abstractStrategy;
|
||||||
public FormDoubleDeckerBus()
|
public FormDoubleDeckerBus()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -10,39 +16,35 @@ namespace projectDoubleDeckerBus
|
|||||||
|
|
||||||
private void Draw()
|
private void Draw()
|
||||||
{
|
{
|
||||||
if (_drawningDoubleDeckerBus == null)
|
if (_drawningBus == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Bitmap bmp = new(pictureBoxDoubleDeckerBus.Width,
|
Bitmap bmp = new(pictureBoxDoubleDeckerBus.Width,
|
||||||
pictureBoxDoubleDeckerBus.Height);
|
pictureBoxDoubleDeckerBus.Height);
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
_drawningDoubleDeckerBus.DrawTransport(gr);
|
_drawningBus.DrawTransport(gr);
|
||||||
pictureBoxDoubleDeckerBus.Image = bmp;
|
pictureBoxDoubleDeckerBus.Image = bmp;
|
||||||
}
|
}
|
||||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
private void buttonCreateDoubleDeckerBus_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random random = new();
|
Random random = new();
|
||||||
_drawningDoubleDeckerBus = new DrawningDoubleDeckerBus();
|
_drawningBus = new DrawningDoubleDeckerBus(random.Next(100, 300),
|
||||||
_drawningDoubleDeckerBus.Init(random.Next(100, 300),
|
|
||||||
random.Next(1000, 3000),
|
random.Next(1000, 3000),
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
||||||
random.Next(0, 256)),
|
random.Next(0, 256)),
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
||||||
random.Next(0, 256)),
|
random.Next(0, 256)),
|
||||||
Convert.ToBoolean(random.Next(0, 2)),
|
|
||||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
|
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
|
||||||
|
|
||||||
pictureBoxDoubleDeckerBus.Width, pictureBoxDoubleDeckerBus.Height);
|
pictureBoxDoubleDeckerBus.Width, pictureBoxDoubleDeckerBus.Height);
|
||||||
_drawningDoubleDeckerBus.SetPosition(random.Next(10, 100),
|
_drawningBus.SetPosition(random.Next(10, 100), random.Next(10,
|
||||||
random.Next(10, 100));
|
100));
|
||||||
Draw();
|
Draw();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonMove_Click(object sender, EventArgs e)
|
private void ButtonMove_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_drawningDoubleDeckerBus == null)
|
if (_drawningBus == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -50,21 +52,70 @@ namespace projectDoubleDeckerBus
|
|||||||
switch (name)
|
switch (name)
|
||||||
{
|
{
|
||||||
case "buttonUp":
|
case "buttonUp":
|
||||||
_drawningDoubleDeckerBus.MoveTransport(Direction.Up);
|
_drawningBus.MoveTransport(Direction.Up);
|
||||||
break;
|
break;
|
||||||
case "buttonDown":
|
case "buttonDown":
|
||||||
_drawningDoubleDeckerBus.MoveTransport(Direction.Down);
|
_drawningBus.MoveTransport(Direction.Down);
|
||||||
break;
|
break;
|
||||||
case "buttonLeft":
|
case "buttonLeft":
|
||||||
_drawningDoubleDeckerBus.MoveTransport(Direction.Left);
|
_drawningBus.MoveTransport(Direction.Left);
|
||||||
break;
|
break;
|
||||||
case "buttonRight":
|
case "buttonRight":
|
||||||
_drawningDoubleDeckerBus.MoveTransport(Direction.Right);
|
_drawningBus.MoveTransport(Direction.Right);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Draw();
|
Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCreateBus_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Random random = new();
|
||||||
|
_drawningBus = new DrawningBus(random.Next(100, 300),
|
||||||
|
random.Next(1000, 3000),
|
||||||
|
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
||||||
|
random.Next(0, 256)),
|
||||||
|
pictureBoxDoubleDeckerBus.Width, pictureBoxDoubleDeckerBus.Height);
|
||||||
|
_drawningBus.SetPosition(random.Next(10, 100), random.Next(10,
|
||||||
|
100));
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonStep_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawningBus == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (comboBoxStrategy.Enabled)
|
||||||
|
{
|
||||||
|
_abstractStrategy = comboBoxStrategy.SelectedIndex
|
||||||
|
switch
|
||||||
|
{
|
||||||
|
0 => new MoveToCenter(),
|
||||||
|
1 => new MoveToBorder(),
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
if (_abstractStrategy == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_abstractStrategy.SetData(new
|
||||||
|
DrawningObjectBus(_drawningBus), pictureBoxDoubleDeckerBus.Width,
|
||||||
|
pictureBoxDoubleDeckerBus.Height);
|
||||||
|
comboBoxStrategy.Enabled = false;
|
||||||
|
}
|
||||||
|
if (_abstractStrategy == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_abstractStrategy.MakeStep();
|
||||||
|
Draw();
|
||||||
|
if (_abstractStrategy.GetStatus() == Status.Finish)
|
||||||
|
{
|
||||||
|
comboBoxStrategy.Enabled = true;
|
||||||
|
_abstractStrategy = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
@ -117,9 +117,6 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>25</value>
|
<value>25</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using projectDoubleDeckerBus;
|
||||||
|
using projectDoubleDeckerBus.Drawings;
|
||||||
|
|
||||||
|
namespace projectDouble_Decker_Bus.MovementStrategy
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace projectDouble_Decker_Bus.MovementStrategy
|
||||||
|
{
|
||||||
|
class MoveToBorder : AbstractStrategy
|
||||||
|
{
|
||||||
|
protected override bool IsTargetDestinaion()
|
||||||
|
{
|
||||||
|
var objParams = GetObjectParameters;
|
||||||
|
if (objParams == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return objParams.RightBorder <= FieldWidth &&
|
||||||
|
objParams.RightBorder + GetStep() >= FieldWidth &&
|
||||||
|
objParams.DownBorder <= FieldHeight &&
|
||||||
|
objParams.DownBorder + GetStep() >= FieldHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void MoveToTarget()
|
||||||
|
{
|
||||||
|
var objParams = GetObjectParameters;
|
||||||
|
if (objParams == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var diffX = FieldWidth - objParams.RightBorder;
|
||||||
|
if (Math.Abs(diffX) > GetStep())
|
||||||
|
{
|
||||||
|
MoveRight();
|
||||||
|
}
|
||||||
|
var diffY = FieldHeight - objParams.DownBorder;
|
||||||
|
if (Math.Abs(diffY) > GetStep())
|
||||||
|
{
|
||||||
|
MoveDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using projectDoubleDeckerBus.Drawings;
|
||||||
|
using projectDoubleDeckerBus.Entity;
|
||||||
|
|
||||||
|
namespace projectDouble_Decker_Bus.MovementStrategy
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace projectDouble_Decker_Bus.MovementStrategy
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
projectDoubleDeckerBus/projectDoubleDeckerBus/Status.cs
Normal file
15
projectDoubleDeckerBus/projectDoubleDeckerBus/Status.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace projectDouble_Decker_Bus.MovementStrategy
|
||||||
|
{
|
||||||
|
public enum Status
|
||||||
|
{
|
||||||
|
NotInit = 0,
|
||||||
|
InProgress = 1,
|
||||||
|
Finish = 2
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user