Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ddba502b60 | ||
|
0c0472e328 | ||
|
f8096ea10a | ||
|
5940b3ee19 |
71
Bulldozer/Bulldozer/AbstractStrategy.cs
Normal file
71
Bulldozer/Bulldozer/AbstractStrategy.cs
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Bulldozer.DrawningObjects;
|
||||||
|
|
||||||
|
namespace Bulldozer.MovementStrategy
|
||||||
|
{
|
||||||
|
public abstract class AbstractStrategy
|
||||||
|
{
|
||||||
|
private IMoveableObject? _movebleObject;
|
||||||
|
private Status _state = Status.NotInit;
|
||||||
|
protected int FieldWidth { get; private set; }
|
||||||
|
protected int FieldHeight { get; private set; }
|
||||||
|
public Status GetStatus() { return _state; }
|
||||||
|
public void SetData(IMoveableObject moveableObject, int width, int height)
|
||||||
|
{
|
||||||
|
if (moveableObject == null)
|
||||||
|
{
|
||||||
|
_state = Status.NotInit;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_state = Status.InProgress;
|
||||||
|
_movebleObject = moveableObject;
|
||||||
|
FieldWidth = width;
|
||||||
|
FieldHeight = height;
|
||||||
|
}
|
||||||
|
public void MakeStep()
|
||||||
|
{
|
||||||
|
if (_state != Status.InProgress)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (IsTargetDestination())
|
||||||
|
{
|
||||||
|
_state = Status.Finish;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveToTarget();
|
||||||
|
}
|
||||||
|
protected bool MoveLeft() => MoveTo(DirectionTypeBulldozer.Left);
|
||||||
|
protected bool MoveRight() => MoveTo(DirectionTypeBulldozer.Right);
|
||||||
|
protected bool MoveUp() => MoveTo(DirectionTypeBulldozer.Up);
|
||||||
|
protected bool MoveDown() => MoveTo(DirectionTypeBulldozer.Down);
|
||||||
|
protected ObjectParameters? GetObjectParametrs => _movebleObject?.GetObjectPosition;
|
||||||
|
protected int? GetStep()
|
||||||
|
{
|
||||||
|
if (_state != Status.InProgress)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return _movebleObject?.GetStep;
|
||||||
|
}
|
||||||
|
protected abstract void MoveToTarget();
|
||||||
|
protected abstract bool IsTargetDestination();
|
||||||
|
private bool MoveTo(DirectionTypeBulldozer DirectionTypeBulldozer)
|
||||||
|
{
|
||||||
|
if (_state != Status.InProgress)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (_movebleObject?.CheckCanMove(DirectionTypeBulldozer) ?? false)
|
||||||
|
{
|
||||||
|
_movebleObject.MoveObject(DirectionTypeBulldozer);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
Bulldozer/Bulldozer/DirectionBulldozer.cs
Normal file
19
Bulldozer/Bulldozer/DirectionBulldozer.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Bulldozer
|
||||||
|
{
|
||||||
|
public enum DirectionTypeBulldozer
|
||||||
|
{
|
||||||
|
Up = 1,
|
||||||
|
|
||||||
|
Down = 2,
|
||||||
|
|
||||||
|
Left = 3,
|
||||||
|
|
||||||
|
Right = 4
|
||||||
|
}
|
||||||
|
}
|
130
Bulldozer/Bulldozer/DrawningBulldozer.cs
Normal file
130
Bulldozer/Bulldozer/DrawningBulldozer.cs
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Bulldozer.Entities;
|
||||||
|
namespace Bulldozer.DrawningObjects
|
||||||
|
{
|
||||||
|
public class DrawningBulldozer
|
||||||
|
{
|
||||||
|
public EntityBulldozer? EntityBulldozer { get; protected set; }
|
||||||
|
private int _pictureWidth;
|
||||||
|
private int _pictureHeight;
|
||||||
|
protected int _startPosX;
|
||||||
|
protected int _startPosY;
|
||||||
|
protected readonly int _bulldozerWidth = 160;
|
||||||
|
protected readonly int _bulldozerHeight = 80;
|
||||||
|
public DrawningBulldozer(int speed, double weight, Color mainColor, int width, int heigth)
|
||||||
|
{
|
||||||
|
if (width <= _bulldozerWidth || heigth <= _bulldozerHeight)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_pictureWidth = width;
|
||||||
|
_pictureHeight = heigth;
|
||||||
|
EntityBulldozer = new EntityBulldozer(speed, weight, mainColor);
|
||||||
|
}
|
||||||
|
protected DrawningBulldozer(int speed, double weight,
|
||||||
|
Color mainColor, int width, int heigth,
|
||||||
|
int bulldozerWidth, int bulldozerHeight)
|
||||||
|
{
|
||||||
|
if (width <= _bulldozerWidth || heigth <= _bulldozerHeight)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_pictureHeight = heigth;
|
||||||
|
_pictureWidth = width;
|
||||||
|
_bulldozerHeight = bulldozerHeight;
|
||||||
|
_bulldozerWidth = bulldozerWidth;
|
||||||
|
EntityBulldozer = new EntityBulldozer(speed, weight, mainColor);
|
||||||
|
}
|
||||||
|
public void SetPosition(int x, int y)
|
||||||
|
{
|
||||||
|
if (x < 0 || y < 0 || x + _bulldozerWidth > _pictureWidth || y + _bulldozerHeight > _pictureHeight)
|
||||||
|
{
|
||||||
|
x = 10;
|
||||||
|
y = 10;
|
||||||
|
}
|
||||||
|
_startPosX = x;
|
||||||
|
_startPosY = y;
|
||||||
|
}
|
||||||
|
public int GetPosX => _startPosX;
|
||||||
|
public int GetPosY => _startPosY;
|
||||||
|
public int GetWidth => _bulldozerWidth;
|
||||||
|
public int GetHeight => _bulldozerHeight;
|
||||||
|
public bool CanMove(DirectionTypeBulldozer direction)
|
||||||
|
{
|
||||||
|
if (EntityBulldozer == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return direction switch
|
||||||
|
{
|
||||||
|
DirectionTypeBulldozer.Left => _startPosX - EntityBulldozer.Step > 0,
|
||||||
|
DirectionTypeBulldozer.Up => _startPosY - EntityBulldozer.Step > 0,
|
||||||
|
DirectionTypeBulldozer.Right => _startPosX + EntityBulldozer.Step + _bulldozerWidth <= _pictureWidth,
|
||||||
|
DirectionTypeBulldozer.Down => _startPosY + EntityBulldozer.Step + _bulldozerHeight <= _pictureHeight,
|
||||||
|
_ => false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public void MoveTransport(DirectionTypeBulldozer direction)
|
||||||
|
{
|
||||||
|
if (!CanMove(direction) || EntityBulldozer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
case DirectionTypeBulldozer.Left:
|
||||||
|
_startPosX -= (int)EntityBulldozer.Step;
|
||||||
|
break;
|
||||||
|
case DirectionTypeBulldozer.Up:
|
||||||
|
_startPosY -= (int)EntityBulldozer.Step;
|
||||||
|
break;
|
||||||
|
case DirectionTypeBulldozer.Right:
|
||||||
|
_startPosX += (int)EntityBulldozer.Step;
|
||||||
|
break;
|
||||||
|
case DirectionTypeBulldozer.Down:
|
||||||
|
_startPosY += (int)EntityBulldozer.Step;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public virtual void DrawTrasport(Graphics g)
|
||||||
|
{
|
||||||
|
if (EntityBulldozer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Pen pen = new(Color.Black);
|
||||||
|
Brush mainBrush = new SolidBrush(EntityBulldozer.MainColor);
|
||||||
|
// Тело трактора
|
||||||
|
Brush tractorColor = new SolidBrush(EntityBulldozer.MainColor);
|
||||||
|
g.FillRectangle(tractorColor, _startPosX + 50, _startPosY + 20, 100, 30);
|
||||||
|
g.FillRectangle(tractorColor, _startPosX + 80, _startPosY, 10, 30);
|
||||||
|
//g.DrawEllipse(pen, _startPosX, _startPosY + 60, 90, 40);
|
||||||
|
int x = _startPosX + 50; // начальная позиция X
|
||||||
|
int y = _startPosY; // начальная позиция Y
|
||||||
|
int width = 110; // ширина прямоугольника
|
||||||
|
int height = 30; // высота прямоугольника
|
||||||
|
int radius = 20; // радиус закругления углов
|
||||||
|
|
||||||
|
// Рисуем закругленный прямоугольник
|
||||||
|
g.DrawArc(pen, x - 5, y + 50, radius * 2, radius * 2, 180, 90); // верхний левый угол
|
||||||
|
g.DrawLine(pen, x + radius - 5, y + 50, x + width - radius - 5, y + 50); // верхняя горизонталь
|
||||||
|
g.DrawArc(pen, x + width - radius * 2 - 5, y + 50, radius * 2, radius * 2, 270, 90); // верхний правый угол
|
||||||
|
g.DrawArc(pen, x + width - radius * 2 - 5, y + height - radius * 2 + 50, radius * 2, radius * 2, 0, 90); // нижний правый угол
|
||||||
|
g.DrawLine(pen, x + width - radius - 5, y + height + 50, x + radius - 5, y + height + 50); // нижняя горизонталь
|
||||||
|
g.DrawArc(pen, x - 5, y + height - radius * 2 + 50, radius * 2, radius * 2, 90, 90); // нижний левый угол
|
||||||
|
int wheelRadius = 15;
|
||||||
|
// Рисуем колеса трактора
|
||||||
|
g.DrawEllipse(pen, _startPosX + 50, _startPosY + 50, wheelRadius * 2, wheelRadius * 2);
|
||||||
|
g.FillEllipse(mainBrush, _startPosX + 50, _startPosY + 50, wheelRadius * 2, wheelRadius * 2);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 120, _startPosY + 50, wheelRadius * 2, wheelRadius * 2);
|
||||||
|
g.FillEllipse(mainBrush, _startPosX + 120, _startPosY + 50, wheelRadius * 2, wheelRadius * 2);
|
||||||
|
// Кабина
|
||||||
|
Brush cabinColor = new SolidBrush(EntityBulldozer.MainColor);
|
||||||
|
g.FillRectangle(cabinColor, _startPosX + 120, _startPosY, 30, 20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
55
Bulldozer/Bulldozer/DrawningFastBulldozer.cs
Normal file
55
Bulldozer/Bulldozer/DrawningFastBulldozer.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Bulldozer.Entities;
|
||||||
|
|
||||||
|
namespace Bulldozer.DrawningObjects
|
||||||
|
{
|
||||||
|
public class DrawningFastBulldozer : DrawningBulldozer
|
||||||
|
{
|
||||||
|
public DrawningFastBulldozer(int speed, double weight, Color mainColor, Color optionalColor, bool covsh, bool rearbucket, int width, int height) : base(speed, weight, mainColor, width, height, 200, 110)
|
||||||
|
{
|
||||||
|
if (EntityBulldozer != null)
|
||||||
|
{
|
||||||
|
EntityBulldozer = new EntityFastBulldozer(speed, weight, mainColor,
|
||||||
|
optionalColor, covsh, rearbucket);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public override void DrawTrasport(Graphics g)
|
||||||
|
{
|
||||||
|
if (EntityBulldozer is not EntityFastBulldozer fastBulldozer)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Pen pen = new(Color.Black);
|
||||||
|
Brush optionalBrush = new SolidBrush(fastBulldozer.OptionalColor);
|
||||||
|
if (fastBulldozer.Covsh)
|
||||||
|
{
|
||||||
|
Point[] trianglePoints = new Point[]
|
||||||
|
{
|
||||||
|
new Point(_startPosX+50, _startPosY + 60),
|
||||||
|
new Point(_startPosX+50, _startPosY + 110),
|
||||||
|
new Point(_startPosX + 10, _startPosY + 110)
|
||||||
|
};
|
||||||
|
// Рисуем треугольник
|
||||||
|
g.DrawPolygon(pen, trianglePoints);
|
||||||
|
}
|
||||||
|
if (fastBulldozer.Rearbucket)
|
||||||
|
{
|
||||||
|
Point[] trianglePoints = new Point[]
|
||||||
|
{
|
||||||
|
new Point(_startPosX+150, _startPosY + 60),
|
||||||
|
new Point(_startPosX+200, _startPosY + 60),
|
||||||
|
new Point(_startPosX + 200, _startPosY + 110)
|
||||||
|
};
|
||||||
|
// Рисуем треугольник
|
||||||
|
g.DrawPolygon(pen, trianglePoints);
|
||||||
|
}
|
||||||
|
_startPosY += 30;
|
||||||
|
base.DrawTrasport(g);
|
||||||
|
_startPosY -= 30;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
34
Bulldozer/Bulldozer/DrawningObjectBulldozer.cs
Normal file
34
Bulldozer/Bulldozer/DrawningObjectBulldozer.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Bulldozer.DrawningObjects;
|
||||||
|
|
||||||
|
namespace Bulldozer.MovementStrategy
|
||||||
|
{
|
||||||
|
public class DrawningObjectBulldozer : IMoveableObject
|
||||||
|
{
|
||||||
|
private readonly DrawningBulldozer? _drawningBulldozer = null;
|
||||||
|
public DrawningObjectBulldozer(DrawningBulldozer drawningBulldozer)
|
||||||
|
{
|
||||||
|
_drawningBulldozer = drawningBulldozer;
|
||||||
|
}
|
||||||
|
public ObjectParameters? GetObjectPosition
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_drawningBulldozer == null || _drawningBulldozer.EntityBulldozer == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new ObjectParameters(_drawningBulldozer.GetPosX,
|
||||||
|
_drawningBulldozer.GetPosY, _drawningBulldozer.GetWidth,
|
||||||
|
_drawningBulldozer.GetHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int GetStep => (int)(_drawningBulldozer?.EntityBulldozer?.Step ?? 0);
|
||||||
|
public bool CheckCanMove(DirectionTypeBulldozer direction) => _drawningBulldozer?.CanMove(direction) ?? false;
|
||||||
|
public void MoveObject(DirectionTypeBulldozer direction) => _drawningBulldozer?.MoveTransport(direction);
|
||||||
|
}
|
||||||
|
}
|
22
Bulldozer/Bulldozer/EntityBulldozer.cs
Normal file
22
Bulldozer/Bulldozer/EntityBulldozer.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Bulldozer.Entities
|
||||||
|
{
|
||||||
|
public class EntityBulldozer
|
||||||
|
{
|
||||||
|
public int Speed { get; private set; }
|
||||||
|
public double Weight { get; private set; }
|
||||||
|
public Color MainColor { get; private set; }
|
||||||
|
public double Step => (double)Speed * 100 / Weight;
|
||||||
|
public EntityBulldozer(int speed, double weight, Color mainColor)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
MainColor = mainColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
Bulldozer/Bulldozer/EntityFastBulldozer.cs
Normal file
22
Bulldozer/Bulldozer/EntityFastBulldozer.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using Bulldozer.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Bulldozer.Entities
|
||||||
|
{
|
||||||
|
public class EntityFastBulldozer : EntityBulldozer
|
||||||
|
{
|
||||||
|
public Color OptionalColor { get; private set; }
|
||||||
|
public bool Covsh { get; private set; }
|
||||||
|
public bool Rearbucket { get; private set; }
|
||||||
|
public EntityFastBulldozer(int speed, double weight, Color mainColor, Color optionalColor, bool covsh, bool rearbucket) : base(speed, weight, mainColor)
|
||||||
|
{
|
||||||
|
OptionalColor = optionalColor;
|
||||||
|
Covsh = covsh;
|
||||||
|
Rearbucket = rearbucket;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
Bulldozer/Bulldozer/Form1.Designer.cs
generated
45
Bulldozer/Bulldozer/Form1.Designer.cs
generated
@ -1,45 +0,0 @@
|
|||||||
namespace Bulldozer
|
|
||||||
{
|
|
||||||
partial class FormBulldozer
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// FormBulldozer
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(800, 450);
|
|
||||||
Name = "FormBulldozer";
|
|
||||||
Text = "Form1";
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace Bulldozer
|
|
||||||
{
|
|
||||||
public partial class FormBulldozer : Form
|
|
||||||
{
|
|
||||||
public FormBulldozer()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
178
Bulldozer/Bulldozer/FormBulldozer.Designer.cs
generated
Normal file
178
Bulldozer/Bulldozer/FormBulldozer.Designer.cs
generated
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
namespace Bulldozer
|
||||||
|
{
|
||||||
|
partial class FastBulldozer
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
pictureBoxFastBulldozer = new PictureBox();
|
||||||
|
buttonCreateBulldozer = new Button();
|
||||||
|
buttonCreateFastBulldozer = new Button();
|
||||||
|
buttonRight = new Button();
|
||||||
|
buttonDown = new Button();
|
||||||
|
buttonLeft = new Button();
|
||||||
|
buttonUp = new Button();
|
||||||
|
comboBoxStrategy = new ComboBox();
|
||||||
|
buttonStep = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxFastBulldozer).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// pictureBoxFastBulldozer
|
||||||
|
//
|
||||||
|
pictureBoxFastBulldozer.Dock = DockStyle.Fill;
|
||||||
|
pictureBoxFastBulldozer.Location = new Point(0, 0);
|
||||||
|
pictureBoxFastBulldozer.Name = "pictureBoxFastBulldozer";
|
||||||
|
pictureBoxFastBulldozer.Size = new Size(884, 461);
|
||||||
|
pictureBoxFastBulldozer.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||||
|
pictureBoxFastBulldozer.TabIndex = 0;
|
||||||
|
pictureBoxFastBulldozer.TabStop = false;
|
||||||
|
//
|
||||||
|
// buttonCreateBulldozer
|
||||||
|
//
|
||||||
|
buttonCreateBulldozer.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
buttonCreateBulldozer.Location = new Point(12, 426);
|
||||||
|
buttonCreateBulldozer.Name = "buttonCreateBulldozer";
|
||||||
|
buttonCreateBulldozer.Size = new Size(119, 23);
|
||||||
|
buttonCreateBulldozer.TabIndex = 1;
|
||||||
|
buttonCreateBulldozer.Text = "Создать Трактор";
|
||||||
|
buttonCreateBulldozer.UseVisualStyleBackColor = true;
|
||||||
|
buttonCreateBulldozer.Click += ButtonCreateBulldozer_Click;
|
||||||
|
//
|
||||||
|
// buttonCreateFastBulldozer
|
||||||
|
//
|
||||||
|
buttonCreateFastBulldozer.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
buttonCreateFastBulldozer.Location = new Point(137, 426);
|
||||||
|
buttonCreateFastBulldozer.Name = "buttonCreateFastBulldozer";
|
||||||
|
buttonCreateFastBulldozer.Size = new Size(162, 23);
|
||||||
|
buttonCreateFastBulldozer.TabIndex = 2;
|
||||||
|
buttonCreateFastBulldozer.Text = "Создать быстрый трактор";
|
||||||
|
buttonCreateFastBulldozer.UseVisualStyleBackColor = true;
|
||||||
|
buttonCreateFastBulldozer.Click += ButtonCreateFastBulldozer_Click;
|
||||||
|
//
|
||||||
|
// buttonRight
|
||||||
|
//
|
||||||
|
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonRight.Location = new Point(842, 419);
|
||||||
|
buttonRight.Name = "buttonRight";
|
||||||
|
buttonRight.Size = new Size(30, 30);
|
||||||
|
buttonRight.TabIndex = 3;
|
||||||
|
buttonRight.Text = ">";
|
||||||
|
buttonRight.UseVisualStyleBackColor = true;
|
||||||
|
buttonRight.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonDown
|
||||||
|
//
|
||||||
|
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonDown.Location = new Point(806, 419);
|
||||||
|
buttonDown.Name = "buttonDown";
|
||||||
|
buttonDown.Size = new Size(30, 30);
|
||||||
|
buttonDown.TabIndex = 4;
|
||||||
|
buttonDown.Text = "v";
|
||||||
|
buttonDown.UseVisualStyleBackColor = true;
|
||||||
|
buttonDown.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonLeft
|
||||||
|
//
|
||||||
|
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonLeft.Location = new Point(770, 419);
|
||||||
|
buttonLeft.Name = "buttonLeft";
|
||||||
|
buttonLeft.Size = new Size(30, 30);
|
||||||
|
buttonLeft.TabIndex = 5;
|
||||||
|
buttonLeft.Text = "<";
|
||||||
|
buttonLeft.UseVisualStyleBackColor = true;
|
||||||
|
buttonLeft.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonUp
|
||||||
|
//
|
||||||
|
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonUp.Location = new Point(806, 383);
|
||||||
|
buttonUp.Name = "buttonUp";
|
||||||
|
buttonUp.Size = new Size(30, 30);
|
||||||
|
buttonUp.TabIndex = 6;
|
||||||
|
buttonUp.Text = "^";
|
||||||
|
buttonUp.UseVisualStyleBackColor = true;
|
||||||
|
buttonUp.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// comboBoxStrategy
|
||||||
|
//
|
||||||
|
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxStrategy.FormattingEnabled = true;
|
||||||
|
comboBoxStrategy.Items.AddRange(new object[] { "Move to center", "Move to border" });
|
||||||
|
comboBoxStrategy.Location = new Point(751, 12);
|
||||||
|
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||||
|
comboBoxStrategy.Size = new Size(121, 23);
|
||||||
|
comboBoxStrategy.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// buttonStep
|
||||||
|
//
|
||||||
|
buttonStep.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
buttonStep.Location = new Point(797, 41);
|
||||||
|
buttonStep.Name = "buttonStep";
|
||||||
|
buttonStep.Size = new Size(75, 23);
|
||||||
|
buttonStep.TabIndex = 8;
|
||||||
|
buttonStep.Text = "Шаг";
|
||||||
|
buttonStep.UseVisualStyleBackColor = true;
|
||||||
|
buttonStep.Click += Buttonstep_Click;
|
||||||
|
//
|
||||||
|
// FastBulldozer
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(884, 461);
|
||||||
|
Controls.Add(buttonStep);
|
||||||
|
Controls.Add(comboBoxStrategy);
|
||||||
|
Controls.Add(buttonUp);
|
||||||
|
Controls.Add(buttonLeft);
|
||||||
|
Controls.Add(buttonDown);
|
||||||
|
Controls.Add(buttonRight);
|
||||||
|
Controls.Add(buttonCreateFastBulldozer);
|
||||||
|
Controls.Add(buttonCreateBulldozer);
|
||||||
|
Controls.Add(pictureBoxFastBulldozer);
|
||||||
|
Name = "FastBulldozer";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "FastBulldozer";
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxFastBulldozer).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private PictureBox pictureBoxFastBulldozer;
|
||||||
|
private Button buttonCreateBulldozer;
|
||||||
|
private Button buttonCreateFastBulldozer;
|
||||||
|
private Button buttonRight;
|
||||||
|
private Button buttonDown;
|
||||||
|
private Button buttonLeft;
|
||||||
|
private Button buttonUp;
|
||||||
|
private ComboBox comboBoxStrategy;
|
||||||
|
private Button buttonStep;
|
||||||
|
}
|
||||||
|
}
|
114
Bulldozer/Bulldozer/FormBulldozer.cs
Normal file
114
Bulldozer/Bulldozer/FormBulldozer.cs
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
using Bulldozer.DrawningObjects;
|
||||||
|
using Bulldozer.MovementStrategy;
|
||||||
|
|
||||||
|
namespace Bulldozer
|
||||||
|
{
|
||||||
|
public partial class FastBulldozer : Form
|
||||||
|
{
|
||||||
|
private DrawningBulldozer? _drawningBulldozer;
|
||||||
|
private AbstractStrategy? _abstractStrategy;
|
||||||
|
public FastBulldozer()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void Draw()
|
||||||
|
{
|
||||||
|
if (_drawningBulldozer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Bitmap bmp = new(pictureBoxFastBulldozer.Width,
|
||||||
|
pictureBoxFastBulldozer.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_drawningBulldozer.DrawTrasport(gr);
|
||||||
|
pictureBoxFastBulldozer.Image = bmp;
|
||||||
|
}
|
||||||
|
private void ButtonCreateFastBulldozer_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Random random = new Random();
|
||||||
|
_drawningBulldozer = new DrawningFastBulldozer(
|
||||||
|
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)),
|
||||||
|
pictureBoxFastBulldozer.Width,
|
||||||
|
pictureBoxFastBulldozer.Height);
|
||||||
|
_drawningBulldozer.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
private void ButtonCreateBulldozer_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Random random = new Random();
|
||||||
|
_drawningBulldozer = new DrawningBulldozer(
|
||||||
|
random.Next(100, 300),
|
||||||
|
random.Next(1000, 3000),
|
||||||
|
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||||
|
pictureBoxFastBulldozer.Width,
|
||||||
|
pictureBoxFastBulldozer.Height);
|
||||||
|
_drawningBulldozer.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
private void ButtonMove_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawningBulldozer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||||
|
switch (name)
|
||||||
|
{
|
||||||
|
case "buttonUp":
|
||||||
|
_drawningBulldozer.MoveTransport(DirectionTypeBulldozer.Up);
|
||||||
|
break;
|
||||||
|
case "buttonDown":
|
||||||
|
_drawningBulldozer.MoveTransport(DirectionTypeBulldozer.Down);
|
||||||
|
break;
|
||||||
|
case "buttonLeft":
|
||||||
|
_drawningBulldozer.MoveTransport(DirectionTypeBulldozer.Left);
|
||||||
|
break;
|
||||||
|
case "buttonRight":
|
||||||
|
_drawningBulldozer.MoveTransport(DirectionTypeBulldozer.Right);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
private void Buttonstep_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawningBulldozer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (comboBoxStrategy.Enabled)
|
||||||
|
{
|
||||||
|
_abstractStrategy = comboBoxStrategy.SelectedIndex
|
||||||
|
switch
|
||||||
|
{
|
||||||
|
0 => new MoveToCenter(),
|
||||||
|
1 => new MoveToBorder(),
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
if (_abstractStrategy == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_abstractStrategy.SetData(
|
||||||
|
new DrawningObjectBulldozer(_drawningBulldozer),
|
||||||
|
pictureBoxFastBulldozer.Width,
|
||||||
|
pictureBoxFastBulldozer.Height);
|
||||||
|
comboBoxStrategy.Enabled = false;
|
||||||
|
}
|
||||||
|
if (_abstractStrategy == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_abstractStrategy.MakeStep();
|
||||||
|
Draw();
|
||||||
|
if (_abstractStrategy.GetStatus() == Status.Finish)
|
||||||
|
{
|
||||||
|
comboBoxStrategy.Enabled = true;
|
||||||
|
_abstractStrategy = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
32
Bulldozer/Bulldozer/IMoveableObject.cs
Normal file
32
Bulldozer/Bulldozer/IMoveableObject.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Bulldozer.DrawningObjects;
|
||||||
|
|
||||||
|
namespace Bulldozer.MovementStrategy
|
||||||
|
{
|
||||||
|
public interface IMoveableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// получение координаты
|
||||||
|
/// </summary>
|
||||||
|
ObjectParameters? GetObjectPosition { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// шаг
|
||||||
|
/// </summary>
|
||||||
|
int GetStep { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// проверка можно ли инди в этом направлении
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool CheckCanMove(DirectionTypeBulldozer direction);
|
||||||
|
/// <summary>
|
||||||
|
/// изменение напрвления перемещения
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction"></param>
|
||||||
|
void MoveObject(DirectionTypeBulldozer direction);
|
||||||
|
}
|
||||||
|
}
|
42
Bulldozer/Bulldozer/MoveToBorder.cs
Normal file
42
Bulldozer/Bulldozer/MoveToBorder.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Bulldozer.MovementStrategy
|
||||||
|
{
|
||||||
|
internal class MoveToBorder : AbstractStrategy
|
||||||
|
{
|
||||||
|
protected override bool IsTargetDestination()
|
||||||
|
{
|
||||||
|
var objParams = GetObjectParametrs;
|
||||||
|
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 = GetObjectParametrs;
|
||||||
|
if (objParams == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var diffX = objParams.RightBorder - FieldWidth;
|
||||||
|
if (Math.Abs(diffX) > GetStep())
|
||||||
|
{
|
||||||
|
MoveRight();
|
||||||
|
}
|
||||||
|
var diffY = objParams.DownBorder - FieldHeight;
|
||||||
|
if (Math.Abs(diffY) > GetStep())
|
||||||
|
{
|
||||||
|
MoveDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
56
Bulldozer/Bulldozer/MoveToCenter.cs
Normal file
56
Bulldozer/Bulldozer/MoveToCenter.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Bulldozer.MovementStrategy
|
||||||
|
{
|
||||||
|
public class MoveToCenter : AbstractStrategy
|
||||||
|
{
|
||||||
|
protected override bool IsTargetDestination()
|
||||||
|
{
|
||||||
|
var objParams = GetObjectParametrs;
|
||||||
|
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 = GetObjectParametrs;
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
Bulldozer/Bulldozer/ObjectParameters.cs
Normal file
29
Bulldozer/Bulldozer/ObjectParameters.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Bulldozer.MovementStrategy
|
||||||
|
{
|
||||||
|
public class ObjectParameters
|
||||||
|
{
|
||||||
|
private readonly int _x;
|
||||||
|
private readonly int _y;
|
||||||
|
private readonly int _width;
|
||||||
|
private readonly int _height;
|
||||||
|
public int LeftBorder => _x;
|
||||||
|
public int TopBorder => _y;
|
||||||
|
public int RightBorder => _x + _width;
|
||||||
|
public int DownBorder => _y + _height;
|
||||||
|
public int ObjectMiddleHorizontal => _x + _width / 2;
|
||||||
|
public int ObjectMiddleVertical => _y + _height / 2;
|
||||||
|
public ObjectParameters(int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
_x = x;
|
||||||
|
_y = y;
|
||||||
|
_width = width;
|
||||||
|
_height = height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,7 @@ namespace Bulldozer
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new FormBulldozer());
|
Application.Run(new FastBulldozer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
103
Bulldozer/Bulldozer/Properties/Resources.Designer.cs
generated
Normal file
103
Bulldozer/Bulldozer/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Bulldozer.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("Bulldozer_Lab1.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap arrow_down {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("arrow_down", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap arrow_left {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("arrow_left", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap arrow_right {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("arrow_right", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap arrow_up {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("arrow_up", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
133
Bulldozer/Bulldozer/Properties/Resources.resx
Normal file
133
Bulldozer/Bulldozer/Properties/Resources.resx
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?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.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="arrow_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\arrow_down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="arrow_left" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\arrow_left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="arrow_right" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\arrow_right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="arrow_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\arrow_up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
BIN
Bulldozer/Bulldozer/Resources/arrow_down.png
Normal file
BIN
Bulldozer/Bulldozer/Resources/arrow_down.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 264 B |
BIN
Bulldozer/Bulldozer/Resources/arrow_left.png
Normal file
BIN
Bulldozer/Bulldozer/Resources/arrow_left.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 B |
BIN
Bulldozer/Bulldozer/Resources/arrow_right.png
Normal file
BIN
Bulldozer/Bulldozer/Resources/arrow_right.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
Bulldozer/Bulldozer/Resources/arrow_up.png
Normal file
BIN
Bulldozer/Bulldozer/Resources/arrow_up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 294 B |
15
Bulldozer/Bulldozer/Status.cs
Normal file
15
Bulldozer/Bulldozer/Status.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Bulldozer.MovementStrategy
|
||||||
|
{
|
||||||
|
public enum Status
|
||||||
|
{
|
||||||
|
NotInit,
|
||||||
|
InProgress,
|
||||||
|
Finish
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user