lab2 #2
131
DumpTruck/DumpTruck/AbstractStrategy.cs
Normal file
131
DumpTruck/DumpTruck/AbstractStrategy.cs
Normal file
@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DumpTruck.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(DirectionType.Left);
|
||||
/// <summary>
|
||||
/// Перемещение вправо
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveRight() => MoveTo(DirectionType.Right);
|
||||
/// <summary>
|
||||
/// Перемещение вверх
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveUp() => MoveTo(DirectionType.Up);
|
||||
/// <summary>
|
||||
/// Перемещение вниз
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveDown() => MoveTo(DirectionType.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(DirectionType directionType)
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_moveableObject?.CheckCanMove(directionType) ?? false)
|
||||
{
|
||||
_moveableObject.MoveObject(directionType);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -6,11 +6,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace DumpTruck
|
||||
{
|
||||
internal enum DirectionType
|
||||
public enum DirectionType
|
||||
{
|
||||
Up = 1,
|
||||
Down = 2,
|
||||
Left = 3,
|
||||
Right = 4
|
||||
}
|
||||
}
|
||||
}
|
@ -1,134 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DumpTruck
|
||||
{
|
||||
internal class DrawingTruck
|
||||
{
|
||||
public EntityTruck? EntityTruck { get; private set; }
|
||||
private int _startPosX;
|
||||
private int _startPosY;
|
||||
private int _pictureWidth;
|
||||
private int _pictureHeight;
|
||||
protected readonly int _truckWidth = 100;
|
||||
protected readonly int _truckHeight = 50;
|
||||
public bool Init(int speed, float weight, Color bodyColor, Color additionalColor, int width, int height, bool threeWheels, bool dump)
|
||||
{
|
||||
if (width < _truckWidth || height < _truckHeight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
EntityTruck = new EntityTruck();
|
||||
EntityTruck.Init(speed, weight, bodyColor, additionalColor, threeWheels, dump);
|
||||
return true;
|
||||
}
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (x < 0 || x + _truckWidth > _pictureWidth)
|
||||
{
|
||||
x = _pictureWidth - _truckWidth;
|
||||
}
|
||||
if (y < 0 || y + _truckHeight > _pictureHeight)
|
||||
{
|
||||
y = _pictureHeight - _truckHeight;
|
||||
}
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
}
|
||||
public void MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (EntityTruck == null)
|
||||
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case DirectionType.Left:
|
||||
if (_startPosX - EntityTruck.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)EntityTruck.Step;
|
||||
}
|
||||
break;
|
||||
//вверх
|
||||
case DirectionType.Up:
|
||||
if (_startPosY - EntityTruck.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)EntityTruck.Step;
|
||||
}
|
||||
break;
|
||||
//вправо
|
||||
case DirectionType.Right:
|
||||
if (_startPosX + EntityTruck.Step + _truckWidth < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)EntityTruck.Step;
|
||||
}
|
||||
break;
|
||||
case DirectionType.Down:
|
||||
if (_startPosY + EntityTruck.Step + _truckHeight < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)EntityTruck.Step;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public void DrawTransport(Graphics g, Color bodyColor, Color additionalColor, bool threeWheels, bool Dump)
|
||||
{
|
||||
if (EntityTruck == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Brush br = new SolidBrush(EntityTruck?.BodyColor ?? Color.Black);
|
||||
g.FillRectangle(br, _startPosX + 80, _startPosY, 20, 30);
|
||||
|
||||
Brush brBodyRandom = new SolidBrush(bodyColor);
|
||||
g.FillRectangle(brBodyRandom, _startPosX, _startPosY + 30, 100, 5);
|
||||
|
||||
Brush brBlack = new SolidBrush(Color.Black);
|
||||
|
||||
g.FillEllipse(brBlack, _startPosX, _startPosY + 35, 20, 20);
|
||||
if (threeWheels)
|
||||
g.FillEllipse(brBlack, _startPosX + 22, _startPosY + 35, 20, 20);
|
||||
g.FillEllipse(brBlack, _startPosX + 80, _startPosY + 35, 20, 20);
|
||||
|
||||
Brush brWhite = new SolidBrush(Color.White);
|
||||
g.FillEllipse(brWhite, _startPosX + 5, _startPosY + 40, 10, 10);
|
||||
if (threeWheels)
|
||||
g.FillEllipse(brWhite, _startPosX + 27, _startPosY + 40, 10, 10);
|
||||
g.FillEllipse(brWhite, _startPosX + 85, _startPosY + 40, 10, 10);
|
||||
|
||||
Pen pen = new Pen(Color.Black);
|
||||
|
||||
g.DrawRectangle(pen, _startPosX + 80, _startPosY, 20, 30);
|
||||
g.DrawRectangle(pen, _startPosX, _startPosY + 30, 100, 5);
|
||||
g.DrawEllipse(pen, _startPosX, _startPosY + 35, 20, 20);
|
||||
if (threeWheels)
|
||||
g.DrawEllipse(pen, _startPosX + 22, _startPosY + 35, 20, 20);
|
||||
g.DrawEllipse(pen, _startPosX + 80, _startPosY + 35, 20, 20);
|
||||
|
||||
|
||||
//Brush brBody = new SolidBrush(EntityTruck?.AdditionalColor ?? Color.Red);
|
||||
if (Dump)
|
||||
{
|
||||
Brush brBodyAdditional = new SolidBrush(additionalColor);
|
||||
g.FillRectangle(brBodyAdditional, _startPosX + 0, _startPosY, 70, 30);
|
||||
Pen pen1 = new Pen(Color.Black);
|
||||
g.DrawRectangle(pen1, _startPosX + 0, _startPosY, 70, 30);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
65
DumpTruck/DumpTruck/DrawningDumpTruck.cs
Normal file
65
DumpTruck/DumpTruck/DrawningDumpTruck.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DumpTruck.DrawningObjects;
|
||||
using DumpTruck.Entities;
|
||||
|
||||
namespace DumpTruck.DrawningObjects
|
||||
{
|
||||
public class DrawningDumpTruck : DrawningTruck
|
||||
{
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="width">Ширина картинки</param>
|
||||
/// <param name="height">Высота картинки</param>
|
||||
/// <param name="bodyKit">Признак наличия груза</param>
|
||||
/// <param name="tent">Признак наличия тента</param>
|
||||
public DrawningDumpTruck(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool tent, int width, int height) :
|
||||
base(speed, weight, bodyColor, width, height, 110, 60)
|
||||
{
|
||||
if (EntityTruck != null)
|
||||
{
|
||||
EntityTruck = new EntityDumpTruck(speed, weight, bodyColor, additionalColor, bodyKit, tent);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Отрисовка автомобиля
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityTruck is not EntityDumpTruck dumpTruck)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Brush brushAdditionalColor = new SolidBrush(dumpTruck.AdditionalColor);
|
||||
Brush brushWhite = new SolidBrush(Color.White);
|
||||
Pen penBlack = new Pen(Color.Black);
|
||||
|
||||
base.DrawTransport(g);
|
||||
|
||||
if (dumpTruck.BodyKit)
|
||||
{
|
||||
g.FillRectangle(brushAdditionalColor, _startPosX, _startPosY + 30, 100, 5);
|
||||
g.FillRectangle(brushAdditionalColor, _startPosX, _startPosY + 10, 70, 20);
|
||||
g.DrawRectangle(penBlack, _startPosX, _startPosY + 30, 100, 5);
|
||||
g.DrawRectangle(penBlack, _startPosX, _startPosY + 10, 70, 20);
|
||||
|
||||
if (dumpTruck.Tent)
|
||||
{
|
||||
g.FillRectangle(brushWhite, _startPosX, _startPosY + 10, 70, 5);
|
||||
g.DrawRectangle(penBlack, _startPosX, _startPosY + 10, 70, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
33
DumpTruck/DumpTruck/DrawningObjectTruck.cs
Normal file
33
DumpTruck/DumpTruck/DrawningObjectTruck.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DumpTruck.DrawningObjects;
|
||||
|
||||
namespace DumpTruck.MovementStrategy
|
||||
{
|
||||
public class DrawningObjectTruck : IMoveableObject
|
||||
{
|
||||
private readonly DrawningTruck? _drawningTruck = null;
|
||||
public DrawningObjectTruck(DrawningTruck drawningTruck)
|
||||
{
|
||||
_drawningTruck = drawningTruck;
|
||||
}
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_drawningTruck == null || _drawningTruck.EntityTruck == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_drawningTruck.GetPosX, _drawningTruck.GetPosY, _drawningTruck.GetWidth, _drawningTruck.GetHeight);
|
||||
}
|
||||
}
|
||||
public int GetStep => (int)(_drawningTruck?.EntityTruck?.Step ?? 0);
|
||||
|
||||
public bool CheckCanMove(DirectionType direction) => _drawningTruck?.CanMove(direction) ?? false;
|
||||
public void MoveObject(DirectionType direction) => _drawningTruck?.MoveTransport(direction);
|
||||
}
|
||||
}
|
223
DumpTruck/DumpTruck/DrawningTruck.cs
Normal file
223
DumpTruck/DumpTruck/DrawningTruck.cs
Normal file
@ -0,0 +1,223 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DumpTruck.Entities;
|
||||
|
||||
namespace DumpTruck.DrawningObjects
|
||||
{
|
||||
public class DrawningTruck
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-сущность
|
||||
/// </summary>
|
||||
public EntityTruck? EntityTruck { 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 _truckWidth = 110;
|
||||
/// <summary>
|
||||
/// Высота прорисовки автомобиля
|
||||
/// </summary>
|
||||
protected readonly int _truckHeight = 60;
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Координата X объекта
|
||||
/// </summary>
|
||||
public int GetPosX => _startPosX;
|
||||
/// <summary>
|
||||
/// Координата Y объекта
|
||||
/// </summary>
|
||||
public int GetPosY => _startPosY;
|
||||
/// <summary>
|
||||
/// Ширина объекта
|
||||
/// </summary>
|
||||
public int GetWidth => _truckWidth;
|
||||
/// <summary>
|
||||
/// Высота объекта
|
||||
/// </summary>
|
||||
public int GetHeight => _truckHeight;
|
||||
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
/// <param name="width">Ширина картинки</param>
|
||||
/// <param name="height">Высота картинки</param>
|
||||
public DrawningTruck(int speed, double weight, Color bodyColor, int width, int height)
|
||||
{
|
||||
if (width < _truckWidth || height < _truckHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
EntityTruck = new EntityTruck(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="truckWidth">Ширина прорисовки автомобиля</param>
|
||||
/// <param name="truckHeight">Высота прорисовки автомобиля</param>
|
||||
protected DrawningTruck(int speed, double weight, Color bodyColor, int width, int height, int truckWidth, int truckHeight)
|
||||
{
|
||||
if (width <= _truckWidth || height <= _truckHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
_truckWidth = truckWidth;
|
||||
_truckHeight = truckHeight;
|
||||
EntityTruck = new EntityTruck(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Проверка, что объект может переместится по указанному направлению
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
/// <returns>true - можно переместится по указанному направлению</returns>
|
||||
public bool CanMove(DirectionType direction)
|
||||
{
|
||||
if (EntityTruck == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return direction switch
|
||||
{
|
||||
//влево
|
||||
DirectionType.Left => _startPosX - EntityTruck.Step > 0,
|
||||
//вверх
|
||||
DirectionType.Up => _startPosY - EntityTruck.Step > 0,
|
||||
// вправо
|
||||
DirectionType.Right => _startPosX + _truckWidth + EntityTruck.Step < _pictureWidth,
|
||||
//вниз
|
||||
DirectionType.Down => _startPosY + _truckHeight + EntityTruck.Step < _pictureHeight,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Установка позиции
|
||||
/// </summary>
|
||||
/// <param name="x">Координата X</param>
|
||||
/// <param name="y">Координата Y</param>
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (x < 0 || x + _truckWidth > _pictureWidth)
|
||||
{
|
||||
x = Math.Max(0, _pictureWidth - _truckWidth);
|
||||
}
|
||||
if (y < 0 || y + _truckHeight > _pictureHeight)
|
||||
{
|
||||
y = Math.Max(0, _pictureHeight - _truckHeight);
|
||||
}
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Изменение направления перемещения
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
public void MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (!CanMove(direction) || EntityTruck == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case DirectionType.Left:
|
||||
if (_startPosX - EntityTruck.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)EntityTruck.Step;
|
||||
}
|
||||
break;
|
||||
//вверх
|
||||
case DirectionType.Up:
|
||||
if (_startPosY - EntityTruck.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)EntityTruck.Step;
|
||||
}
|
||||
break;
|
||||
// вправо
|
||||
case DirectionType.Right:
|
||||
if (_startPosX + _truckWidth + EntityTruck.Step < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)EntityTruck.Step;
|
||||
}
|
||||
break;
|
||||
//вниз
|
||||
case DirectionType.Down:
|
||||
if (_startPosY + _truckHeight + EntityTruck.Step < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)EntityTruck.Step;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Прорисовка объекта
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityTruck == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen penBlack = new Pen(Color.Black);
|
||||
Brush brushBodyColor = new SolidBrush(EntityTruck.BodyColor);
|
||||
Brush brushBlack = new SolidBrush(Color.Black);
|
||||
Brush brushWhite = new SolidBrush(Color.White);
|
||||
|
||||
//Кабина
|
||||
g.FillRectangle(brushBodyColor, _startPosX + 80, _startPosY, 20, 30);
|
||||
g.DrawRectangle(penBlack, _startPosX + 80, _startPosY, 20, 30);
|
||||
|
||||
//Рама
|
||||
g.FillRectangle(brushBodyColor, _startPosX, _startPosY + 30, 100, 5);
|
||||
g.DrawRectangle(penBlack, _startPosX, _startPosY + 30, 100, 5);
|
||||
|
||||
//Колёса
|
||||
g.FillEllipse(brushBlack, _startPosX, _startPosY + 35, 20, 20);
|
||||
g.FillEllipse(brushBlack, _startPosX + 22, _startPosY + 35, 20, 20);
|
||||
g.FillEllipse(brushBlack, _startPosX + 80, _startPosY + 35, 20, 20);
|
||||
|
||||
g.FillEllipse(brushWhite, _startPosX + 5, _startPosY + 40, 10, 10);
|
||||
g.FillEllipse(brushWhite, _startPosX + 27, _startPosY + 40, 10, 10);
|
||||
g.FillEllipse(brushWhite, _startPosX + 85, _startPosY + 40, 10, 10);
|
||||
|
||||
g.DrawEllipse(penBlack, _startPosX, _startPosY + 35, 20, 20);
|
||||
g.DrawEllipse(penBlack, _startPosX + 22, _startPosY + 35, 20, 20);
|
||||
g.DrawEllipse(penBlack, _startPosX + 80, _startPosY + 35, 20, 20);
|
||||
}
|
||||
}
|
||||
}
|
43
DumpTruck/DumpTruck/EntityDumpTruck.cs
Normal file
43
DumpTruck/DumpTruck/EntityDumpTruck.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using DumpTruck.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DumpTruck.Entities
|
||||
{
|
||||
internal class EntityDumpTruck: EntityTruck
|
||||
{
|
||||
/// <summary>
|
||||
/// Дополнительный цвет (для опциональных элементов)
|
||||
/// </summary>
|
||||
public Color AdditionalColor { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия кузова
|
||||
/// </summary>
|
||||
public bool BodyKit { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия тента
|
||||
/// </summary>
|
||||
public bool Tent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация полей объекта-класса автомобиля
|
||||
/// </summary>
|
||||
/// <param name="speed"></param>
|
||||
/// <param name="weight"></param>
|
||||
/// <param name="bodyColor"></param>
|
||||
/// <param name="additionalColor"></param>
|
||||
/// <returns></returns>
|
||||
public EntityDumpTruck(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool tent) :
|
||||
base(speed, weight, bodyColor)
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
BodyKit = bodyKit;
|
||||
Tent = tent;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,35 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DumpTruck
|
||||
namespace DumpTruck.Entities
|
||||
{
|
||||
internal class EntityTruck
|
||||
public class EntityTruck
|
||||
{
|
||||
/// <summary>
|
||||
/// Скорость
|
||||
/// </summary>
|
||||
public int Speed { get; private set; }
|
||||
|
||||
public float Weight { get; private set; }
|
||||
/// <summary>
|
||||
/// Вес
|
||||
/// </summary>
|
||||
public double Weight { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color BodyColor { get; private set; }
|
||||
public Color AdditionalColor { get; private set; }
|
||||
|
||||
public bool ThreeWheels { get; private set; }
|
||||
/// <summary>
|
||||
/// Шаг перемещения автомобиля
|
||||
/// </summary>
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
|
||||
public bool Dump { get; private set; }
|
||||
|
||||
public float Step => Speed * 100 / Weight;
|
||||
|
||||
public void Init(int speed, float weight, Color bodyColor, Color additionalColor, bool threeWheels, bool dump)
|
||||
/// <summary>
|
||||
/// Конструктор с параметрами
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес автомобиля</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
public EntityTruck(int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalColor;
|
||||
ThreeWheels = threeWheels;
|
||||
Dump = dump;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
179
DumpTruck/DumpTruck/FormDumpTruck.Designer.cs
generated
Normal file
179
DumpTruck/DumpTruck/FormDumpTruck.Designer.cs
generated
Normal file
@ -0,0 +1,179 @@
|
||||
namespace DumpTruck
|
||||
{
|
||||
partial class FormDumpTruck
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
pictureBoxDumpTruck = new PictureBox();
|
||||
buttonCreateTruck = new Button();
|
||||
buttonLeft = new Button();
|
||||
buttonUp = new Button();
|
||||
buttonDown = new Button();
|
||||
buttonRight = new Button();
|
||||
buttonCreateDumpTruck = new Button();
|
||||
comboBoxStrategy = new ComboBox();
|
||||
buttonStep = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxDumpTruck).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxDumpTruck
|
||||
//
|
||||
pictureBoxDumpTruck.Dock = DockStyle.Fill;
|
||||
pictureBoxDumpTruck.Location = new Point(0, 0);
|
||||
pictureBoxDumpTruck.Name = "pictureBoxDumpTruck";
|
||||
pictureBoxDumpTruck.Size = new Size(884, 461);
|
||||
pictureBoxDumpTruck.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||
pictureBoxDumpTruck.TabIndex = 0;
|
||||
pictureBoxDumpTruck.TabStop = false;
|
||||
//
|
||||
// buttonCreateTruck
|
||||
//
|
||||
buttonCreateTruck.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreateTruck.Location = new Point(12, 406);
|
||||
buttonCreateTruck.Name = "buttonCreateTruck";
|
||||
buttonCreateTruck.Size = new Size(107, 43);
|
||||
buttonCreateTruck.TabIndex = 1;
|
||||
buttonCreateTruck.Text = "Создать грузовик";
|
||||
buttonCreateTruck.UseVisualStyleBackColor = true;
|
||||
buttonCreateTruck.Click += buttonCreateTruck_Click;
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonLeft.BackgroundImage = Properties.Resources.arrowLeft;
|
||||
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonLeft.Location = new Point(770, 426);
|
||||
buttonLeft.Name = "buttonLeft";
|
||||
buttonLeft.Size = new Size(30, 30);
|
||||
buttonLeft.TabIndex = 2;
|
||||
buttonLeft.UseVisualStyleBackColor = true;
|
||||
buttonLeft.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonUp.BackgroundImage = Properties.Resources.arrowUp;
|
||||
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonUp.Location = new Point(806, 390);
|
||||
buttonUp.Name = "buttonUp";
|
||||
buttonUp.Size = new Size(30, 30);
|
||||
buttonUp.TabIndex = 3;
|
||||
buttonUp.UseVisualStyleBackColor = true;
|
||||
buttonUp.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonDown.BackgroundImage = Properties.Resources.arrowDown;
|
||||
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonDown.Location = new Point(806, 426);
|
||||
buttonDown.Name = "buttonDown";
|
||||
buttonDown.Size = new Size(30, 30);
|
||||
buttonDown.TabIndex = 4;
|
||||
buttonDown.UseVisualStyleBackColor = true;
|
||||
buttonDown.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonRight.BackgroundImage = Properties.Resources.arrowRight;
|
||||
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonRight.Location = new Point(842, 426);
|
||||
buttonRight.Name = "buttonRight";
|
||||
buttonRight.Size = new Size(30, 30);
|
||||
buttonRight.TabIndex = 5;
|
||||
buttonRight.UseVisualStyleBackColor = true;
|
||||
buttonRight.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonCreateDumpTruck
|
||||
//
|
||||
buttonCreateDumpTruck.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreateDumpTruck.Location = new Point(125, 406);
|
||||
buttonCreateDumpTruck.Name = "buttonCreateDumpTruck";
|
||||
buttonCreateDumpTruck.Size = new Size(118, 43);
|
||||
buttonCreateDumpTruck.TabIndex = 6;
|
||||
buttonCreateDumpTruck.Text = "Создать грузовик с кузовом";
|
||||
buttonCreateDumpTruck.UseVisualStyleBackColor = true;
|
||||
buttonCreateDumpTruck.Click += buttonCreateDumpTruck_Click;
|
||||
//
|
||||
// comboBoxStrategy
|
||||
//
|
||||
comboBoxStrategy.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxStrategy.FormattingEnabled = true;
|
||||
comboBoxStrategy.Items.AddRange(new object[] { "Путь к центру", "Путь к правому нижнему углу" });
|
||||
comboBoxStrategy.Location = new Point(751, 12);
|
||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
comboBoxStrategy.Size = new Size(121, 23);
|
||||
comboBoxStrategy.TabIndex = 7;
|
||||
//
|
||||
// buttonStep
|
||||
//
|
||||
buttonStep.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
buttonStep.Location = new Point(797, 41);
|
||||
buttonStep.Name = "buttonStep";
|
||||
buttonStep.Size = new Size(75, 23);
|
||||
buttonStep.TabIndex = 8;
|
||||
buttonStep.Text = "Шаг";
|
||||
buttonStep.UseVisualStyleBackColor = true;
|
||||
buttonStep.Click += buttonStep_Click;
|
||||
//
|
||||
// FormDumpTruck
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(884, 461);
|
||||
Controls.Add(buttonStep);
|
||||
Controls.Add(comboBoxStrategy);
|
||||
Controls.Add(buttonCreateDumpTruck);
|
||||
Controls.Add(buttonRight);
|
||||
Controls.Add(buttonDown);
|
||||
Controls.Add(buttonUp);
|
||||
Controls.Add(buttonLeft);
|
||||
Controls.Add(buttonCreateTruck);
|
||||
Controls.Add(pictureBoxDumpTruck);
|
||||
Name = "FormDumpTruck";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Проект";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxDumpTruck).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxDumpTruck;
|
||||
private Button buttonCreateTruck;
|
||||
private Button buttonLeft;
|
||||
private Button buttonUp;
|
||||
private Button buttonDown;
|
||||
private Button buttonRight;
|
||||
private Button buttonCreateDumpTruck;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button buttonStep;
|
||||
}
|
||||
}
|
131
DumpTruck/DumpTruck/FormDumpTruck.cs
Normal file
131
DumpTruck/DumpTruck/FormDumpTruck.cs
Normal file
@ -0,0 +1,131 @@
|
||||
using DumpTruck.DrawningObjects;
|
||||
using DumpTruck.MovementStrategy;
|
||||
|
||||
namespace DumpTruck
|
||||
{
|
||||
public partial class FormDumpTruck : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Поле-объект для прорисовки объекта
|
||||
/// </summary>
|
||||
private DrawningTruck? _drawningTruck;
|
||||
|
||||
private AbstractStrategy? _abstractStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация формы
|
||||
/// </summary>
|
||||
public FormDumpTruck()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Метод прорисовки машины
|
||||
/// </summary>
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawningTruck == null)
|
||||
return;
|
||||
Bitmap bmp = new(pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningTruck.DrawTransport(gr);
|
||||
pictureBoxDumpTruck.Image = bmp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия кнопки "Создать truck"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonCreateTruck_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawningTruck = new DrawningTruck(random.Next(100, 300), random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height);
|
||||
_drawningTruck.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 (_drawningTruck == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
_drawningTruck.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
_drawningTruck.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
_drawningTruck.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
_drawningTruck.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void buttonCreateDumpTruck_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawningTruck = new DrawningDumpTruck(random.Next(100, 300), random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
|
||||
pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height);
|
||||
_drawningTruck.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void buttonStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningTruck == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (comboBoxStrategy.Enabled)
|
||||
{
|
||||
_abstractStrategy = comboBoxStrategy.SelectedIndex
|
||||
switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToBorder(),
|
||||
_ => null,
|
||||
};
|
||||
if (_abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.SetData(new
|
||||
DrawningObjectTruck(_drawningTruck), pictureBoxDumpTruck.Width,
|
||||
pictureBoxDumpTruck.Height);
|
||||
comboBoxStrategy.Enabled = false;
|
||||
}
|
||||
if (_abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.MakeStep();
|
||||
Draw();
|
||||
if (_abstractStrategy.GetStatus() == Status.Finish)
|
||||
{
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_abstractStrategy = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
DumpTruck/DumpTruck/FormDumpTruck.resx
Normal file
120
DumpTruck/DumpTruck/FormDumpTruck.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>
|
142
DumpTruck/DumpTruck/FormTruck.Designer.cs
generated
142
DumpTruck/DumpTruck/FormTruck.Designer.cs
generated
@ -1,142 +0,0 @@
|
||||
namespace DumpTruck
|
||||
{
|
||||
partial class FormTruck
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btnCreate = new System.Windows.Forms.Button();
|
||||
this.btnLeft = new System.Windows.Forms.Button();
|
||||
this.btnDown = new System.Windows.Forms.Button();
|
||||
this.btnRight = new System.Windows.Forms.Button();
|
||||
this.btnUp = new System.Windows.Forms.Button();
|
||||
this.pictureBoxTruck = new System.Windows.Forms.PictureBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTruck)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnCreate
|
||||
//
|
||||
this.btnCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnCreate.Location = new System.Drawing.Point(12, 426);
|
||||
this.btnCreate.Name = "btnCreate";
|
||||
this.btnCreate.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnCreate.TabIndex = 0;
|
||||
this.btnCreate.Text = "Создать";
|
||||
this.btnCreate.UseVisualStyleBackColor = true;
|
||||
this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click);
|
||||
//
|
||||
// btnLeft
|
||||
//
|
||||
this.btnLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnLeft.BackgroundImage = global::DumpTruck.Properties.Resources.left;
|
||||
this.btnLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.btnLeft.Location = new System.Drawing.Point(766, 419);
|
||||
this.btnLeft.Name = "btnLeft";
|
||||
this.btnLeft.Size = new System.Drawing.Size(30, 30);
|
||||
this.btnLeft.TabIndex = 1;
|
||||
this.btnLeft.Text = " ";
|
||||
this.btnLeft.UseVisualStyleBackColor = true;
|
||||
this.btnLeft.Click += new System.EventHandler(this.btnMove_Click);
|
||||
//
|
||||
// btnDown
|
||||
//
|
||||
this.btnDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnDown.BackgroundImage = global::DumpTruck.Properties.Resources.down;
|
||||
this.btnDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.btnDown.Location = new System.Drawing.Point(802, 419);
|
||||
this.btnDown.Name = "btnDown";
|
||||
this.btnDown.Size = new System.Drawing.Size(30, 30);
|
||||
this.btnDown.TabIndex = 2;
|
||||
this.btnDown.Text = " ";
|
||||
this.btnDown.UseVisualStyleBackColor = true;
|
||||
this.btnDown.Click += new System.EventHandler(this.btnMove_Click);
|
||||
//
|
||||
// btnRight
|
||||
//
|
||||
this.btnRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnRight.BackgroundImage = global::DumpTruck.Properties.Resources.right;
|
||||
this.btnRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.btnRight.Location = new System.Drawing.Point(838, 419);
|
||||
this.btnRight.Name = "btnRight";
|
||||
this.btnRight.Size = new System.Drawing.Size(30, 30);
|
||||
this.btnRight.TabIndex = 3;
|
||||
this.btnRight.Text = " ";
|
||||
this.btnRight.UseVisualStyleBackColor = true;
|
||||
this.btnRight.Click += new System.EventHandler(this.btnMove_Click);
|
||||
//
|
||||
// btnUp
|
||||
//
|
||||
this.btnUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnUp.BackgroundImage = global::DumpTruck.Properties.Resources.up;
|
||||
this.btnUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.btnUp.Location = new System.Drawing.Point(802, 383);
|
||||
this.btnUp.Name = "btnUp";
|
||||
this.btnUp.Size = new System.Drawing.Size(30, 30);
|
||||
this.btnUp.TabIndex = 4;
|
||||
this.btnUp.Text = " ";
|
||||
this.btnUp.UseVisualStyleBackColor = true;
|
||||
this.btnUp.Click += new System.EventHandler(this.btnMove_Click);
|
||||
//
|
||||
// pictureBoxTruck
|
||||
//
|
||||
this.pictureBoxTruck.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictureBoxTruck.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBoxTruck.Name = "pictureBoxTruck";
|
||||
this.pictureBoxTruck.Size = new System.Drawing.Size(884, 461);
|
||||
this.pictureBoxTruck.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
this.pictureBoxTruck.TabIndex = 5;
|
||||
this.pictureBoxTruck.TabStop = false;
|
||||
//
|
||||
// FormTruck
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(884, 461);
|
||||
this.Controls.Add(this.btnUp);
|
||||
this.Controls.Add(this.btnRight);
|
||||
this.Controls.Add(this.btnDown);
|
||||
this.Controls.Add(this.btnLeft);
|
||||
this.Controls.Add(this.btnCreate);
|
||||
this.Controls.Add(this.pictureBoxTruck);
|
||||
this.Name = "FormTruck";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "FormTruck";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTruck)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button btnCreate;
|
||||
private Button btnLeft;
|
||||
private Button btnDown;
|
||||
private Button btnRight;
|
||||
private Button btnUp;
|
||||
private PictureBox pictureBoxTruck;
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
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 DumpTruck
|
||||
{
|
||||
public partial class FormTruck : Form
|
||||
{
|
||||
|
||||
private DrawingTruck? _drawningTruck;
|
||||
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
|
||||
if (_drawningTruck == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Random rnd = new Random();
|
||||
Bitmap bmp = new(pictureBoxTruck.Width,
|
||||
pictureBoxTruck.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningTruck.DrawTransport(gr, Color.FromArgb(0,255,128),Color.FromArgb(255,0,0), false, true);
|
||||
pictureBoxTruck.Image = bmp;
|
||||
}
|
||||
|
||||
public FormTruck()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawningTruck = new DrawingTruck();
|
||||
_drawningTruck.Init(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256)), Color.FromArgb(random.Next(0,256)), pictureBoxTruck.Width, pictureBoxTruck.Height, Convert.ToBoolean(random.Next(2)), Convert.ToBoolean(random.Next(2)));
|
||||
_drawningTruck.SetPosition(random.Next(1, 100), random.Next(1, 100));
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void btnMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningTruck == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
switch (name)
|
||||
{
|
||||
case "btnUp":
|
||||
_drawningTruck.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "btnDown":
|
||||
_drawningTruck.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "btnLeft":
|
||||
_drawningTruck.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "btnRight":
|
||||
_drawningTruck.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
<root>
|
||||
<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
DumpTruck/DumpTruck/IMoveableObject.cs
Normal file
31
DumpTruck/DumpTruck/IMoveableObject.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DumpTruck.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(DirectionType direction);
|
||||
/// <summary>
|
||||
/// Изменение направления пермещения объекта
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
void MoveObject(DirectionType direction);
|
||||
}
|
||||
}
|
59
DumpTruck/DumpTruck/MoveToBorder.cs
Normal file
59
DumpTruck/DumpTruck/MoveToBorder.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DumpTruck.MovementStrategy;
|
||||
|
||||
namespace DumpTruck
|
||||
{
|
||||
internal 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 = objParams.RightBorder - FieldWidth;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX > 0)
|
||||
{
|
||||
MoveLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
}
|
||||
var diffY = objParams.DownBorder - FieldHeight;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY > 0)
|
||||
{
|
||||
MoveUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
54
DumpTruck/DumpTruck/MoveToCenter.cs
Normal file
54
DumpTruck/DumpTruck/MoveToCenter.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DumpTruck.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
55
DumpTruck/DumpTruck/ObjectParameters.cs
Normal file
55
DumpTruck/DumpTruck/ObjectParameters.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DumpTruck.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;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ namespace DumpTruck
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new FormTruck());
|
||||
Application.Run(new FormDumpTruck());
|
||||
}
|
||||
}
|
||||
}
|
16
DumpTruck/DumpTruck/Properties/Resources.Designer.cs
generated
16
DumpTruck/DumpTruck/Properties/Resources.Designer.cs
generated
@ -63,9 +63,9 @@ namespace DumpTruck.Properties {
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap down {
|
||||
internal static System.Drawing.Bitmap arrowDown {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("down", resourceCulture);
|
||||
object obj = ResourceManager.GetObject("arrowDown", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
@ -73,9 +73,9 @@ namespace DumpTruck.Properties {
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap left {
|
||||
internal static System.Drawing.Bitmap arrowLeft {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("left", resourceCulture);
|
||||
object obj = ResourceManager.GetObject("arrowLeft", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
@ -83,9 +83,9 @@ namespace DumpTruck.Properties {
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap right {
|
||||
internal static System.Drawing.Bitmap arrowRight {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("right", resourceCulture);
|
||||
object obj = ResourceManager.GetObject("arrowRight", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
@ -93,9 +93,9 @@ namespace DumpTruck.Properties {
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap up {
|
||||
internal static System.Drawing.Bitmap arrowUp {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("up", resourceCulture);
|
||||
object obj = ResourceManager.GetObject("arrowUp", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
@ -118,16 +118,16 @@
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="down" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\down.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="arrowDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\arrowDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="left" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\left.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="arrowLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\arrowLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="right" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\right.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="arrowRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\arrowRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="up" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\up.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="arrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\arrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
DumpTruck/DumpTruck/Resources/arrowDown.png
Normal file
BIN
DumpTruck/DumpTruck/Resources/arrowDown.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 418 B |
BIN
DumpTruck/DumpTruck/Resources/arrowLeft.png
Normal file
BIN
DumpTruck/DumpTruck/Resources/arrowLeft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 362 B |
BIN
DumpTruck/DumpTruck/Resources/arrowRight.png
Normal file
BIN
DumpTruck/DumpTruck/Resources/arrowRight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 428 B |
BIN
DumpTruck/DumpTruck/Resources/arrowUp.png
Normal file
BIN
DumpTruck/DumpTruck/Resources/arrowUp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 412 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
17
DumpTruck/DumpTruck/Status.cs
Normal file
17
DumpTruck/DumpTruck/Status.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DumpTruck.MovementStrategy
|
||||
{
|
||||
public enum Status
|
||||
{
|
||||
NotInit,
|
||||
|
||||
InProgress,
|
||||
|
||||
Finish
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user