Проект готов
This commit is contained in:
parent
3833d02e56
commit
e88714da83
128
WarmlyLocomotive/AbstractStrategy.cs
Normal file
128
WarmlyLocomotive/AbstractStrategy.cs
Normal file
@ -0,0 +1,128 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WarmlyLocomotive.MovementStrategy
|
||||
{
|
||||
public abstract class AbstractStrategy
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
37
WarmlyLocomotive/DrawningObjectCar.cs
Normal file
37
WarmlyLocomotive/DrawningObjectCar.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WarmlyLocomotive.DrawningObjects;
|
||||
using WarmlyLocomotive.MovementStrategy;
|
||||
|
||||
namespace WarmlyLocomotive.MovementStrategy
|
||||
{
|
||||
internal class DrawningObjectCar : IMoveableObject
|
||||
{
|
||||
private readonly DrawningWarmlyLocomotive? _drawningCar = null;
|
||||
public DrawningObjectCar(DrawningWarmlyLocomotive drawningCar)
|
||||
{
|
||||
_drawningCar = drawningCar;
|
||||
}
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_drawningCar == null || _drawningCar.EntityWarmlyLocomotive ==
|
||||
null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_drawningCar.GetPosX,
|
||||
_drawningCar.GetPosY, _drawningCar.GetWidth, _drawningCar.GetHeight);
|
||||
}
|
||||
}
|
||||
public int GetStep => (int)(_drawningCar?.EntityWarmlyLocomotive?.Step ?? 0);
|
||||
public bool CheckCanMove(Direction direction) =>
|
||||
_drawningCar?.CanMove(direction) ?? false;
|
||||
public void MoveObject(Direction direction) =>
|
||||
_drawningCar?.MoveTransport(direction);
|
||||
}
|
||||
}
|
50
WarmlyLocomotive/DrawningPro.cs
Normal file
50
WarmlyLocomotive/DrawningPro.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using WarmlyLocomotive.DrawningObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WarmlyLocomotive.Entities;
|
||||
using WarmlyLocomotive;
|
||||
|
||||
namespace WarmlyLocomotive.DrawningObjects
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||
/// </summary>
|
||||
public class DrawningPro : DrawningWarmlyLocomotive
|
||||
{
|
||||
public DrawningPro(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool trumpet, bool luggage, int width, int height) :base(speed, weight, bodyColor, width, height, 200, 75)
|
||||
{
|
||||
if (EntityWarmlyLocomotive != null)
|
||||
{
|
||||
EntityWarmlyLocomotive = new Pro(speed, weight, bodyColor, additionalColor, trumpet, luggage);
|
||||
}
|
||||
}
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityWarmlyLocomotive is not Pro warmlylocomotive)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black, 2);
|
||||
Brush bodyBrush = new SolidBrush(warmlylocomotive.BodyColor);
|
||||
Brush addBrush = new SolidBrush(warmlylocomotive.AdditionalColor);
|
||||
Brush wheelBrush = new SolidBrush(Color.Black);
|
||||
base.DrawTransport(g);
|
||||
//труба
|
||||
if (warmlylocomotive.Trumpet)
|
||||
{
|
||||
g.FillRectangle(addBrush, _startPosX + 165, _startPosY - 25, 25, 25);
|
||||
}
|
||||
//багаж
|
||||
if (warmlylocomotive.Luggage)
|
||||
{
|
||||
g.FillRectangle(addBrush, _startPosX, _startPosY, 50, 50);
|
||||
g.FillEllipse(wheelBrush, _startPosX + 10, _startPosY + 50, 20, 20);
|
||||
g.FillEllipse(wheelBrush, _startPosX + 35, _startPosY + 50, 20, 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
196
WarmlyLocomotive/DrawningWarmlyLocomotive.cs
Normal file
196
WarmlyLocomotive/DrawningWarmlyLocomotive.cs
Normal file
@ -0,0 +1,196 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WarmlyLocomotive.Entities;
|
||||
|
||||
namespace WarmlyLocomotive.DrawningObjects
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||
/// </summary>
|
||||
public class DrawningWarmlyLocomotive
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-сущность
|
||||
/// </summary>
|
||||
public EntityWarmlyLocomotive? EntityWarmlyLocomotive { 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 _WarmlyLocomotiveWidth = 200;
|
||||
/// <summary>
|
||||
/// Высота прорисовки локомотива
|
||||
/// </summary>
|
||||
protected readonly int _WarmlyLocomotiveHeight = 75;
|
||||
private readonly int _trumpetHeight = 25;
|
||||
public int GetPosX => _startPosX;
|
||||
/// <summary>
|
||||
/// Координата Y объекта
|
||||
/// </summary>
|
||||
public int GetPosY => _startPosY;
|
||||
/// <summary>
|
||||
/// Ширина объекта
|
||||
/// </summary>
|
||||
public int GetWidth => _WarmlyLocomotiveWidth;
|
||||
/// <summary>
|
||||
/// Высота объекта
|
||||
/// </summary>
|
||||
public int GetHeight => _WarmlyLocomotiveHeight;
|
||||
public DrawningWarmlyLocomotive(int speed, double weight, Color bodyColor, int width, int height)
|
||||
{
|
||||
if (width < _WarmlyLocomotiveWidth || height < _WarmlyLocomotiveHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
|
||||
EntityWarmlyLocomotive = new EntityWarmlyLocomotive(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
protected DrawningWarmlyLocomotive(int speed, double weight, Color bodyColor, int
|
||||
width, int height, int carWidth, int carHeight)
|
||||
{
|
||||
if (width <= _WarmlyLocomotiveWidth || height <= _WarmlyLocomotiveHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
_WarmlyLocomotiveWidth = carWidth;
|
||||
_WarmlyLocomotiveHeight = carHeight;
|
||||
EntityWarmlyLocomotive = new EntityWarmlyLocomotive(speed, weight, bodyColor);
|
||||
}
|
||||
/// <summary>
|
||||
/// Установка позиции
|
||||
/// </summary>
|
||||
/// <param name="x">Координата X</param>
|
||||
/// <param name="y">Координата Y</param>
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (x < 0 || x >= _pictureWidth || y < 0 || y >= _pictureHeight)
|
||||
{
|
||||
_startPosX = 0;
|
||||
_startPosY = 0;
|
||||
}
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
|
||||
}
|
||||
|
||||
public bool CanMove(Direction direction)
|
||||
{
|
||||
if (EntityWarmlyLocomotive == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return direction switch
|
||||
{
|
||||
//влево
|
||||
Direction.Left => _startPosX - EntityWarmlyLocomotive.Step > 0,
|
||||
//вверх
|
||||
Direction.Up => _startPosY - EntityWarmlyLocomotive.Step > 0,
|
||||
// вправо
|
||||
Direction.Right => _startPosX + EntityWarmlyLocomotive.Step + _WarmlyLocomotiveWidth < _pictureWidth,
|
||||
//вниз
|
||||
Direction.Down => _startPosY + EntityWarmlyLocomotive.Step + _WarmlyLocomotiveHeight < _pictureHeight,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
/// <param name="direction">Направление</param>
|
||||
public void MoveTransport(Direction direction)
|
||||
{
|
||||
if (!CanMove(direction) || EntityWarmlyLocomotive == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case Direction.Left:
|
||||
if (_startPosX - EntityWarmlyLocomotive.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)EntityWarmlyLocomotive.Step;
|
||||
}
|
||||
break;
|
||||
//вверх
|
||||
case Direction.Up:
|
||||
if (_startPosY - _trumpetHeight - EntityWarmlyLocomotive.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)EntityWarmlyLocomotive.Step;
|
||||
}
|
||||
break;
|
||||
// вправо
|
||||
case Direction.Right:
|
||||
|
||||
if (_startPosX + _WarmlyLocomotiveWidth + EntityWarmlyLocomotive.Step < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)EntityWarmlyLocomotive.Step;
|
||||
}
|
||||
break;
|
||||
//вниз
|
||||
case Direction.Down:
|
||||
if (_startPosY + _WarmlyLocomotiveHeight + EntityWarmlyLocomotive.Step < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)EntityWarmlyLocomotive.Step;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Прорисовка объекта
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityWarmlyLocomotive == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black, 2);
|
||||
Brush bodyBrush = new SolidBrush(EntityWarmlyLocomotive.BodyColor);
|
||||
Brush wheelBrush = new SolidBrush(Color.Black);
|
||||
|
||||
//корпус
|
||||
g.FillRectangle(bodyBrush, _startPosX + 50, _startPosY, 150, 50);
|
||||
Point[] Points = { new Point(_startPosX + 50, _startPosY + 25), new Point(_startPosX + 125, _startPosY + 25) };
|
||||
g.DrawPolygon(pen, Points);
|
||||
Point[] Points2 = { new Point(_startPosX + 150, _startPosY + 25), new Point(_startPosX + 200, _startPosY + 25) };
|
||||
g.DrawPolygon(pen, Points2);
|
||||
//окна
|
||||
g.DrawRectangle(pen, _startPosX + 125, _startPosY + 10, 25, 30);
|
||||
g.DrawRectangle(pen, _startPosX + 60, _startPosY + 7, 10, 13);
|
||||
g.DrawRectangle(pen, _startPosX + 160, _startPosY + 7, 10, 13);
|
||||
g.DrawRectangle(pen, _startPosX + 175, _startPosY + 7, 10, 13);
|
||||
//колеса
|
||||
g.FillEllipse(wheelBrush, _startPosX + 60, _startPosY + 50, 20, 20);
|
||||
g.FillEllipse(wheelBrush, _startPosX + 85, _startPosY + 50, 20, 20);
|
||||
g.FillEllipse(wheelBrush, _startPosX + 145, _startPosY + 50, 20, 20);
|
||||
g.FillEllipse(wheelBrush, _startPosX + 170, _startPosY + 50, 20, 20);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
43
WarmlyLocomotive/EntityWarmlyLocomotive.cs
Normal file
43
WarmlyLocomotive/EntityWarmlyLocomotive.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WarmlyLocomotive.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-сущность "Автомобиль"
|
||||
/// </summary>
|
||||
public class EntityWarmlyLocomotive
|
||||
{
|
||||
/// <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 EntityWarmlyLocomotive(int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
}
|
||||
}
|
35
WarmlyLocomotive/IMoveableObject.cs
Normal file
35
WarmlyLocomotive/IMoveableObject.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WarmlyLocomotive.MovementStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Интерфейс для работы с перемещаемым объектом
|
||||
/// </summary>
|
||||
public interface IMoveableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Получение координаты X объекта
|
||||
/// </summary>
|
||||
ObjectParameters? GetObjectPosition { get; }
|
||||
/// <summary>
|
||||
/// Шаг объекта
|
||||
/// </summary>
|
||||
int GetStep { get; }
|
||||
/// <summary>
|
||||
/// Проверка, можно ли переместиться по нужному направлению
|
||||
/// </summary>
|
||||
/// <param name="direction"></param>
|
||||
/// <returns></returns>
|
||||
bool CheckCanMove(Direction direction);
|
||||
/// <summary>
|
||||
/// Изменение направления пермещения объекта
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
void MoveObject(Direction direction);
|
||||
}
|
||||
}
|
||||
|
50
WarmlyLocomotive/MoveToBorder.cs
Normal file
50
WarmlyLocomotive/MoveToBorder.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WarmlyLocomotive.MovementStrategy;
|
||||
|
||||
namespace WarmlyLocomotive.MovementStrategy
|
||||
{
|
||||
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 = FieldWidth - objParams.ObjectMiddleHorizontal;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
|
||||
MoveRight();
|
||||
|
||||
}
|
||||
var diffY = FieldHeight - objParams.ObjectMiddleVertical;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
|
||||
MoveDown();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
58
WarmlyLocomotive/MoveToCenter.cs
Normal file
58
WarmlyLocomotive/MoveToCenter.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WarmlyLocomotive.MovementStrategy;
|
||||
namespace WarmlyLocomotive.MovementStrategy
|
||||
|
||||
{
|
||||
internal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
57
WarmlyLocomotive/ObjectParameters.cs
Normal file
57
WarmlyLocomotive/ObjectParameters.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WarmlyLocomotive.MovementStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Параметры-координаты объекта
|
||||
/// </summary>
|
||||
public class ObjectParameters
|
||||
{
|
||||
private readonly int _x;
|
||||
private readonly int _y;
|
||||
private readonly int _width;
|
||||
private readonly int _height;
|
||||
/// <summary>
|
||||
/// Левая граница
|
||||
/// </summary>
|
||||
public int LeftBorder => _x;
|
||||
/// <summary>
|
||||
/// Верхняя граница
|
||||
/// </summary>
|
||||
public int TopBorder => _y;
|
||||
/// <summary>
|
||||
/// Правая граница
|
||||
/// </summary>
|
||||
public int RightBorder => _x + _width;
|
||||
/// <summary>
|
||||
/// Нижняя граница
|
||||
/// </summary>
|
||||
public int DownBorder => _y + _height;
|
||||
/// <summary>
|
||||
/// Середина объекта
|
||||
/// </summary>
|
||||
public int ObjectMiddleHorizontal => _x + _width / 2;
|
||||
/// <summary>
|
||||
/// Середина объекта
|
||||
/// </summary>
|
||||
public int ObjectMiddleVertical => _y + _height / 2;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="x">Координата X</param>
|
||||
/// <param name="y">Координата Y</param>
|
||||
/// <param name="width">Ширина</param>
|
||||
/// <param name="height">Высота</param>
|
||||
public ObjectParameters(int x, int y, int width, int height)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
_width = width;
|
||||
_height = height;
|
||||
}
|
||||
}
|
||||
}
|
34
WarmlyLocomotive/Pro.cs
Normal file
34
WarmlyLocomotive/Pro.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace WarmlyLocomotive.Entities
|
||||
{
|
||||
public class Pro : EntityWarmlyLocomotive
|
||||
{
|
||||
/// <summary>
|
||||
/// Дополнительный цвет (для опциональных элементов)
|
||||
/// </summary>
|
||||
public Color AdditionalColor { get; private set; }
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия трубы
|
||||
/// </summary>
|
||||
public bool Trumpet { get; private set; }
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия прицепа
|
||||
/// </summary>
|
||||
public bool Luggage { get; private set; }
|
||||
public Pro(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool trumpet,bool luggage) : base(speed, weight, bodyColor)
|
||||
{
|
||||
|
||||
AdditionalColor = additionalColor;
|
||||
Trumpet = trumpet;
|
||||
Luggage = luggage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
19
WarmlyLocomotive/Status.cs
Normal file
19
WarmlyLocomotive/Status.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WarmlyLocomotive.MovementStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Статус выполнения операции перемещения
|
||||
/// </summary>
|
||||
public enum Status
|
||||
{
|
||||
NotInit,
|
||||
InProgress,
|
||||
Finish
|
||||
}
|
||||
}
|
||||
|
@ -1,240 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WarmlyLocomotive
|
||||
{
|
||||
public class EntityWarmlyLocomotive
|
||||
{
|
||||
/// <summary>
|
||||
/// Скорость
|
||||
/// </summary>
|
||||
public int Speed { get; set; }
|
||||
/// <summary>
|
||||
/// Вес
|
||||
/// </summary>
|
||||
public double Weight { get; private set; }
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color BodyColor { get; private set; }
|
||||
/// <summary>
|
||||
/// Дополнительный цвет (для опциональных элементов)
|
||||
/// </summary>
|
||||
public Color AdditionalColor { get; private set; }
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия трубы
|
||||
/// </summary>
|
||||
public bool Trumpet { get; private set; }
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия прицепа
|
||||
/// </summary>
|
||||
public bool Luggage { 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>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="trumpet">Признак наличия трубы</param>
|
||||
/// <param name="luggage">Признак наличия отсека под топливо</param>
|
||||
|
||||
public void Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool trumpet, bool luggage, bool v, int width, int height)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalColor;
|
||||
Trumpet = trumpet;
|
||||
Luggage = luggage;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||
/// </summary>
|
||||
public class DrawningWarmlyLocomotive
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-сущность
|
||||
/// </summary>
|
||||
public EntityWarmlyLocomotive? EntityWarmlyLocomotive { 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 _carWidth = 200;
|
||||
/// <summary>
|
||||
/// Высота прорисовки тепловоза
|
||||
/// </summary>
|
||||
private readonly int _carHeight = 75;
|
||||
//высота трубы
|
||||
private readonly int _trumpetHeight = 25;
|
||||
/// <summary>
|
||||
/// Инициализация свойств
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Цвет кузова</param>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="trumpet">Признак наличия трубы</param>
|
||||
/// <param name="luggage">Признак наличия отсека под топливо</param>
|
||||
/// <param name="width">Ширина картинки</param>
|
||||
/// <param name="height">Высота картинки</param>
|
||||
/// <returns>true - объект создан, false - проверка не пройдена,нельзя создать объект в этих размерах</returns>
|
||||
public bool Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool trumpet, bool luggage, bool v, int width, int height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if (_carWidth < _pictureWidth || _carHeight < _pictureHeight)
|
||||
{
|
||||
EntityWarmlyLocomotive = new EntityWarmlyLocomotive();
|
||||
EntityWarmlyLocomotive.Init(speed, weight, bodyColor, additionalColor, trumpet, luggage, v, width, height);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Установка позиции
|
||||
/// </summary>
|
||||
/// <param name="x">Координата X</param>
|
||||
/// <param name="y">Координата Y</param>
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
|
||||
if (EntityWarmlyLocomotive == null) return;
|
||||
while (x + _carWidth > _pictureWidth)
|
||||
{
|
||||
x -= (int)EntityWarmlyLocomotive.Step;
|
||||
}
|
||||
while (x < 0)
|
||||
{
|
||||
x += (int)EntityWarmlyLocomotive.Step;
|
||||
}
|
||||
while (y + _carHeight > _pictureHeight)
|
||||
{
|
||||
y -= (int)EntityWarmlyLocomotive.Step;
|
||||
}
|
||||
while (y < 0)
|
||||
{
|
||||
y += (int)EntityWarmlyLocomotive.Step;
|
||||
}
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
}
|
||||
/// <summary>
|
||||
/// Изменение направления перемещения
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
public void MoveTransport(Direction direction)
|
||||
{
|
||||
if (EntityWarmlyLocomotive == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case Direction.Left:
|
||||
if (_startPosX - EntityWarmlyLocomotive.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)EntityWarmlyLocomotive.Step;
|
||||
}
|
||||
break;
|
||||
//вверх
|
||||
case Direction.Up:
|
||||
if (_startPosY - _trumpetHeight - EntityWarmlyLocomotive.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)EntityWarmlyLocomotive.Step;
|
||||
}
|
||||
break;
|
||||
// вправо
|
||||
case Direction.Right:
|
||||
|
||||
if (_startPosX + _carWidth + EntityWarmlyLocomotive.Step < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)EntityWarmlyLocomotive.Step;
|
||||
}
|
||||
break;
|
||||
//вниз
|
||||
case Direction.Down:
|
||||
if (_startPosY + _carHeight + EntityWarmlyLocomotive.Step < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)EntityWarmlyLocomotive.Step;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Прорисовка объекта
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityWarmlyLocomotive == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black, 2);
|
||||
Brush bodyBrush = new SolidBrush(EntityWarmlyLocomotive.BodyColor);
|
||||
Brush addBrush = new SolidBrush(EntityWarmlyLocomotive.AdditionalColor);
|
||||
Brush wheelBrush = new SolidBrush(Color.Black);
|
||||
|
||||
//корпус
|
||||
g.FillRectangle(bodyBrush, _startPosX + 50, _startPosY, 150, 50);
|
||||
Point[] Points = { new Point(_startPosX + 50, _startPosY + 25), new Point(_startPosX + 125, _startPosY + 25) };
|
||||
g.DrawPolygon(pen, Points);
|
||||
Point[] Points2 = { new Point(_startPosX + 150, _startPosY + 25), new Point(_startPosX + 200, _startPosY + 25) };
|
||||
g.DrawPolygon(pen, Points2);
|
||||
//окна
|
||||
g.DrawRectangle(pen, _startPosX + 125, _startPosY + 10, 25, 30);
|
||||
g.DrawRectangle(pen, _startPosX + 60, _startPosY + 7, 10, 13);
|
||||
g.DrawRectangle(pen, _startPosX + 160, _startPosY + 7, 10, 13);
|
||||
g.DrawRectangle(pen, _startPosX + 175, _startPosY + 7, 10, 13);
|
||||
//колеса
|
||||
g.FillEllipse(wheelBrush, _startPosX + 60, _startPosY + 50, 20, 20);
|
||||
g.FillEllipse(wheelBrush, _startPosX + 85, _startPosY + 50, 20, 20);
|
||||
g.FillEllipse(wheelBrush, _startPosX + 145, _startPosY + 50, 20, 20);
|
||||
g.FillEllipse(wheelBrush, _startPosX + 170, _startPosY + 50, 20, 20);
|
||||
//труба
|
||||
if (EntityWarmlyLocomotive.Trumpet)
|
||||
{
|
||||
g.FillRectangle(addBrush, _startPosX + 165, _startPosY - 25, 25, 25);
|
||||
}
|
||||
//багаж
|
||||
if (EntityWarmlyLocomotive.Luggage)
|
||||
{
|
||||
g.FillRectangle(addBrush, _startPosX, _startPosY, 50, 50);
|
||||
g.FillEllipse(wheelBrush, _startPosX + 10, _startPosY + 50, 20, 20);
|
||||
g.FillEllipse(wheelBrush, _startPosX + 35, _startPosY + 50, 20, 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Windows.Forms;
|
||||
using WarmlyLocomotive;
|
||||
using static WarmlyLocomotive.EntityWarmlyLocomotive;
|
||||
using WarmlyLocomotive.DrawningObjects;
|
||||
|
||||
using WarmlyLocomotive.MovementStrategy;
|
||||
|
||||
namespace WarmlyLocomotive
|
||||
{
|
||||
@ -13,10 +14,12 @@ namespace WarmlyLocomotive
|
||||
/// Ïîëå-îáúåêò äëÿ ïðîðèñîâêè îáúåêòà
|
||||
/// </summary>
|
||||
private DrawningWarmlyLocomotive? _drawningWarmlyLocomotive;
|
||||
private AbstractStrategy? _abstractStrategy;
|
||||
public WarmlyLocomotiveForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ìåòîä ïðîðèñîâêè ìàøèíû
|
||||
/// </summary>
|
||||
@ -32,23 +35,24 @@ namespace WarmlyLocomotive
|
||||
_drawningWarmlyLocomotive.DrawTransport(gr);
|
||||
pictureBox1.Image = bmp;
|
||||
}
|
||||
/// <summary>
|
||||
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü òåïëîâîç"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawningWarmlyLocomotive = new DrawningWarmlyLocomotive();
|
||||
_drawningWarmlyLocomotive.Init(random.Next(100, 300),
|
||||
_drawningWarmlyLocomotive = new DrawningWarmlyLocomotive(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)), Convert.ToBoolean(random.Next(0, 2)),
|
||||
pictureBox1.Width, pictureBox1.Height);
|
||||
_drawningWarmlyLocomotive.SetPosition(random.Next(10, 100),
|
||||
random.Next(10, 100));
|
||||
_drawningWarmlyLocomotive.SetPosition(random.Next(10, 100), random.Next(10,
|
||||
100));
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void buttonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@ -74,6 +78,77 @@ namespace WarmlyLocomotive
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
|
||||
private void pictureBox1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Øàã"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningWarmlyLocomotive == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (comboBox1.Enabled)
|
||||
{
|
||||
_abstractStrategy = comboBox1.SelectedIndex
|
||||
switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToBorder(),
|
||||
_ => null,
|
||||
};
|
||||
if (_abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.SetData(new
|
||||
DrawningObjectCar(_drawningWarmlyLocomotive), pictureBox1.Width,
|
||||
pictureBox1.Height);
|
||||
comboBox1.Enabled = false;
|
||||
}
|
||||
if (_abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.MakeStep();
|
||||
Draw();
|
||||
if (_abstractStrategy.GetStatus() == Status.Finish)
|
||||
{
|
||||
comboBox1.Enabled = true;
|
||||
_abstractStrategy = null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü ïðîäâèíóòûé òåïëîâîç"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonCreate_Pro_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawningWarmlyLocomotive = new DrawningPro(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)),
|
||||
pictureBox1.Width, pictureBox1.Height);
|
||||
_drawningWarmlyLocomotive.SetPosition(random.Next(10, 100), random.Next(10,
|
||||
100));
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@
|
||||
iVBORw0KGgoAAAANSUhEUgAAAT4AAACeCAMAAACcjZZYAAAABGdBTUEAALGPC/xhBQAAAJZQTFRF////
|
||||
Zs3/adH/AGKVAGWYOpnLH22dNpLEKYa4K3ilaM//AFiRAF2RAF+VatP/AGGUAFyU8/j6AF6VAFWQXcP1
|
||||
Vbnr2eXtq8TWQqLUEnCjcZ285O3y6/L2Wr/xT7LkMIy+R4Srbdf/Wo+zvtHfz97olLTLo77SI3+yUoqw
|
||||
uM3cZJa3x9jjgKfCHHirOpfJeKG+nLrPN3ynjFhM0AAAAAlwSFlzAAAOwQAADsEBuJFr7QAABM1JREFU
|
||||
uM3cZJa3x9jjgKfCHHirOpfJeKG+nLrPN3ynjFhM0AAAAAlwSFlzAAAOvAAADrwBlbxySQAABM1JREFU
|
||||
eF7tndtS2zAURZ3Y3ELACRSSlLRAAwkp1/7/z/XoYqfEuh2Jh4611wt5YJhhzY7ssc+WCgAAAOB/Z6l/
|
||||
ghjWC/0B8FnenZ7oj4DNbFJX0BcJRa+qoC+S2aQke9AXxfJJRA/64pidnVVVvdlAXwRTEb1yPL8/LqGP
|
||||
zfZCRO/123AIfWymv8SqV8+HowH0sdnWFL0xRW8wgD42v0X0xiJ60MdmJS64OnrQx2Qqo1cfqOhBH49V
|
||||
@ -152,7 +152,7 @@
|
||||
iVBORw0KGgoAAAANSUhEUgAAAJ4AAAE+CAMAAABLMFkTAAAABGdBTUEAALGPC/xhBQAAAJZQTFRF////
|
||||
Zs3/adH/AGKVAGWYOpnLH22dNpLEKYa4K3ilaM//AFiRAF2RAF+VatP/AGGUAFyU8/j6AF6VAFWQXcP1
|
||||
Vbnr2eXtq8TWQqLUEnCjcZ285O3y6/L2Wr/xT7LkMIy+R4Srbdf/Wo+zvtHfz97olLTLo77SI3+yUoqw
|
||||
uM3cZJa3x9jjgKfCHHirOpfJeKG+nLrPN3ynjFhM0AAAAAlwSFlzAAAOwQAADsEBuJFr7QAABYVJREFU
|
||||
uM3cZJa3x9jjgKfCHHirOpfJeKG+nLrPN3ynjFhM0AAAAAlwSFlzAAAOvAAADrwBlbxySQAABYVJREFU
|
||||
eF7tnQtz0lwURUty+yC8sbbUvlDb4qNY/f9/7jvncvmkbQhJ9rlJxtlrdKZaiGtYXoqyZ3pECGmA58fw
|
||||
QSe5GAyuw4ddpJ+m/fBhB3mcOjftbN6LD04YXIRfdo1+6lL50dG8z3OX3t+nbv4cfqNTXAykbK/X1bwn
|
||||
zg3vkuRu6NxJ+K0O4dOOe71xJ/P6U9vLevJDPvjQtbybtD2hi3mfR26iaZXx/aRjeR/01EpZj887eAif
|
||||
@ -184,7 +184,7 @@
|
||||
iVBORw0KGgoAAAANSUhEUgAAAJ4AAAE+CAMAAABLMFkTAAAABGdBTUEAALGPC/xhBQAAAJZQTFRF////
|
||||
Zs3/adH/AGKVAGWYOpnLH22dNpLEKYa4K3ilaM//AFiRAF2RAF+VatP/AGGUAFyU8/j6AF6VAFWQXcP1
|
||||
Vbnr2eXtq8TWQqLUEnCjcZ285O3y6/L2Wr/xT7LkMIy+R4Srbdf/Wo+zvtHfz97olLTLo77SI3+yUoqw
|
||||
uM3cZJa3x9jjgKfCHHirOpfJeKG+nLrPN3ynjFhM0AAAAAlwSFlzAAAOwQAADsEBuJFr7QAABXNJREFU
|
||||
uM3cZJa3x9jjgKfCHHirOpfJeKG+nLrPN3ynjFhM0AAAAAlwSFlzAAAOvAAADrwBlbxySQAABXNJREFU
|
||||
eF7tndty2kgURY0kXxAgAXZsHOOYJLbJxcTJ//9czmkaJ3YkdNmnJSq1V81THlqrWNVMZrSrOCKE/Mec
|
||||
GOOPtSKJE0PixB9rhTvUCD3LH2uFnLg5NWITQi8+ziITsmP5/PyxVqheNDAhoh4A9RCoh0A9BOohUA+B
|
||||
egjUQ6AeAvUQqIdAPQTqIVAPgXoI1EOgHgL1EKiHQD0E6iFQD4F6CNRDoB4C9RCoh0A9BOohUA+BegjU
|
||||
|
55
WarmlyLocomotive/WarmlylocomotiveForm.Designer.cs
generated
55
WarmlyLocomotive/WarmlylocomotiveForm.Designer.cs
generated
@ -35,6 +35,9 @@
|
||||
buttonUp = new Button();
|
||||
buttonDown = new Button();
|
||||
buttonRight = new Button();
|
||||
comboBox1 = new ComboBox();
|
||||
buttonStep = new Button();
|
||||
buttonCreate_Pro = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
@ -47,15 +50,16 @@
|
||||
pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||
pictureBox1.TabIndex = 0;
|
||||
pictureBox1.TabStop = false;
|
||||
pictureBox1.Click += pictureBox1_Click;
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreate.Location = new Point(30, 379);
|
||||
buttonCreate.Location = new Point(210, 404);
|
||||
buttonCreate.Name = "buttonCreate";
|
||||
buttonCreate.Size = new Size(75, 23);
|
||||
buttonCreate.Size = new Size(119, 23);
|
||||
buttonCreate.TabIndex = 1;
|
||||
buttonCreate.Text = "Создать";
|
||||
buttonCreate.Text = "Создать тепловоз";
|
||||
buttonCreate.UseVisualStyleBackColor = true;
|
||||
buttonCreate.Click += buttonCreate_Click;
|
||||
//
|
||||
@ -64,7 +68,7 @@
|
||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonLeft.BackgroundImage = (Image)resources.GetObject("buttonLeft.BackgroundImage");
|
||||
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonLeft.Location = new Point(664, 395);
|
||||
buttonLeft.Location = new Point(751, 400);
|
||||
buttonLeft.Name = "buttonLeft";
|
||||
buttonLeft.Size = new Size(30, 30);
|
||||
buttonLeft.TabIndex = 2;
|
||||
@ -76,7 +80,7 @@
|
||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonUp.BackgroundImage = (Image)resources.GetObject("buttonUp.BackgroundImage");
|
||||
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonUp.Location = new Point(690, 372);
|
||||
buttonUp.Location = new Point(777, 372);
|
||||
buttonUp.Name = "buttonUp";
|
||||
buttonUp.Size = new Size(30, 30);
|
||||
buttonUp.TabIndex = 3;
|
||||
@ -88,7 +92,7 @@
|
||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonDown.BackgroundImage = (Image)resources.GetObject("buttonDown.BackgroundImage");
|
||||
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonDown.Location = new Point(690, 395);
|
||||
buttonDown.Location = new Point(777, 400);
|
||||
buttonDown.Name = "buttonDown";
|
||||
buttonDown.Size = new Size(30, 30);
|
||||
buttonDown.TabIndex = 4;
|
||||
@ -100,16 +104,50 @@
|
||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonRight.BackgroundImage = (Image)resources.GetObject("buttonRight.BackgroundImage");
|
||||
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonRight.Location = new Point(717, 395);
|
||||
buttonRight.Location = new Point(808, 400);
|
||||
buttonRight.Name = "buttonRight";
|
||||
buttonRight.Size = new Size(30, 30);
|
||||
buttonRight.TabIndex = 5;
|
||||
buttonRight.UseVisualStyleBackColor = true;
|
||||
buttonRight.Click += buttonMove_Click;
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBox1.FormattingEnabled = true;
|
||||
comboBox1.Items.AddRange(new object[] { "Центр", "Угол" });
|
||||
comboBox1.Location = new Point(717, 21);
|
||||
comboBox1.Name = "comboBox1";
|
||||
comboBox1.Size = new Size(121, 23);
|
||||
comboBox1.TabIndex = 7;
|
||||
comboBox1.SelectedIndexChanged += comboBox1_SelectedIndexChanged;
|
||||
//
|
||||
// buttonStep
|
||||
//
|
||||
buttonStep.Location = new Point(732, 60);
|
||||
buttonStep.Name = "buttonStep";
|
||||
buttonStep.Size = new Size(75, 23);
|
||||
buttonStep.TabIndex = 9;
|
||||
buttonStep.Text = "Шаг";
|
||||
buttonStep.UseVisualStyleBackColor = true;
|
||||
buttonStep.Click += buttonStep_Click;
|
||||
//
|
||||
// buttonCreate_Pro
|
||||
//
|
||||
buttonCreate_Pro.Location = new Point(54, 395);
|
||||
buttonCreate_Pro.Name = "buttonCreate_Pro";
|
||||
buttonCreate_Pro.Size = new Size(136, 41);
|
||||
buttonCreate_Pro.TabIndex = 10;
|
||||
buttonCreate_Pro.Text = "Создать продвинутый тепловоз";
|
||||
buttonCreate_Pro.UseVisualStyleBackColor = true;
|
||||
buttonCreate_Pro.Click += buttonCreate_Pro_Click;
|
||||
//
|
||||
// WarmlyLocomotiveForm
|
||||
//
|
||||
ClientSize = new Size(884, 461);
|
||||
Controls.Add(buttonCreate_Pro);
|
||||
Controls.Add(buttonStep);
|
||||
Controls.Add(comboBox1);
|
||||
Controls.Add(buttonRight);
|
||||
Controls.Add(buttonDown);
|
||||
Controls.Add(buttonUp);
|
||||
@ -133,5 +171,8 @@
|
||||
private Button buttonUp;
|
||||
private Button buttonDown;
|
||||
private Button buttonRight;
|
||||
private ComboBox comboBox1;
|
||||
private Button buttonStep;
|
||||
private Button buttonCreate_Pro;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user