Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
1ec37ccf88 | ||
|
57d38a4bbe | ||
|
7beae4d50f | ||
|
3600069b20 | ||
|
1994f6ec4d | ||
|
e88714da83 | ||
|
3833d02e56 |
121
WarmlyLocomotive/AbstractStrategy.cs
Normal file
121
WarmlyLocomotive/AbstractStrategy.cs
Normal file
@ -0,0 +1,121 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
25
WarmlyLocomotive/Direction.cs
Normal file
25
WarmlyLocomotive/Direction.cs
Normal file
@ -0,0 +1,25 @@
|
||||
namespace WarmlyLocomotive
|
||||
{
|
||||
/// <summary>
|
||||
/// Направление перемещения
|
||||
/// </summary>
|
||||
public enum Direction
|
||||
{
|
||||
/// <summary>
|
||||
/// Вверх
|
||||
/// /// </summary>
|
||||
Up = 1,
|
||||
/// <summary>
|
||||
/// Вниз
|
||||
/// </summary>
|
||||
Down = 2,
|
||||
/// <summary>
|
||||
/// Влево
|
||||
/// </summary>
|
||||
Left = 3,
|
||||
/// <summary>
|
||||
/// Вправо
|
||||
/// </summary>
|
||||
Right = 4
|
||||
}
|
||||
}
|
31
WarmlyLocomotive/DrawningObjectWarmlyLocomotive.cs
Normal file
31
WarmlyLocomotive/DrawningObjectWarmlyLocomotive.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using WarmlyLocomotive.DrawningObjects;
|
||||
|
||||
namespace WarmlyLocomotive.MovementStrategy
|
||||
{
|
||||
internal class DrawningObjectWarmlyLocomotive : IMoveableObject
|
||||
{
|
||||
private readonly DrawningWarmlyLocomotive? _drawningWarmlyLocomotive = null;
|
||||
public DrawningObjectWarmlyLocomotive(DrawningWarmlyLocomotive drawningWarmlylocomotive)
|
||||
{
|
||||
_drawningWarmlyLocomotive = drawningWarmlylocomotive;
|
||||
}
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_drawningWarmlyLocomotive == null || _drawningWarmlyLocomotive.EntityWarmlyLocomotive ==
|
||||
null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_drawningWarmlyLocomotive.GetPosX,
|
||||
_drawningWarmlyLocomotive.GetPosY, _drawningWarmlyLocomotive.GetWidth, _drawningWarmlyLocomotive.GetHeight);
|
||||
}
|
||||
}
|
||||
public int GetStep => (int)(_drawningWarmlyLocomotive?.EntityWarmlyLocomotive?.Step ?? 0);
|
||||
public bool CheckCanMove(Direction direction) =>
|
||||
_drawningWarmlyLocomotive?.CanMove(direction) ?? false;
|
||||
public void MoveObject(Direction direction) =>
|
||||
_drawningWarmlyLocomotive?.MoveTransport(direction);
|
||||
}
|
||||
}
|
194
WarmlyLocomotive/DrawningWarmlyLocomotive.cs
Normal file
194
WarmlyLocomotive/DrawningWarmlyLocomotive.cs
Normal file
@ -0,0 +1,194 @@
|
||||
using WarmlyLocomotive.Entities;
|
||||
using WarmlyLocomotive.MovementStrategy;
|
||||
|
||||
namespace WarmlyLocomotive.DrawningObjects
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||
/// </summary>
|
||||
public class DrawningWarmlyLocomotive
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-сущность
|
||||
/// </summary>
|
||||
public EntityWarmlyLocomotive? EntityWarmlyLocomotive { get; protected set; }
|
||||
public IMoveableObject GetMoveableObject => new DrawningObjectWarmlyLocomotive(this);
|
||||
/// <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>
|
||||
/// <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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
41
WarmlyLocomotive/DrawningWarmlyLocomotiveWithTrumpet.cs
Normal file
41
WarmlyLocomotive/DrawningWarmlyLocomotiveWithTrumpet.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using WarmlyLocomotive.Entities;
|
||||
|
||||
namespace WarmlyLocomotive.DrawningObjects
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||
/// </summary>
|
||||
public class DrawningWarmlyLocomotiveWithTrumpet : DrawningWarmlyLocomotive
|
||||
{
|
||||
public DrawningWarmlyLocomotiveWithTrumpet(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 EntityWarmlyLocomotiveWithTrumpet(speed, weight, bodyColor, additionalColor, trumpet, luggage);
|
||||
}
|
||||
}
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityWarmlyLocomotive is not EntityWarmlyLocomotiveWithTrumpet warmlylocomotive)
|
||||
{
|
||||
return;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
WarmlyLocomotive/EntityWarmlyLocomotive.cs
Normal file
37
WarmlyLocomotive/EntityWarmlyLocomotive.cs
Normal file
@ -0,0 +1,37 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
27
WarmlyLocomotive/EntityWarmlyLocomotiveWithTrumpet .cs
Normal file
27
WarmlyLocomotive/EntityWarmlyLocomotiveWithTrumpet .cs
Normal file
@ -0,0 +1,27 @@
|
||||
namespace WarmlyLocomotive.Entities
|
||||
{
|
||||
public class EntityWarmlyLocomotiveWithTrumpet : 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 EntityWarmlyLocomotiveWithTrumpet(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool trumpet,bool luggage) : base(speed, weight, bodyColor)
|
||||
{
|
||||
|
||||
AdditionalColor = additionalColor;
|
||||
Trumpet = trumpet;
|
||||
Luggage = luggage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
39
WarmlyLocomotive/Form1.Designer.cs
generated
39
WarmlyLocomotive/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
||||
namespace WarmlyLocomotive
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <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.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace WarmlyLocomotive
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
209
WarmlyLocomotive/FormWarmlyLocomotiveCollection.Designer.cs
generated
Normal file
209
WarmlyLocomotive/FormWarmlyLocomotiveCollection.Designer.cs
generated
Normal file
@ -0,0 +1,209 @@
|
||||
namespace WarmlyLocomotive
|
||||
{
|
||||
partial class FormWarmlyLocomotiveCollection
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelCollection = new Label();
|
||||
panelCollectionWarmlyLocomotive = new Panel();
|
||||
labelGenericCollection = new Label();
|
||||
panel1 = new Panel();
|
||||
buttonDelObject = new Button();
|
||||
textBoxStorageName = new TextBox();
|
||||
listBoxStorages = new ListBox();
|
||||
buttonAddObject = new Button();
|
||||
buttonreFreshCollection = new Button();
|
||||
maskedTextBoxNumber = new TextBox();
|
||||
buttonRemove = new Button();
|
||||
buttonAdd = new Button();
|
||||
pictureBoxCollectionWarmlyLocomotive = new PictureBox();
|
||||
panelCollectionWarmlyLocomotive.SuspendLayout();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollectionWarmlyLocomotive).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelCollection
|
||||
//
|
||||
labelCollection.AutoSize = true;
|
||||
labelCollection.BorderStyle = BorderStyle.Fixed3D;
|
||||
labelCollection.Location = new Point(662, 10);
|
||||
labelCollection.Name = "labelCollection";
|
||||
labelCollection.Size = new Size(85, 17);
|
||||
labelCollection.TabIndex = 0;
|
||||
labelCollection.Text = "Инструменты";
|
||||
//
|
||||
// panelCollectionWarmlyLocomotive
|
||||
//
|
||||
panelCollectionWarmlyLocomotive.Controls.Add(labelGenericCollection);
|
||||
panelCollectionWarmlyLocomotive.Controls.Add(panel1);
|
||||
panelCollectionWarmlyLocomotive.Controls.Add(buttonreFreshCollection);
|
||||
panelCollectionWarmlyLocomotive.Controls.Add(maskedTextBoxNumber);
|
||||
panelCollectionWarmlyLocomotive.Controls.Add(buttonRemove);
|
||||
panelCollectionWarmlyLocomotive.Controls.Add(buttonAdd);
|
||||
panelCollectionWarmlyLocomotive.Location = new Point(662, 28);
|
||||
panelCollectionWarmlyLocomotive.Name = "panelCollectionWarmlyLocomotive";
|
||||
panelCollectionWarmlyLocomotive.Size = new Size(149, 410);
|
||||
panelCollectionWarmlyLocomotive.TabIndex = 1;
|
||||
//
|
||||
// labelGenericCollection
|
||||
//
|
||||
labelGenericCollection.AutoSize = true;
|
||||
labelGenericCollection.Location = new Point(17, -1);
|
||||
labelGenericCollection.Name = "labelGenericCollection";
|
||||
labelGenericCollection.Size = new Size(52, 15);
|
||||
labelGenericCollection.TabIndex = 5;
|
||||
labelGenericCollection.Text = "Наборы";
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonDelObject);
|
||||
panel1.Controls.Add(textBoxStorageName);
|
||||
panel1.Controls.Add(listBoxStorages);
|
||||
panel1.Controls.Add(buttonAddObject);
|
||||
panel1.Location = new Point(3, 16);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(143, 209);
|
||||
panel1.TabIndex = 4;
|
||||
//
|
||||
// buttonDelObject
|
||||
//
|
||||
buttonDelObject.Location = new Point(15, 175);
|
||||
buttonDelObject.Name = "buttonDelObject";
|
||||
buttonDelObject.Size = new Size(115, 23);
|
||||
buttonDelObject.TabIndex = 3;
|
||||
buttonDelObject.Text = "Удалить набор";
|
||||
buttonDelObject.UseVisualStyleBackColor = true;
|
||||
buttonDelObject.Click += buttonDelObject_Click;
|
||||
//
|
||||
// textBoxStorageName
|
||||
//
|
||||
textBoxStorageName.Location = new Point(13, 13);
|
||||
textBoxStorageName.Name = "textBoxStorageName";
|
||||
textBoxStorageName.Size = new Size(117, 23);
|
||||
textBoxStorageName.TabIndex = 2;
|
||||
//
|
||||
// listBoxStorages
|
||||
//
|
||||
listBoxStorages.FormattingEnabled = true;
|
||||
listBoxStorages.ItemHeight = 15;
|
||||
listBoxStorages.Location = new Point(14, 90);
|
||||
listBoxStorages.Name = "listBoxStorages";
|
||||
listBoxStorages.Size = new Size(119, 79);
|
||||
listBoxStorages.TabIndex = 1;
|
||||
listBoxStorages.SelectedIndexChanged += listBoxStorages_SelectedIndexChanged;
|
||||
//
|
||||
// buttonAddObject
|
||||
//
|
||||
buttonAddObject.Location = new Point(15, 51);
|
||||
buttonAddObject.Name = "buttonAddObject";
|
||||
buttonAddObject.Size = new Size(118, 22);
|
||||
buttonAddObject.TabIndex = 0;
|
||||
buttonAddObject.Text = "Добавить набор";
|
||||
buttonAddObject.UseVisualStyleBackColor = true;
|
||||
buttonAddObject.Click += buttonAddObject_Click;
|
||||
//
|
||||
// buttonreFreshCollection
|
||||
//
|
||||
buttonreFreshCollection.Location = new Point(3, 325);
|
||||
buttonreFreshCollection.Name = "buttonreFreshCollection";
|
||||
buttonreFreshCollection.Size = new Size(146, 23);
|
||||
buttonreFreshCollection.TabIndex = 3;
|
||||
buttonreFreshCollection.Text = "Обновить коллекцию";
|
||||
buttonreFreshCollection.UseVisualStyleBackColor = true;
|
||||
buttonreFreshCollection.Click += buttonreFreshCollection_Click;
|
||||
//
|
||||
// maskedTextBoxNumber
|
||||
//
|
||||
maskedTextBoxNumber.Location = new Point(16, 296);
|
||||
maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||
maskedTextBoxNumber.Size = new Size(117, 23);
|
||||
maskedTextBoxNumber.TabIndex = 2;
|
||||
//
|
||||
// buttonRemove
|
||||
//
|
||||
buttonRemove.Location = new Point(6, 369);
|
||||
buttonRemove.Name = "buttonRemove";
|
||||
buttonRemove.Size = new Size(143, 23);
|
||||
buttonRemove.TabIndex = 1;
|
||||
buttonRemove.Text = "Удалить тепловоз";
|
||||
buttonRemove.UseVisualStyleBackColor = true;
|
||||
buttonRemove.Click += buttonRemove_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(6, 247);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(143, 22);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.Text = "Добавить тепловоз";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// pictureBoxCollectionWarmlyLocomotive
|
||||
//
|
||||
pictureBoxCollectionWarmlyLocomotive.Location = new Point(12, 28);
|
||||
pictureBoxCollectionWarmlyLocomotive.Name = "pictureBoxCollectionWarmlyLocomotive";
|
||||
pictureBoxCollectionWarmlyLocomotive.Size = new Size(647, 410);
|
||||
pictureBoxCollectionWarmlyLocomotive.TabIndex = 2;
|
||||
pictureBoxCollectionWarmlyLocomotive.TabStop = false;
|
||||
//
|
||||
// FormWarmlyLocomotiveCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(823, 450);
|
||||
Controls.Add(pictureBoxCollectionWarmlyLocomotive);
|
||||
Controls.Add(panelCollectionWarmlyLocomotive);
|
||||
Controls.Add(labelCollection);
|
||||
Name = "FormWarmlyLocomotiveCollection";
|
||||
Text = "FormWarmlyLocomotiveCollection";
|
||||
panelCollectionWarmlyLocomotive.ResumeLayout(false);
|
||||
panelCollectionWarmlyLocomotive.PerformLayout();
|
||||
panel1.ResumeLayout(false);
|
||||
panel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollectionWarmlyLocomotive).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelCollection;
|
||||
private Panel panelCollectionWarmlyLocomotive;
|
||||
private PictureBox pictureBoxCollectionWarmlyLocomotive;
|
||||
private Button buttonAdd;
|
||||
private Button buttonRemove;
|
||||
private Button buttonreFreshCollection;
|
||||
private TextBox maskedTextBoxNumber;
|
||||
private Label labelGenericCollection;
|
||||
private Panel panel1;
|
||||
private Button buttonAddObject;
|
||||
private ListBox listBoxStorages;
|
||||
private TextBox textBoxStorageName;
|
||||
private Button buttonDelObject;
|
||||
}
|
||||
}
|
177
WarmlyLocomotive/FormWarmlyLocomotiveCollection.cs
Normal file
177
WarmlyLocomotive/FormWarmlyLocomotiveCollection.cs
Normal file
@ -0,0 +1,177 @@
|
||||
using WarmlyLocomotive.Generics;
|
||||
using WarmlyLocomotive.MovementStrategy;
|
||||
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 WarmlyLocomotive
|
||||
{
|
||||
public partial class FormWarmlyLocomotiveCollection : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Набор объектов
|
||||
/// </summary>
|
||||
private readonly WarmlyLocomotivesGenericStorage _storage;
|
||||
public FormWarmlyLocomotiveCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
_storage = new WarmlyLocomotivesGenericStorage(pictureBoxCollectionWarmlyLocomotive.Width, pictureBoxCollectionWarmlyLocomotive.Height);
|
||||
}
|
||||
/// <summary>
|
||||
/// Заполнение listBoxObjects
|
||||
/// </summary>
|
||||
private void ReloadObjects()
|
||||
{
|
||||
int index = listBoxStorages.SelectedIndex;
|
||||
listBoxStorages.Items.Clear();
|
||||
for (int i = 0; i < _storage.Keys.Count; i++)
|
||||
{
|
||||
listBoxStorages.Items.Add(_storage.Keys[i]);
|
||||
}
|
||||
if (listBoxStorages.Items.Count > 0 && (index == -1 || index
|
||||
>= listBoxStorages.Items.Count))
|
||||
{
|
||||
listBoxStorages.SelectedIndex = 0;
|
||||
}
|
||||
else if (listBoxStorages.Items.Count > 0 && index > -1 &&
|
||||
index < listBoxStorages.Items.Count)
|
||||
{
|
||||
listBoxStorages.SelectedIndex = index;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Выбор набора
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void listBoxStorages_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
pictureBoxCollectionWarmlyLocomotive.Image =
|
||||
_storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowWarmlyLocomotives();
|
||||
}
|
||||
/// <summary>
|
||||
/// Удаление набора
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonDelObject_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show($"Удалить объект {listBoxStorages.SelectedItem}?",
|
||||
"Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
_storage.DelSet(listBoxStorages.SelectedItem.ToString()
|
||||
?? string.Empty);
|
||||
ReloadObjects();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление объекта в набор
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
|
||||
string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
WarmlyLocomotiveForm form = new();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (obj + form.SelectedWarmlyLocomotive)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollectionWarmlyLocomotive.Image = obj.ShowWarmlyLocomotives();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Удаление объекта из набора
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
|
||||
string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
||||
if (obj - pos != null)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
pictureBoxCollectionWarmlyLocomotive.Image = obj.ShowWarmlyLocomotives();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Обновление рисунка по набору
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonreFreshCollection_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
|
||||
string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pictureBoxCollectionWarmlyLocomotive.Image = obj.ShowWarmlyLocomotives();
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление набора в коллекцию
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonAddObject_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
||||
{
|
||||
MessageBox.Show("Не все данные заполнены", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_storage.AddSet(textBoxStorageName.Text);
|
||||
ReloadObjects();
|
||||
}
|
||||
}
|
||||
}
|
120
WarmlyLocomotive/FormWarmlyLocomotiveCollection.resx
Normal file
120
WarmlyLocomotive/FormWarmlyLocomotiveCollection.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>
|
29
WarmlyLocomotive/IMoveableObject.cs
Normal file
29
WarmlyLocomotive/IMoveableObject.cs
Normal file
@ -0,0 +1,29 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
36
WarmlyLocomotive/MoveToBorder.cs
Normal file
36
WarmlyLocomotive/MoveToBorder.cs
Normal file
@ -0,0 +1,36 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
50
WarmlyLocomotive/MoveToCenter.cs
Normal file
50
WarmlyLocomotive/MoveToCenter.cs
Normal file
@ -0,0 +1,50 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
51
WarmlyLocomotive/ObjectParameters.cs
Normal file
51
WarmlyLocomotive/ObjectParameters.cs
Normal file
@ -0,0 +1,51 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ namespace WarmlyLocomotive
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
Application.Run(new FormWarmlyLocomotiveCollection());
|
||||
}
|
||||
}
|
||||
}
|
63
WarmlyLocomotive/Properties/Resources.Designer.cs
generated
Normal file
63
WarmlyLocomotive/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WarmlyLocomotive.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||
// с помощью такого средства, как ResGen или Visual Studio.
|
||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||
// с параметром /str или перестройте свой проект VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WarmlyLocomotive.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
110
WarmlyLocomotive/SetGeneric.cs
Normal file
110
WarmlyLocomotive/SetGeneric.cs
Normal file
@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WarmlyLocomotive.Generics
|
||||
{
|
||||
/// <summary>
|
||||
/// Параметризованный набор объектов
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
internal class SetGeneric<T>
|
||||
where T : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Список объектов, которые храним
|
||||
/// </summary>
|
||||
private readonly List<T?> _places;
|
||||
/// <summary>
|
||||
/// Количество объектов в массиве
|
||||
/// </summary>
|
||||
public int Count => _places.Count;
|
||||
/// <summary>
|
||||
/// Максимальное количество объектов в списке
|
||||
/// </summary>
|
||||
private readonly int _maxCount;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="count"></param>
|
||||
public SetGeneric(int count)
|
||||
{
|
||||
_maxCount = count;
|
||||
_places = new List<T?>(count);
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление объекта в набор
|
||||
/// </summary>
|
||||
/// <param name="warmlylocomotive">Добавляемый тепловоз</param>
|
||||
/// <returns></returns>
|
||||
public bool Insert(T warmlylocomotive)
|
||||
{
|
||||
if (_places.Count == _maxCount)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Insert(warmlylocomotive, 0);
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление объекта в набор на конкретную позицию
|
||||
/// </summary>
|
||||
/// <param name="warmlylocomotive">Добавляемый тепловоз</param>
|
||||
/// <param name="position">Позиция</param>
|
||||
/// <returns></returns>
|
||||
public bool Insert(T warmlylocomotive, int position)
|
||||
{
|
||||
if (!(position >= 0 && position <= Count && _places.Count < _maxCount)) return false;
|
||||
_places.Insert(position, warmlylocomotive);
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Удаление объекта из набора с конкретной позиции
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <returns></returns>
|
||||
public bool Remove(int position)
|
||||
{
|
||||
if (position < 0 || position >= Count) return false;
|
||||
_places.RemoveAt(position);
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение объекта из набора по позиции
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <returns></returns>
|
||||
public T? this[int position]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (position < 0 || position >= Count) return null;
|
||||
return _places[position];
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!(position >= 0 && position < Count && _places.Count < _maxCount)) return;
|
||||
_places.Insert(position, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Проход по списку
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<T?> GetWarmlyLocomotives(int? maxWarmlyLocomotives = null)
|
||||
{
|
||||
for (int i = 0; i < _places.Count; ++i)
|
||||
{
|
||||
yield return _places[i];
|
||||
if (maxWarmlyLocomotives.HasValue && i == maxWarmlyLocomotives.Value)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
13
WarmlyLocomotive/Status.cs
Normal file
13
WarmlyLocomotive/Status.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace WarmlyLocomotive.MovementStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Статус выполнения операции перемещения
|
||||
/// </summary>
|
||||
public enum Status
|
||||
{
|
||||
NotInit,
|
||||
InProgress,
|
||||
Finish
|
||||
}
|
||||
}
|
||||
|
@ -8,4 +8,19 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
191
WarmlyLocomotive/WarmlyLocomotiveForm.cs
Normal file
191
WarmlyLocomotive/WarmlyLocomotiveForm.cs
Normal file
@ -0,0 +1,191 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using WarmlyLocomotive.DrawningObjects;
|
||||
|
||||
using WarmlyLocomotive.MovementStrategy;
|
||||
|
||||
namespace WarmlyLocomotive
|
||||
{
|
||||
/// <summary>
|
||||
/// Ôîðìà ðàáîòû ñ îáúåêòîì "Òåïëîâîç ñ òðóáîé è ïðèöåïîì"
|
||||
/// </summary>
|
||||
public partial class WarmlyLocomotiveForm : Form
|
||||
{
|
||||
private DrawningWarmlyLocomotive? _drawningWarmlyLocomotive;
|
||||
private AbstractStrategy? _strategy;
|
||||
public DrawningWarmlyLocomotive? SelectedWarmlyLocomotive { get; private set; }
|
||||
public WarmlyLocomotiveForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
_strategy = null;
|
||||
SelectedWarmlyLocomotive = null;
|
||||
}
|
||||
/// <summary>
|
||||
/// Ìåòîä ïðîðèñîâêè ìàøèíû
|
||||
/// </summary>
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawningWarmlyLocomotive == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Bitmap bmp = new(pictureBoxWarmlyLocomotive.Width,
|
||||
pictureBoxWarmlyLocomotive.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningWarmlyLocomotive.DrawTransport(gr);
|
||||
pictureBoxWarmlyLocomotive.Image = bmp;
|
||||
}
|
||||
/// <summary>
|
||||
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü òåïëîâîç"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
|
||||
Color dopColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
_drawningWarmlyLocomotive = new DrawningWarmlyLocomotive(random.Next(100, 300),
|
||||
random.Next(1000, 3000),
|
||||
color,
|
||||
pictureBoxWarmlyLocomotive.Width, pictureBoxWarmlyLocomotive.Height);
|
||||
_drawningWarmlyLocomotive.SetPosition(random.Next(10, 100), random.Next(10,
|
||||
100));
|
||||
Draw();
|
||||
}
|
||||
private void buttonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (_drawningWarmlyLocomotive == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
_drawningWarmlyLocomotive.MoveTransport(Direction.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
_drawningWarmlyLocomotive.MoveTransport(Direction.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
_drawningWarmlyLocomotive.MoveTransport(Direction.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
_drawningWarmlyLocomotive.MoveTransport(Direction.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
/// <summary>
|
||||
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Øàã"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningWarmlyLocomotive == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (comboBoxWarmlyLocomotive.Enabled)
|
||||
{
|
||||
_strategy = comboBoxWarmlyLocomotive.SelectedIndex
|
||||
switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToBorder(),
|
||||
_ => null,
|
||||
};
|
||||
if (_strategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_strategy.SetData(new
|
||||
DrawningObjectWarmlyLocomotive(_drawningWarmlyLocomotive), pictureBoxWarmlyLocomotive.Width,
|
||||
pictureBoxWarmlyLocomotive.Height);
|
||||
comboBoxWarmlyLocomotive.Enabled = false;
|
||||
}
|
||||
if (_strategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_strategy.MakeStep();
|
||||
Draw();
|
||||
if (_strategy.GetStatus() == Status.Finish)
|
||||
{
|
||||
comboBoxWarmlyLocomotive.Enabled = true;
|
||||
_strategy = null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü ïðîäâèíóòûé òåïëîâîç"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonCreate_WarmlyLocomotivePro_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
Color dopColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dopDialog = new();
|
||||
if (dopDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
dopColor = dopDialog.Color;
|
||||
}
|
||||
_drawningWarmlyLocomotive = new DrawningWarmlyLocomotiveWithTrumpet(random.Next(100, 300),
|
||||
random.Next(1000, 3000),
|
||||
color,
|
||||
dopColor,
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
pictureBoxWarmlyLocomotive.Width, pictureBoxWarmlyLocomotive.Height);
|
||||
_drawningWarmlyLocomotive.SetPosition(random.Next(10, 100), random.Next(10,
|
||||
100));
|
||||
Draw();
|
||||
}
|
||||
private void buttonSelectWarmlyLocomotive_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedWarmlyLocomotive = _drawningWarmlyLocomotive;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
private void buttonCreate_Pro_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
Color dopColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dopDialog = new();
|
||||
if (dopDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
dopColor = dopDialog.Color;
|
||||
}
|
||||
_drawningWarmlyLocomotive = new DrawningWarmlyLocomotiveWithTrumpet(random.Next(100, 300),
|
||||
random.Next(1000, 3000),
|
||||
color,
|
||||
dopColor,
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
pictureBoxWarmlyLocomotive.Width, pictureBoxWarmlyLocomotive.Height);
|
||||
_drawningWarmlyLocomotive.SetPosition(random.Next(10, 100), random.Next(10,
|
||||
100));
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
}
|
243
WarmlyLocomotive/WarmlyLocomotiveForm.resx
Normal file
243
WarmlyLocomotive/WarmlyLocomotiveForm.resx
Normal file
@ -0,0 +1,243 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="buttonLeft.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAT4AAACeCAMAAACcjZZYAAAABGdBTUEAALGPC/xhBQAAAJZQTFRF////
|
||||
Zs3/adH/AGKVAGWYOpnLH22dNpLEKYa4K3ilaM//AFiRAF2RAF+VatP/AGGUAFyU8/j6AF6VAFWQXcP1
|
||||
Vbnr2eXtq8TWQqLUEnCjcZ285O3y6/L2Wr/xT7LkMIy+R4Srbdf/Wo+zvtHfz97olLTLo77SI3+yUoqw
|
||||
uM3cZJa3x9jjgKfCHHirOpfJeKG+nLrPN3ynjFhM0AAAAAlwSFlzAAAOvAAADrwBlbxySQAABM1JREFU
|
||||
eF7tndtS2zAURZ3Y3ELACRSSlLRAAwkp1/7/z/XoYqfEuh2Jh4611wt5YJhhzY7ssc+WCgAAAOB/Z6l/
|
||||
ghjWC/0B8FnenZ7oj4DNbFJX0BcJRa+qoC+S2aQke9AXxfJJRA/64pidnVV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afOPci+hPovLH2oxezD09eWshBABVdfc+wL2qgStj4KYHPUmv4TOROhT3VS0cQXxOhD
|
||||
I7olTl8xfVIb4OQewEh9zUYkWe+BQ0Tr05t/ZR7AeH3tJkw5D3Ok6Gu3AMs3gEn6imKNDehS9OkAVrkG
|
||||
MFUfNt9M1Fcs5a7D2Po1mg+5AmLj4Viw7XUi2HQ9DW4dpDcnJnzJlv8EDpxIA8edJILDdtLAUU+J6ADi
|
||||
oLFImh66510w9NkImiiHPivNEZ+uLzD0OfAHEAfMumhO1sbxxpF4Nl6DPg842j0R1akxVxqw9vnRnRrT
|
||||
QC/SF4Le9bQbQOgLQndqOgGEvkDMlQboC8XYqYG+cAwT5dDHYNUJIPRx6EyUQx+P1eeD3aCPi1oBdQCh
|
||||
j43s1OiJcujj01Qa6BIMfTG0nRroi0Kdbjme30NfHLLSUG82FfRFsRQBFEBfHLOJnA+Cvkhkpwb64hGd
|
||||
GuiLhwIIfSmsF/oDiOJG/wQAAADyoyj+AmeGvRPtSN2OAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="buttonUp.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAJ4AAAE+CAMAAABLMFkTAAAABGdBTUEAALGPC/xhBQAAAJZQTFRF////
|
||||
Zs3/adH/AGKVAGWYOpnLH22dNpLEKYa4K3ilaM//AFiRAF2RAF+VatP/AGGUAFyU8/j6AF6VAFWQXcP1
|
||||
Vbnr2eXtq8TWQqLUEnCjcZ285O3y6/L2Wr/xT7LkMIy+R4Srbdf/Wo+zvtHfz97olLTLo77SI3+yUoqw
|
||||
uM3cZJa3x9jjgKfCHHirOpfJeKG+nLrPN3ynjFhM0AAAAAlwSFlzAAAOvAAADrwBlbxySQAABYVJREFU
|
||||
eF7tnQtz0lwURUty+yC8sbbUvlDb4qNY/f9/7jvncvmkbQhJ9rlJxtlr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IHf796Np546ZVdG4wrzkW0uXW+3mPKZm+H13z9MpfjKhplfp5/bwnyhPyLn5NUmMslL/csqfm
|
||||
miT2qd1SbyxUNO+xpc4WrHjeY0uNLZie2sNDARuq59V5TzNpFT8WqpD38LzHFp+39Fho1mRapdqa5NBy
|
||||
y54qY6Gm0yoV8o4aTqts5gZBoJDm0yplp37lllv2lBsL6XJr0nRaJbudyJ986PTqvAd986IeZcZCft4T
|
||||
/UVePofHQhWWW/b496PnRXmrznts0Xe0isZC9TYgdhSPhWrMe2wpHgu1m1Yp2oL5tK3aad50T17dgLR2
|
||||
arfsX5Ms07bTKpo3zZkbSFq3+pzsMg4/A2YPbPb3qm/+COHzKu/0alq3OitiYeSXLcIF8xG993mXcqTl
|
||||
BXUBZv82ktdO4ZK5qMfbNcmTpD1AavUiMDn2CoW8HgtdX/UPYK0XLruXq2pjIWu9cFkrqIdAPQTqIVAP
|
||||
gXoI1EOgHgL1EKiHQD0E6iFQD4F6CNRDoB4C9RCoh0A9BOohUA+BegjUQ6AeAvUQqIdAPQTqIVAPgXoI
|
||||
1EOgHgL1EKiHQD0E6iFQD4F6CNRDoB4C9RCoh0A9BOohUA+BegjUQ6AeAvUQqIdAPQTqIVAPgXoI1EOg
|
||||
HgL1EKiHQD0E6iFQD4F6CNRDoB4C9RCoh0A9BOohUA+BegjUQ6AeAvUQqIdAPQTqIVAPgXoI1EOgHgL1
|
||||
EKiHQD0E6iFQD4F6CNRDoB4C9RCoh0A9BOohUA+BegjUQ6AeAvUQVO/1t6iuzTiKnlufGrGWi4XLWqHf
|
||||
7zl8a2oYvVa4rBXOX9SK1FrvxJhwWULIv8fR0X9+db0TsFPiSgAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="buttonDown.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAJ4AAAE+CAMAAABLMFkTAAAABG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5an+Z+8NvMeW/7kNZr32PKyJnFvk88N
|
||||
hwI27MZCdvMeW7Z5DzKtsl2TWG9A7HB5DzStMoyTWP6xHwrY4PIe4K3d8TBNAmxA7BjGB5tWuRkd5q3d
|
||||
8XCgt5aQ/4qjo992S70Tr4YgjAAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="buttonRight.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAT4AAACeCAMAAACcjZZYAAAABGdBTUEAALGPC/xhBQAAAJZQTFRF////
|
||||
Zs3/adH/AGKVAGWYOpnLH22dNpLEKYa4K3ilaM//AFiRAF2RAF+VatP/AGGUAFyU8/j6AF6VAFWQXcP1
|
||||
Vbnr2eXtq8TWQqLUEnCjcZ285O3y6/L2Wr/xT7LkMIy+R4Srbdf/Wo+zvtHfz97olLTLo77SI3+yUoqw
|
||||
uM3cZJa3x9jjgKfCHHirOpfJeKG+nLrPN3ynjFhM0AAABOBJREFUeF7tndtW2zAQRbEtAnHIpQHa0Ja2
|
||||
9BZ6gbb//3OdsUfOzZZGUtZqV3T2C1lgXjYniknmSGcAAABAxryRryCKu6/yAMQwnnx4Kw9BOGMzX7yS
|
||||
xyCYsTEGAYyG9ZkKAYyk0UcBfEQAYyB96/XcmOkUAYxgbKrLh9VVxQF8Id8DalhfWd48cQCX3+SbQEuj
|
||||
r6jL1ZwD+BEBDKPVVxQSwAoBDMLqK+rZ6opfgr/LD4CGTl8TQBI4nX6SHwE/W/o4gPQEpgBiBdSyrY8C
|
||||
eH/HK6BBAJXs6qOX4HOsgAHs6dsE8IdcAFwc6OsC+FquAA4O9XUBHCGAXvr0UQCfEUAVvfo2K+BnuQz0
|
||||
w/pm4mwbCeD1L7kO9DKQPqK85QAuRwigg2F9RV1fNCsgAjiMQ19RzBBAD0NrX4sN4E+5GuzhTB9R3prm
|
||||
HhAB7MWnDw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aRqC9ys6dMXUC/InUN9Qbsv
|
||||
586BPkQvhD19WPXC2NVnmy3qekHubOujVY/kBdULcmdLn512RPT0dPpsvUBbqgKM1SfRm4fPeGdNq4+n
|
||||
HTl6wfWC3Gn0Sb0g9Kg10Oh7aGa8o+oFuTM2Zr3m6MXVC3KH9DGTx8Rpx0xp9FUpM95Zw/rSZryzZpxW
|
||||
L8idMaKXwl1avSB3ED0AAAD/OWdnfwFZ0L0TDt7FAgAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
131
WarmlyLocomotive/WarmlyLocomotivesGenericCollectioncs.cs
Normal file
131
WarmlyLocomotive/WarmlyLocomotivesGenericCollectioncs.cs
Normal file
@ -0,0 +1,131 @@
|
||||
using WarmlyLocomotive.DrawningObjects;
|
||||
using WarmlyLocomotive.MovementStrategy;
|
||||
namespace WarmlyLocomotive.Generics
|
||||
{
|
||||
internal class WarmlyLocomotivesGenericCollection<T, U>
|
||||
where T : DrawningWarmlyLocomotive
|
||||
where U : IMoveableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Ширина окна прорисовки
|
||||
/// </summary>
|
||||
private readonly int _pictureWidth;
|
||||
/// <summary>
|
||||
/// Высота окна прорисовки
|
||||
/// </summary>
|
||||
private readonly int _pictureHeight;
|
||||
/// <summary>
|
||||
/// Размер занимаемого объектом места (ширина)
|
||||
/// </summary>
|
||||
private readonly int _placeSizeWidth = 270;
|
||||
/// <summary>
|
||||
/// Размер занимаемого объектом места (высота)
|
||||
/// </summary>
|
||||
private readonly int _placeSizeHeight = 100;
|
||||
/// <summary>
|
||||
/// Набор объектов
|
||||
/// </summary>
|
||||
private readonly SetGeneric<T> _collection;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="picWidth"></param>
|
||||
/// <param name="picHeight"></param>
|
||||
public WarmlyLocomotivesGenericCollection(int picWidth, int picHeight)
|
||||
{
|
||||
int width = picWidth / _placeSizeWidth;
|
||||
int height = picHeight / _placeSizeHeight;
|
||||
_pictureWidth = picWidth;
|
||||
_pictureHeight = picHeight;
|
||||
_collection = new SetGeneric<T>(width * height);
|
||||
}
|
||||
/// <summary>
|
||||
/// Перегрузка оператора сложения
|
||||
/// </summary>
|
||||
/// <param name="collect"></param>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
public static bool operator +(WarmlyLocomotivesGenericCollection<T, U> collect, T? obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (bool)collect?._collection.Insert(obj);
|
||||
}
|
||||
/// <summary>
|
||||
/// Перегрузка оператора вычитания
|
||||
/// </summary>
|
||||
/// <param name="collect"></param>
|
||||
/// <param name="pos"></param>
|
||||
/// <returns></returns>
|
||||
public static bool operator -(WarmlyLocomotivesGenericCollection<T, U> collect, int pos)
|
||||
{
|
||||
T? obj = collect._collection[pos];
|
||||
if (obj != null)
|
||||
{
|
||||
collect._collection.Remove(pos);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение объекта IMoveableObject
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <returns></returns>
|
||||
public U? GetU(int pos)
|
||||
{
|
||||
return (U?)_collection[pos]?.GetMoveableObject;
|
||||
}
|
||||
/// <summary>
|
||||
/// Вывод всего набора объектов
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Bitmap ShowWarmlyLocomotives()
|
||||
{
|
||||
Bitmap bmp = new(_pictureWidth, _pictureHeight);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
DrawBackground(gr);
|
||||
DrawObjects(gr);
|
||||
return bmp;
|
||||
}
|
||||
/// <summary>
|
||||
/// Метод отрисовки фона
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
private void DrawBackground(Graphics g)
|
||||
{
|
||||
Pen pen = new(Color.Black, 3);
|
||||
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
|
||||
{
|
||||
for (int j = 0; j < _pictureHeight / _placeSizeHeight +
|
||||
1; ++j)
|
||||
{
|
||||
g.DrawLine(pen, i * _placeSizeWidth, j *
|
||||
_placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j *
|
||||
_placeSizeHeight);
|
||||
}
|
||||
g.DrawLine(pen, i * _placeSizeWidth, 0, i *
|
||||
_placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Метод прорисовки объектов
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
private void DrawObjects(Graphics g)
|
||||
{
|
||||
int i = 0;
|
||||
int numPlacesInRow = _pictureWidth / _placeSizeWidth;
|
||||
foreach (var warmlylocomotive in _collection.GetWarmlyLocomotives())
|
||||
{
|
||||
if (warmlylocomotive != null)
|
||||
{
|
||||
warmlylocomotive.SetPosition((i % numPlacesInRow) * _placeSizeWidth + _placeSizeWidth / 20, _placeSizeHeight * (i / numPlacesInRow) + _placeSizeHeight / 10);
|
||||
warmlylocomotive.DrawTransport(g);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
40
WarmlyLocomotive/WarmlyLocomotivesGenericStorage.cs
Normal file
40
WarmlyLocomotive/WarmlyLocomotivesGenericStorage.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using WarmlyLocomotive.DrawningObjects;
|
||||
using WarmlyLocomotive.MovementStrategy;
|
||||
namespace WarmlyLocomotive.Generics
|
||||
{
|
||||
internal class WarmlyLocomotivesGenericStorage
|
||||
{
|
||||
readonly Dictionary<string, WarmlyLocomotivesGenericCollection<DrawningWarmlyLocomotive, DrawningObjectWarmlyLocomotive>> _warmlylocomotiveStorages;
|
||||
public List<string> Keys => _warmlylocomotiveStorages.Keys.ToList();
|
||||
private readonly int _pictureWidth;
|
||||
|
||||
private readonly int _pictureHeight;
|
||||
public WarmlyLocomotivesGenericStorage(int pictureWidth, int pictureHeight)
|
||||
{
|
||||
_warmlylocomotiveStorages = new Dictionary<string,
|
||||
WarmlyLocomotivesGenericCollection<DrawningWarmlyLocomotive, DrawningObjectWarmlyLocomotive>>();
|
||||
_pictureWidth = pictureWidth;
|
||||
_pictureHeight = pictureHeight;
|
||||
}
|
||||
public void AddSet(string name)
|
||||
{
|
||||
_warmlylocomotiveStorages.Add(name, new WarmlyLocomotivesGenericCollection<DrawningWarmlyLocomotive, DrawningObjectWarmlyLocomotive>(_pictureWidth, _pictureHeight));
|
||||
}
|
||||
public void DelSet(string name)
|
||||
{
|
||||
if (!_warmlylocomotiveStorages.ContainsKey(name))
|
||||
return;
|
||||
_warmlylocomotiveStorages.Remove(name);
|
||||
}
|
||||
|
||||
public WarmlyLocomotivesGenericCollection<DrawningWarmlyLocomotive, DrawningObjectWarmlyLocomotive>? this[string ind]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_warmlylocomotiveStorages.ContainsKey(ind))
|
||||
return _warmlylocomotiveStorages[ind];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
190
WarmlyLocomotive/WarmlylocomotiveForm.Designer.cs
generated
Normal file
190
WarmlyLocomotive/WarmlylocomotiveForm.Designer.cs
generated
Normal file
@ -0,0 +1,190 @@
|
||||
namespace WarmlyLocomotive
|
||||
{
|
||||
partial class WarmlyLocomotiveForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WarmlyLocomotiveForm));
|
||||
pictureBoxWarmlyLocomotive = new PictureBox();
|
||||
buttonCreate = new Button();
|
||||
buttonLeft = new Button();
|
||||
buttonUp = new Button();
|
||||
buttonDown = new Button();
|
||||
buttonRight = new Button();
|
||||
comboBoxWarmlyLocomotive = new ComboBox();
|
||||
buttonStep = new Button();
|
||||
buttonCreate_Pro = new Button();
|
||||
buttonSelectCar = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxWarmlyLocomotive).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxWarmlyLocomotive
|
||||
//
|
||||
pictureBoxWarmlyLocomotive.Dock = DockStyle.Fill;
|
||||
pictureBoxWarmlyLocomotive.Location = new Point(0, 0);
|
||||
pictureBoxWarmlyLocomotive.Name = "pictureBoxWarmlyLocomotive";
|
||||
pictureBoxWarmlyLocomotive.Size = new Size(884, 481);
|
||||
pictureBoxWarmlyLocomotive.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||
pictureBoxWarmlyLocomotive.TabIndex = 0;
|
||||
pictureBoxWarmlyLocomotive.TabStop = false;
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreate.Location = new Point(216, 399);
|
||||
buttonCreate.Name = "buttonCreate";
|
||||
buttonCreate.Size = new Size(119, 23);
|
||||
buttonCreate.TabIndex = 1;
|
||||
buttonCreate.Text = "Создать тепловоз";
|
||||
buttonCreate.UseVisualStyleBackColor = true;
|
||||
buttonCreate.Click += buttonCreate_Click;
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonLeft.BackgroundImage = (Image)resources.GetObject("buttonLeft.BackgroundImage");
|
||||
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonLeft.Location = new Point(751, 420);
|
||||
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.Left;
|
||||
buttonUp.BackgroundImage = (Image)resources.GetObject("buttonUp.BackgroundImage");
|
||||
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonUp.Location = new Point(777, 392);
|
||||
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.Left;
|
||||
buttonDown.BackgroundImage = (Image)resources.GetObject("buttonDown.BackgroundImage");
|
||||
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonDown.Location = new Point(777, 420);
|
||||
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.Left;
|
||||
buttonRight.BackgroundImage = (Image)resources.GetObject("buttonRight.BackgroundImage");
|
||||
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonRight.Location = new Point(808, 420);
|
||||
buttonRight.Name = "buttonRight";
|
||||
buttonRight.Size = new Size(30, 30);
|
||||
buttonRight.TabIndex = 5;
|
||||
buttonRight.UseVisualStyleBackColor = true;
|
||||
buttonRight.Click += buttonMove_Click;
|
||||
//
|
||||
// comboBoxWarmlyLocomotive
|
||||
//
|
||||
comboBoxWarmlyLocomotive.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxWarmlyLocomotive.FormattingEnabled = true;
|
||||
comboBoxWarmlyLocomotive.Items.AddRange(new object[] { "Центр", "Угол" });
|
||||
comboBoxWarmlyLocomotive.Location = new Point(717, 21);
|
||||
comboBoxWarmlyLocomotive.Name = "comboBoxWarmlyLocomotive";
|
||||
comboBoxWarmlyLocomotive.Size = new Size(121, 23);
|
||||
comboBoxWarmlyLocomotive.TabIndex = 7;
|
||||
//
|
||||
// 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;
|
||||
//
|
||||
// buttonSelectCar
|
||||
//
|
||||
buttonSelectCar.Location = new Point(705, 99);
|
||||
buttonSelectCar.Name = "buttonSelectCar";
|
||||
buttonSelectCar.Size = new Size(133, 23);
|
||||
buttonSelectCar.TabIndex = 11;
|
||||
buttonSelectCar.Text = "Выбор тепловоза";
|
||||
buttonSelectCar.UseVisualStyleBackColor = true;
|
||||
buttonSelectCar.Click += buttonSelectWarmlyLocomotive_Click;
|
||||
//
|
||||
// WarmlyLocomotiveForm
|
||||
//
|
||||
ClientSize = new Size(884, 481);
|
||||
Controls.Add(buttonSelectCar);
|
||||
Controls.Add(buttonCreate_Pro);
|
||||
Controls.Add(buttonStep);
|
||||
Controls.Add(comboBoxWarmlyLocomotive);
|
||||
Controls.Add(buttonRight);
|
||||
Controls.Add(buttonDown);
|
||||
Controls.Add(buttonUp);
|
||||
Controls.Add(buttonLeft);
|
||||
Controls.Add(buttonCreate);
|
||||
Controls.Add(pictureBoxWarmlyLocomotive);
|
||||
Name = "WarmlyLocomotiveForm";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "WarmlyLocomotiveForm";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxWarmlyLocomotive).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
private PictureBox pictureBoxWarmlyLocomotive;
|
||||
private Button buttonCreate;
|
||||
private Button buttonLeft;
|
||||
private Button buttonUp;
|
||||
private Button buttonDown;
|
||||
private Button buttonRight;
|
||||
private ComboBox comboBoxWarmlyLocomotive;
|
||||
private Button buttonStep;
|
||||
private Button buttonCreate_Pro;
|
||||
private Button buttonSelectCar;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user