Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
54f7347305 | |||
c5c3f60f77 | |||
610b165409 | |||
a4f6cf4be8 |
25
Excavator.sln
Normal file
25
Excavator.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.7.34024.191
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Excavator", "Excavator/Excavator.csproj", "{2AA7FB83-8FC3-451D-B277-158CCA4DAE44}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2AA7FB83-8FC3-451D-B277-158CCA4DAE44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2AA7FB83-8FC3-451D-B277-158CCA4DAE44}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2AA7FB83-8FC3-451D-B277-158CCA4DAE44}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2AA7FB83-8FC3-451D-B277-158CCA4DAE44}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {7F269221-EAB0-4961-A192-4F793DC88242}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
75
Excavator/AbstractStrategy.cs
Normal file
75
Excavator/AbstractStrategy.cs
Normal file
@ -0,0 +1,75 @@
|
||||
using Excavator.MovementStrategy;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
using Excavator.DrawingObjects;
|
||||
|
||||
namespace Excavator.MovementStrategy
|
||||
{
|
||||
public abstract class AbstractStrategy
|
||||
{
|
||||
private IMoveableObject? _moveableObject;
|
||||
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;
|
||||
_moveableObject = moveableObject;
|
||||
FieldWidth = width;
|
||||
FieldHeight = height;
|
||||
}
|
||||
public void MakeStep()
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (IsTargetDestinaion())
|
||||
{
|
||||
_state = Status.Finish;
|
||||
return;
|
||||
}
|
||||
MoveToTarget();
|
||||
}
|
||||
protected bool MoveLeft() => MoveTo(DirectionType.Left);
|
||||
protected bool MoveRight() => MoveTo(DirectionType.Right);
|
||||
protected bool MoveUp() => MoveTo(DirectionType.Up);
|
||||
protected bool MoveDown() => MoveTo(DirectionType.Down);
|
||||
protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition;
|
||||
protected int? GetStep()
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _moveableObject?.GetStep;
|
||||
}
|
||||
protected abstract void MoveToTarget();
|
||||
protected abstract bool IsTargetDestinaion();
|
||||
private bool MoveTo(DirectionType directionType)
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_moveableObject?.CheckCanMove(directionType) ?? false)
|
||||
{
|
||||
_moveableObject.MoveObject(directionType);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
16
Excavator/Direction.cs
Normal file
16
Excavator/Direction.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Excavator
|
||||
{
|
||||
internal enum Direction
|
||||
{
|
||||
Up = 1,
|
||||
Down = 2,
|
||||
Left = 3,
|
||||
Right = 4
|
||||
}
|
||||
}
|
16
Excavator/DirectionType.cs
Normal file
16
Excavator/DirectionType.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Excavator
|
||||
{
|
||||
public enum DirectionType
|
||||
{
|
||||
Up = 1,
|
||||
Down = 2,
|
||||
Left = 3,
|
||||
Right = 4
|
||||
}
|
||||
}
|
137
Excavator/DrawingExc.cs
Normal file
137
Excavator/DrawingExc.cs
Normal file
@ -0,0 +1,137 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Excavator
|
||||
{
|
||||
internal class DrawingExc
|
||||
{
|
||||
public EntityExcavator? EntityExcavator { get; private set; }
|
||||
private int _pictureWidth;
|
||||
private int _pictureHeight;
|
||||
private int _startPosX;
|
||||
private int _startPosY;
|
||||
private readonly int _excWidth = 200;
|
||||
private readonly int _excHeight = 124;
|
||||
public bool Init(EntityExcavator bus, int width, int height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
EntityExcavator = bus;
|
||||
if (_pictureWidth < _excWidth || _pictureHeight < _excHeight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
if (_startPosX + _excWidth > _pictureWidth) {
|
||||
_startPosX = _pictureWidth - _excWidth;
|
||||
}
|
||||
if (_startPosX < 0)
|
||||
{
|
||||
_startPosX = 0;
|
||||
}
|
||||
if (_startPosY + _excHeight > _pictureHeight)
|
||||
{
|
||||
_startPosY = _pictureHeight - _excHeight;
|
||||
}
|
||||
if (_startPosY < 0)
|
||||
{
|
||||
_startPosY = 0;
|
||||
}
|
||||
}
|
||||
public void MoveTransport(Direction direction)
|
||||
{
|
||||
if (EntityExcavator == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
case Direction.Left:
|
||||
if (_startPosX - EntityExcavator.Step > -17)
|
||||
{
|
||||
_startPosX -= (int)EntityExcavator.Step;
|
||||
}
|
||||
break;
|
||||
case Direction.Up:
|
||||
if (_startPosY - EntityExcavator.Step > -35)
|
||||
{
|
||||
_startPosY -= (int)EntityExcavator.Step;
|
||||
}
|
||||
break;
|
||||
case Direction.Right:
|
||||
if (_startPosX + EntityExcavator.Step + _excWidth + 14 < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)EntityExcavator.Step;
|
||||
}
|
||||
break;
|
||||
case Direction.Down:
|
||||
if (_startPosY + EntityExcavator.Step + _excHeight < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)EntityExcavator.Step;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityExcavator == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
Brush additionalBrush = new
|
||||
SolidBrush(EntityExcavator.AdditionalColor);
|
||||
|
||||
g.FillRectangle(additionalBrush, _startPosX + 40, _startPosY + 60, 140, 35); //маленький
|
||||
g.FillRectangle(additionalBrush, _startPosX + 70, _startPosY + 30, 15, 35); //2
|
||||
g.FillRectangle(additionalBrush, _startPosX + 135, _startPosY + 30, 40, 40); //большой прямоугольник 2
|
||||
|
||||
Brush additionalBrush1 = new
|
||||
SolidBrush(EntityExcavator.AdditionalColor);
|
||||
if (EntityExcavator.bucket)
|
||||
{
|
||||
Brush additionalBrush2 = new
|
||||
SolidBrush(EntityExcavator.AdditionalColor);
|
||||
|
||||
g.FillRectangle(additionalBrush, _startPosX + 20, _startPosY + 70, 20, 5);
|
||||
g.FillRectangle(additionalBrush, _startPosX + 10, _startPosY + 65, 15, 50);
|
||||
|
||||
}
|
||||
if (EntityExcavator.Support)
|
||||
{
|
||||
g.FillRectangle(additionalBrush, _startPosX + 170, _startPosY + 75, 35, 5);
|
||||
g.FillRectangle(additionalBrush, _startPosX + 200, _startPosY + 55, 15, 45);
|
||||
g.FillRectangle(additionalBrush, _startPosX + 195, _startPosY + 100, 30, 5);
|
||||
}
|
||||
Brush gr = new SolidBrush(Color.Gray);
|
||||
|
||||
g.FillEllipse(additionalBrush1, _startPosX + 30, _startPosY + 100, 25, 25);
|
||||
g.FillEllipse(additionalBrush1, _startPosX + 155, _startPosY + 100, 25, 25);
|
||||
|
||||
g.FillEllipse(gr, _startPosX + 65, _startPosY + 108, 17, 17);
|
||||
g.FillEllipse(gr, _startPosX + 95, _startPosY + 108, 17, 17);
|
||||
g.FillEllipse(gr, _startPosX + 120, _startPosY + 108, 17, 17);
|
||||
|
||||
g.FillEllipse(gr, _startPosX + 83, _startPosY + 100, 8, 8);
|
||||
g.FillEllipse(gr, _startPosX + 110, _startPosY + 100, 8, 8);
|
||||
|
||||
Pen blackPen = new Pen(Color.Black, 3);
|
||||
Rectangle rect1 = new Rectangle(_startPosX + 25, _startPosY + 97, 30, 30);
|
||||
g.DrawArc(blackPen, rect1, 90, 180);
|
||||
Rectangle rect2 = new Rectangle(_startPosX + 155, _startPosY + 97, 30, 30);
|
||||
g.DrawArc(blackPen, rect2, -90, 180);
|
||||
g.DrawLine(blackPen, _startPosX + 37, _startPosY + 97, _startPosX + 175, _startPosY + 97);
|
||||
g.DrawLine(blackPen, _startPosX + 37, _startPosY + 127, _startPosX + 175, _startPosY + 127);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
49
Excavator/DrawingExcavator.cs
Normal file
49
Excavator/DrawingExcavator.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using Excavator.DrawingObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Excavator.Entities;
|
||||
|
||||
namespace Excavator
|
||||
{
|
||||
public class DrawingExcavator : DrawingMash
|
||||
{
|
||||
public DrawingExcavator(int speed, double weight, Color bodyColor, Color additionalColor, bool Bucket, bool Supports, int width, int height) : base(speed, weight, bodyColor, width, height, 215, 95)
|
||||
{
|
||||
if (EntityMash != null)
|
||||
{
|
||||
EntityMash = new EntityExcavator(speed, weight, bodyColor, additionalColor, Bucket, Supports);
|
||||
}
|
||||
}
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityMash is not EntityExcavator Excavator)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
Pen additionalPen = new(Excavator.AdditionalColor);
|
||||
Brush additionalBrush = new SolidBrush(Excavator.AdditionalColor);
|
||||
base.DrawTransport(g);
|
||||
|
||||
if (Excavator.Bucket)
|
||||
{
|
||||
Brush additionalBrush2 = new
|
||||
SolidBrush(EntityMash.BodyColor);
|
||||
|
||||
g.FillRectangle(additionalBrush, _startPosX + 10, _startPosY + 42, 20, 5);
|
||||
g.FillRectangle(additionalBrush, _startPosX, _startPosY + 37, 15, 50);
|
||||
}
|
||||
|
||||
if (Excavator.Supports)
|
||||
{
|
||||
g.FillRectangle(additionalBrush, _startPosX + 170, _startPosY + 47, 35, 5);
|
||||
g.FillRectangle(additionalBrush, _startPosX + 190, _startPosY + 27, 15, 45);
|
||||
g.FillRectangle(additionalBrush, _startPosX + 185, _startPosY + 72, 30, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
138
Excavator/DrawingMahs.cs
Normal file
138
Excavator/DrawingMahs.cs
Normal file
@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Excavator.Entities;
|
||||
|
||||
namespace Excavator.DrawingObjects
|
||||
{
|
||||
public class DrawingMash
|
||||
{
|
||||
public EntityMash? EntityMash { get; protected set; }
|
||||
public int _pictureWidth;
|
||||
public int _pictureHeight;
|
||||
protected int _startPosX;
|
||||
protected int _startPosY;
|
||||
protected readonly int _mashWidth = 150;
|
||||
protected readonly int _mashHeight = 95;
|
||||
public int GetPosX => _startPosX;
|
||||
public int GetPosY => _startPosY;
|
||||
public int GetWidth => _mashWidth;
|
||||
public int GetHeight => _mashHeight;
|
||||
public DrawingMash(int speed, double weight, Color bodyColor, int width, int height)
|
||||
{
|
||||
if (width < _mashWidth || height < _mashHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
EntityMash = new EntityMash(speed, weight, bodyColor);
|
||||
}
|
||||
protected DrawingMash(int speed, double weight, Color bodyColor, int width, int height, int mashWidth, int mashHeight)
|
||||
{
|
||||
if (width < _mashWidth || height < _mashHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
_mashWidth = mashWidth;
|
||||
_mashHeight = mashHeight;
|
||||
EntityMash = new EntityMash(speed, weight, bodyColor);
|
||||
}
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (x > _pictureWidth || y > _pictureHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
}
|
||||
public void MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (!CanMove(direction) || EntityMash == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
case DirectionType.Left:
|
||||
if (_startPosX - EntityMash.Step > -50)
|
||||
{
|
||||
_startPosX -= (int)EntityMash.Step;
|
||||
}
|
||||
break;
|
||||
case DirectionType.Up:
|
||||
if (_startPosY - EntityMash.Step > -35)
|
||||
{
|
||||
_startPosY -= (int)EntityMash.Step;
|
||||
}
|
||||
break;
|
||||
case DirectionType.Right:
|
||||
if (_startPosX + _mashWidth + EntityMash.Step < _pictureWidth + 14)
|
||||
{
|
||||
_startPosX += (int)EntityMash.Step;
|
||||
}
|
||||
break;
|
||||
case DirectionType.Down:
|
||||
if (_startPosY + _mashHeight + EntityMash.Step < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)EntityMash.Step;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
Pen pen = new(Color.Black);
|
||||
Brush additionalBrush = new
|
||||
SolidBrush(EntityMash.BodyColor);
|
||||
|
||||
g.FillRectangle(additionalBrush, _startPosX + 30, _startPosY + 31, 140, 35);
|
||||
g.FillRectangle(additionalBrush, _startPosX + 60, _startPosY + 2, 15, 35);
|
||||
g.FillRectangle(additionalBrush, _startPosX + 125, _startPosY + 2, 40, 40);
|
||||
|
||||
Brush additionalBrush1 = new
|
||||
SolidBrush(EntityMash.BodyColor);
|
||||
|
||||
Brush gr = new SolidBrush(Color.Gray);
|
||||
|
||||
g.FillEllipse(additionalBrush1, _startPosX + 20, _startPosY + 72, 25, 25);
|
||||
g.FillEllipse(additionalBrush1, _startPosX + 145, _startPosY + 72, 25, 25);
|
||||
|
||||
g.FillEllipse(gr, _startPosX + 55, _startPosY + 81, 17, 17);
|
||||
g.FillEllipse(gr, _startPosX + 85, _startPosY + 81, 17, 17);
|
||||
g.FillEllipse(gr, _startPosX + 110, _startPosY + 81, 17, 17);
|
||||
|
||||
g.FillEllipse(gr, _startPosX + 68, _startPosY + 72, 8, 8);
|
||||
g.FillEllipse(gr, _startPosX + 95, _startPosY + 72, 8, 8);
|
||||
|
||||
Pen blackPen = new Pen(Color.Black, 3);
|
||||
Rectangle rect1 = new Rectangle(_startPosX + 15, _startPosY + 69, 30, 30);
|
||||
g.DrawArc(blackPen, rect1, 90, 180);
|
||||
Rectangle rect2 = new Rectangle(_startPosX + 145, _startPosY + 69, 30, 30);
|
||||
g.DrawArc(blackPen, rect2, -90, 180);
|
||||
g.DrawLine(blackPen, _startPosX + 27, _startPosY + 69, _startPosX + 165, _startPosY + 69);
|
||||
g.DrawLine(blackPen, _startPosX + 27, _startPosY + 99, _startPosX + 165, _startPosY + 99);
|
||||
}
|
||||
public bool CanMove(DirectionType direction)
|
||||
{
|
||||
if (EntityMash == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return direction switch
|
||||
{
|
||||
DirectionType.Left => _startPosX - EntityMash.Step > 0,
|
||||
DirectionType.Up => _startPosY - EntityMash.Step > 0,
|
||||
DirectionType.Right => _startPosX + _mashWidth + EntityMash.Step < _pictureWidth,
|
||||
DirectionType.Down => _startPosY + _mashHeight + EntityMash.Step < _pictureHeight,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
36
Excavator/DrawingObjectMash.cs
Normal file
36
Excavator/DrawingObjectMash.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using Excavator.MovementStrategy;
|
||||
using Excavator;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Excavator.DrawingObjects;
|
||||
namespace Excavator.MovementStrategy
|
||||
{
|
||||
public class DrawingObjectMash : IMoveableObject
|
||||
{
|
||||
|
||||
private readonly DrawingMash? _DrawingMash = null;
|
||||
public DrawingObjectMash(DrawingMash DrawingMash)
|
||||
{
|
||||
_DrawingMash = DrawingMash;
|
||||
}
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_DrawingMash == null || _DrawingMash.EntityMash == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_DrawingMash.GetPosX,_DrawingMash.GetPosY, _DrawingMash.GetWidth, _DrawingMash.GetHeight);
|
||||
}
|
||||
}
|
||||
public int GetStep => (int)(_DrawingMash?.EntityMash?.Step ?? 0);
|
||||
public bool CheckCanMove(DirectionType direction) => _DrawingMash?.CanMove(direction) ?? false;
|
||||
public void MoveObject(DirectionType direction) => _DrawingMash?.MoveTransport(direction);
|
||||
}
|
||||
}
|
22
Excavator/EntityExcavator.cs
Normal file
22
Excavator/EntityExcavator.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Excavator.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Excavator.Entities
|
||||
{
|
||||
public class EntityExcavator : EntityMash
|
||||
{
|
||||
public Color AdditionalColor { get; private set; }
|
||||
public bool Bucket { get; private set; }
|
||||
public bool Supports { get; private set; }
|
||||
public EntityExcavator(int speed, double weight, Color bodyColor, Color additionalColor, bool bucket, bool supports) : base(speed, weight, bodyColor)
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
Bucket = bucket;
|
||||
Supports = supports;
|
||||
}
|
||||
}
|
||||
}
|
22
Excavator/EntityMash.cs
Normal file
22
Excavator/EntityMash.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Excavator.Entities
|
||||
{
|
||||
public class EntityMash
|
||||
{
|
||||
public int Speed { get; private set; }
|
||||
public double Weight { get; private set; }
|
||||
public Color BodyColor { get; private set; }
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
public EntityMash(int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
}
|
||||
}
|
31
Excavator/Excavator.cs
Normal file
31
Excavator/Excavator.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Excavator
|
||||
{
|
||||
public class EntityExcavator
|
||||
{
|
||||
public int Speed { get; private set; }
|
||||
public double Weight { get; private set; }
|
||||
public Color BodyColor { get; private set; }
|
||||
public Color AdditionalColor { get; private set; }
|
||||
public bool Support { get; private set; }
|
||||
public bool bucket { get; private set; }
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
public void Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool support, bool bucket)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalColor;
|
||||
|
||||
Support = support;
|
||||
this.bucket = bucket;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
26
Excavator/Excavator.csproj
Normal file
26
Excavator/Excavator.csproj
Normal file
@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<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>
|
172
Excavator/FormExcavator.Designer.cs
generated
Normal file
172
Excavator/FormExcavator.Designer.cs
generated
Normal file
@ -0,0 +1,172 @@
|
||||
namespace Excavator
|
||||
{
|
||||
partial class FormExcavator
|
||||
{
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
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.pictureBoxExcavator = new System.Windows.Forms.PictureBox();
|
||||
this.buttonCreateExcavator = new System.Windows.Forms.Button();
|
||||
this.buttonUp = new System.Windows.Forms.Button();
|
||||
this.buttonLeft = new System.Windows.Forms.Button();
|
||||
this.buttonDown = new System.Windows.Forms.Button();
|
||||
this.buttonRight = new System.Windows.Forms.Button();
|
||||
this.comboBoxStrategy = new System.Windows.Forms.ComboBox();
|
||||
this.buttonStep = new System.Windows.Forms.Button();
|
||||
this.buttonCreateMash = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxExcavator)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureBoxExcavator
|
||||
//
|
||||
this.pictureBoxExcavator.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictureBoxExcavator.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBoxExcavator.Name = "pictureBoxExcavator";
|
||||
this.pictureBoxExcavator.Size = new System.Drawing.Size(882, 453);
|
||||
this.pictureBoxExcavator.TabIndex = 5;
|
||||
this.pictureBoxExcavator.TabStop = false;
|
||||
//
|
||||
// buttonCreateExcavator
|
||||
//
|
||||
this.buttonCreateExcavator.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.buttonCreateExcavator.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.buttonCreateExcavator.Location = new System.Drawing.Point(11, 365);
|
||||
this.buttonCreateExcavator.Name = "buttonCreateExcavator";
|
||||
this.buttonCreateExcavator.Size = new System.Drawing.Size(120, 73);
|
||||
this.buttonCreateExcavator.TabIndex = 6;
|
||||
this.buttonCreateExcavator.Text = "Создать Экскаватор";
|
||||
this.buttonCreateExcavator.UseVisualStyleBackColor = true;
|
||||
this.buttonCreateExcavator.Click += new System.EventHandler(this.buttonCreateExcavator_Click);
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonUp.BackgroundImage = global::Excavator.Properties.Resources.ArrowUp;
|
||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonUp.Location = new System.Drawing.Point(811, 377);
|
||||
this.buttonUp.Name = "buttonUp";
|
||||
this.buttonUp.Size = new System.Drawing.Size(30, 29);
|
||||
this.buttonUp.TabIndex = 7;
|
||||
this.buttonUp.UseVisualStyleBackColor = true;
|
||||
this.buttonUp.Click += new System.EventHandler(this.buttonMove_Click);
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonLeft.BackgroundImage = global::Excavator.Properties.Resources.ArrowLeft;
|
||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonLeft.Location = new System.Drawing.Point(776, 413);
|
||||
this.buttonLeft.Name = "buttonLeft";
|
||||
this.buttonLeft.Size = new System.Drawing.Size(30, 29);
|
||||
this.buttonLeft.TabIndex = 8;
|
||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
||||
this.buttonLeft.Click += new System.EventHandler(this.buttonMove_Click);
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonDown.BackgroundImage = global::Excavator.Properties.Resources.ArrowDown;
|
||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonDown.Location = new System.Drawing.Point(811, 413);
|
||||
this.buttonDown.Name = "buttonDown";
|
||||
this.buttonDown.Size = new System.Drawing.Size(30, 29);
|
||||
this.buttonDown.TabIndex = 9;
|
||||
this.buttonDown.UseVisualStyleBackColor = true;
|
||||
this.buttonDown.Click += new System.EventHandler(this.buttonMove_Click);
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonRight.BackgroundImage = global::Excavator.Properties.Resources.ArrowRight;
|
||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonRight.Location = new System.Drawing.Point(848, 413);
|
||||
this.buttonRight.Name = "buttonRight";
|
||||
this.buttonRight.Size = new System.Drawing.Size(30, 29);
|
||||
this.buttonRight.TabIndex = 10;
|
||||
this.buttonRight.UseVisualStyleBackColor = true;
|
||||
this.buttonRight.Click += new System.EventHandler(this.buttonMove_Click);
|
||||
//
|
||||
// comboBoxStrategy
|
||||
//
|
||||
this.comboBoxStrategy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.comboBoxStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxStrategy.FormattingEnabled = true;
|
||||
this.comboBoxStrategy.Items.AddRange(new object[] {
|
||||
"В центр",
|
||||
"В правый нижний угол"});
|
||||
this.comboBoxStrategy.Location = new System.Drawing.Point(719, 12);
|
||||
this.comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
this.comboBoxStrategy.Size = new System.Drawing.Size(151, 28);
|
||||
this.comboBoxStrategy.TabIndex = 11;
|
||||
//
|
||||
// buttonStep
|
||||
//
|
||||
this.buttonStep.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonStep.Location = new System.Drawing.Point(747, 45);
|
||||
this.buttonStep.Name = "buttonStep";
|
||||
this.buttonStep.Size = new System.Drawing.Size(94, 29);
|
||||
this.buttonStep.TabIndex = 12;
|
||||
this.buttonStep.Text = "Шаг";
|
||||
this.buttonStep.UseVisualStyleBackColor = true;
|
||||
this.buttonStep.Click += new System.EventHandler(this.buttonStep_Click);
|
||||
//
|
||||
// buttonCreateMash
|
||||
//
|
||||
this.buttonCreateMash.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.buttonCreateMash.Location = new System.Drawing.Point(138, 365);
|
||||
this.buttonCreateMash.Name = "buttonCreateMash";
|
||||
this.buttonCreateMash.Size = new System.Drawing.Size(120, 74);
|
||||
this.buttonCreateMash.TabIndex = 13;
|
||||
this.buttonCreateMash.Text = "Создать Гусеничную машину";
|
||||
this.buttonCreateMash.UseVisualStyleBackColor = true;
|
||||
this.buttonCreateMash.Click += new System.EventHandler(this.buttonCreateMash_Click);
|
||||
//
|
||||
// FormExcavator
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(882, 453);
|
||||
this.Controls.Add(this.buttonCreateMash);
|
||||
this.Controls.Add(this.buttonStep);
|
||||
this.Controls.Add(this.comboBoxStrategy);
|
||||
this.Controls.Add(this.buttonRight);
|
||||
this.Controls.Add(this.buttonDown);
|
||||
this.Controls.Add(this.buttonLeft);
|
||||
this.Controls.Add(this.buttonUp);
|
||||
this.Controls.Add(this.buttonCreateExcavator);
|
||||
this.Controls.Add(this.pictureBoxExcavator);
|
||||
this.Name = "FormExcavator";
|
||||
this.Text = "Excavator";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxExcavator)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxExcavator;
|
||||
private Button buttonCreateExcavator;
|
||||
private Button buttonUp;
|
||||
private Button buttonLeft;
|
||||
private Button buttonDown;
|
||||
private Button buttonRight;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button buttonStep;
|
||||
private Button buttonCreateMash;
|
||||
}
|
||||
}
|
110
Excavator/FormExcavator.cs
Normal file
110
Excavator/FormExcavator.cs
Normal file
@ -0,0 +1,110 @@
|
||||
using Excavator.DrawingObjects;
|
||||
using Excavator.MovementStrategy;
|
||||
|
||||
namespace Excavator
|
||||
{
|
||||
public partial class FormExcavator : Form
|
||||
{
|
||||
private DrawingMash? _DrawingMash;
|
||||
private AbstractStrategy? _abstractStrategy;
|
||||
public FormExcavator()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private void Draw()
|
||||
{
|
||||
if (_DrawingMash == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Bitmap bmp = new(pictureBoxExcavator.Width, pictureBoxExcavator.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_DrawingMash.DrawTransport(gr);
|
||||
pictureBoxExcavator.Image = bmp;
|
||||
}
|
||||
private void buttonCreateExcavator_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_DrawingMash = new DrawingExcavator(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)),
|
||||
true,
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
pictureBoxExcavator.Width, pictureBoxExcavator.Height);
|
||||
_DrawingMash.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
private void buttonCreateMash_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_DrawingMash = new DrawingMash(random.Next(100, 300),
|
||||
random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
||||
random.Next(0, 256)),
|
||||
pictureBoxExcavator.Width, pictureBoxExcavator.Height);
|
||||
_DrawingMash.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
private void buttonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_DrawingMash == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
_DrawingMash.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
_DrawingMash.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
_DrawingMash.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
_DrawingMash.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
private void buttonStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_DrawingMash == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (comboBoxStrategy.Enabled)
|
||||
{
|
||||
_abstractStrategy = comboBoxStrategy.SelectedIndex
|
||||
switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToBorder(),
|
||||
_ => null,
|
||||
};
|
||||
if (_abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.SetData(new DrawingObjectMash(_DrawingMash), pictureBoxExcavator.Width, pictureBoxExcavator.Height);
|
||||
comboBoxStrategy.Enabled = false;
|
||||
}
|
||||
if (_abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.MakeStep();
|
||||
Draw();
|
||||
if (_abstractStrategy.GetStatus() == Status.Finish)
|
||||
{
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_abstractStrategy = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
2757
Excavator/FormExcavator.resx
Normal file
2757
Excavator/FormExcavator.resx
Normal file
File diff suppressed because it is too large
Load Diff
19
Excavator/IMoveableObject.cs
Normal file
19
Excavator/IMoveableObject.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Excavator.DrawingObjects;
|
||||
|
||||
namespace Excavator.MovementStrategy
|
||||
{
|
||||
public interface IMoveableObject
|
||||
{
|
||||
ObjectParameters? GetObjectPosition { get; }
|
||||
int GetStep { get; }
|
||||
bool CheckCanMove(DirectionType direction);
|
||||
void MoveObject(DirectionType direction);
|
||||
}
|
||||
|
||||
}
|
56
Excavator/MoveToBorder.cs
Normal file
56
Excavator/MoveToBorder.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Excavator.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 = objParams.ObjectMiddleHorizontal - FieldWidth;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX > 0)
|
||||
{
|
||||
MoveLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
}
|
||||
var diffY = objParams.ObjectMiddleVertical - FieldHeight;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY > 0)
|
||||
{
|
||||
MoveUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
56
Excavator/MoveToCenter.cs
Normal file
56
Excavator/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 Excavator.MovementStrategy
|
||||
{
|
||||
public class MoveToCenter : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestinaion()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return objParams.ObjectMiddleHorizontal <= FieldWidth / 2 &&
|
||||
objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
||||
objParams.ObjectMiddleVertical <= FieldHeight / 2 &&
|
||||
objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
||||
}
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX > 0)
|
||||
{
|
||||
MoveLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
}
|
||||
var diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY > 0)
|
||||
{
|
||||
MoveUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
29
Excavator/ObjectParameters.cs
Normal file
29
Excavator/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 Excavator.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;
|
||||
}
|
||||
}
|
||||
}
|
14
Excavator/Program.cs
Normal file
14
Excavator/Program.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace Excavator
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new FormExcavator());
|
||||
}
|
||||
}
|
||||
}
|
103
Excavator/Properties/Resources.Designer.cs
generated
Normal file
103
Excavator/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Excavator.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("Excavator.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 ArrowDown {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ArrowDown", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ArrowLeft {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ArrowLeft", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ArrowRight {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ArrowRight", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ArrowUp {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ArrowUp", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
Excavator/Properties/Resources.resx
Normal file
133
Excavator/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="ArrowLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ArrowLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ArrowRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ArrowRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ArrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ArrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ArrowDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ArrowDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
Excavator/Resources/ArrowDown.png
Normal file
BIN
Excavator/Resources/ArrowDown.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
Excavator/Resources/ArrowLeft.png
Normal file
BIN
Excavator/Resources/ArrowLeft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
Excavator/Resources/ArrowRight.png
Normal file
BIN
Excavator/Resources/ArrowRight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
Excavator/Resources/ArrowUp.png
Normal file
BIN
Excavator/Resources/ArrowUp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
15
Excavator/Status.cs
Normal file
15
Excavator/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 Excavator.MovementStrategy
|
||||
{
|
||||
public enum Status
|
||||
{
|
||||
NotInit,
|
||||
InProgress,
|
||||
Finish
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user