Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
f92019e9c6 | |||
5b001c5b2f | |||
2a0e8067f2 |
27
DumpTruck/Direction.cs
Normal file
27
DumpTruck/Direction.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DumpTruck
|
||||||
|
{
|
||||||
|
public enum Direction
|
||||||
|
{
|
||||||
|
/// Вверх
|
||||||
|
/// </summary>
|
||||||
|
Up = 1,
|
||||||
|
/// <summary>
|
||||||
|
/// Вниз
|
||||||
|
/// </summary>
|
||||||
|
Down = 2,
|
||||||
|
/// <summary>
|
||||||
|
/// Влево
|
||||||
|
/// </summary>
|
||||||
|
Left = 3,
|
||||||
|
/// <summary>
|
||||||
|
/// Вправо
|
||||||
|
/// </summary>
|
||||||
|
Right = 4
|
||||||
|
}
|
||||||
|
}
|
53
DumpTruck/DrawingObjects/DrawingDumpTruck.cs
Normal file
53
DumpTruck/DrawingObjects/DrawingDumpTruck.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.NetworkInformation;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using DumpTruck.Entities;
|
||||||
|
|
||||||
|
|
||||||
|
namespace DumpTruck.DrawingObjects
|
||||||
|
{
|
||||||
|
public class DrawingDumpTruck : DrawingTruck
|
||||||
|
{
|
||||||
|
public DrawingDumpTruck(int speed, double weight, Color bodyColor, bool tent, bool dumpBox, Color tentColor, Color dumpBoxColor, int width, int height)
|
||||||
|
: base(speed, weight, bodyColor, width, height, 160, 90)
|
||||||
|
{
|
||||||
|
if (EntityTruck != null)
|
||||||
|
{
|
||||||
|
EntityTruck = new EntityDumpTruck(speed, weight, bodyColor, tent, dumpBox, tentColor, dumpBoxColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public override void DrawTransport(Graphics g)
|
||||||
|
{
|
||||||
|
if (EntityTruck is not EntityDumpTruck dumpTruck)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.DrawTransport(g);
|
||||||
|
|
||||||
|
if (dumpTruck.DumpBox)
|
||||||
|
{
|
||||||
|
Brush brDumpBox = new SolidBrush(dumpTruck.DumpBoxColor);
|
||||||
|
Point point1 = new Point(_startPosX + 20, _startPosY);
|
||||||
|
Point point2 = new Point(_startPosX + 120, _startPosY);
|
||||||
|
Point point3 = new Point(_startPosX + 100, _startPosY + 39);
|
||||||
|
Point point4 = new Point(_startPosX, _startPosY + 39);
|
||||||
|
Point[] dumpBoxPoints = { point1, point2, point3, point4 };
|
||||||
|
g.FillPolygon(brDumpBox, dumpBoxPoints);
|
||||||
|
}
|
||||||
|
if (dumpTruck.DumpBox && dumpTruck.Tent)
|
||||||
|
{
|
||||||
|
Brush brTent = new SolidBrush(dumpTruck.TentColor);
|
||||||
|
Point point1 = new Point(_startPosX + 15, _startPosY);
|
||||||
|
Point point2 = new Point(_startPosX + 120, _startPosY);
|
||||||
|
Point point3 = new Point(_startPosX + 115, _startPosY + 10);
|
||||||
|
Point point4 = new Point(_startPosX + 10, _startPosY + 10);
|
||||||
|
Point[] tentPoints = { point1, point2, point3, point4 };
|
||||||
|
g.FillPolygon(brTent, tentPoints);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
195
DumpTruck/DrawingObjects/DrawingTruck.cs
Normal file
195
DumpTruck/DrawingObjects/DrawingTruck.cs
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using DumpTruck.Entities;
|
||||||
|
using DumpTruck.MovementStrategy;
|
||||||
|
|
||||||
|
namespace DumpTruck.DrawingObjects
|
||||||
|
{
|
||||||
|
public class DrawingTruck
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-сущность
|
||||||
|
/// </summary>
|
||||||
|
public EntityTruck? EntityTruck { get; protected set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина окна
|
||||||
|
/// </summary>
|
||||||
|
private int _pictureWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота окна
|
||||||
|
/// </summary>
|
||||||
|
private int _pictureHeight;
|
||||||
|
/// <summary>
|
||||||
|
/// Левая координата прорисовки грузовика
|
||||||
|
/// </summary>
|
||||||
|
protected int _startPosX;
|
||||||
|
/// <summary>
|
||||||
|
/// Верхняя кооридната прорисовки грузовика
|
||||||
|
/// </summary>
|
||||||
|
protected int _startPosY;
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина прорисовки грузовика
|
||||||
|
/// </summary>
|
||||||
|
protected readonly int _truckWidth = 160;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота прорисовки грузовика
|
||||||
|
/// </summary>
|
||||||
|
protected readonly int _truckHeight = 90;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Координата X объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetPosX => _startPosX;
|
||||||
|
/// <summary>
|
||||||
|
/// Координата Y объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetPosY => _startPosY;
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetWidth => _truckWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота объекта
|
||||||
|
/// </summary>
|
||||||
|
public int GetHeight => _truckHeight;
|
||||||
|
/// <summary>
|
||||||
|
/// Получение объекта IMoveableObject из объекта DrawingTruck
|
||||||
|
/// </summary>
|
||||||
|
public IMoveableObject GetMoveableObject => new DrawningObjectTruck(this);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
/// <param name="width">Ширина картинки</param>
|
||||||
|
/// <param name="height">Высота картинки</param>
|
||||||
|
public DrawingTruck(int speed, double weight, Color bodyColor, int width, int height)
|
||||||
|
{
|
||||||
|
if (width < _truckWidth || height < _truckHeight) return;
|
||||||
|
_pictureWidth = width;
|
||||||
|
_pictureHeight = height;
|
||||||
|
EntityTruck = new EntityTruck(speed, weight, bodyColor);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
/// <param name="width">Ширина картинки</param>
|
||||||
|
/// <param name="height">Высота картинки</param>
|
||||||
|
/// <param name="truckWidth">Ширина прорисовки грузовика</param>
|
||||||
|
/// <param name="truckWidth">Высота прорисовки грузовика</param>
|
||||||
|
protected DrawingTruck(int speed, double weight, Color bodyColor, int width, int height, int truckWidth, int truckHeight)
|
||||||
|
{
|
||||||
|
if (width < truckWidth || height < truckHeight) return;
|
||||||
|
_pictureWidth = width;
|
||||||
|
_pictureHeight = height;
|
||||||
|
_truckWidth = truckWidth;
|
||||||
|
_truckHeight = truckHeight;
|
||||||
|
EntityTruck = new EntityTruck(speed, weight, bodyColor);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Установка позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">Координата X</param>
|
||||||
|
/// <param name="y">Координата Y</param>
|
||||||
|
public void SetPosition(int x, int y)
|
||||||
|
{
|
||||||
|
if (x < 0 || x + _truckWidth > _pictureWidth) x = 0;
|
||||||
|
if (y < 0 || y + _truckHeight > _pictureHeight) y = 0;
|
||||||
|
_startPosX = x;
|
||||||
|
_startPosY = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Проверка, что объект может переместится по указанному направлению
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction">Направление</param>
|
||||||
|
/// <returns>true - можно переместится по указанному направлению</returns>
|
||||||
|
public bool CanMove(Direction direction)
|
||||||
|
{
|
||||||
|
if (EntityTruck == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return direction switch
|
||||||
|
{
|
||||||
|
//влево
|
||||||
|
Direction.Left => _startPosX - EntityTruck.Step > 0,
|
||||||
|
//вверх
|
||||||
|
Direction.Up => _startPosY - EntityTruck.Step > 0,
|
||||||
|
// вправо
|
||||||
|
Direction.Right => _startPosX + _truckWidth + EntityTruck.Step < _pictureWidth,
|
||||||
|
//вниз
|
||||||
|
Direction.Down => _startPosY + _truckHeight + EntityTruck.Step < _pictureHeight,
|
||||||
|
_ => false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Изменение направления перемещения
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction">Направление</param>
|
||||||
|
public void MoveTransport(Direction direction)
|
||||||
|
{
|
||||||
|
if (!CanMove(direction) || EntityTruck == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
//влево
|
||||||
|
case Direction.Left:
|
||||||
|
if (_startPosX - EntityTruck.Step > 0)
|
||||||
|
{
|
||||||
|
_startPosX -= (int)EntityTruck.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//вверх
|
||||||
|
case Direction.Up:
|
||||||
|
if (_startPosY - EntityTruck.Step > 0)
|
||||||
|
{
|
||||||
|
_startPosY -= (int)EntityTruck.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// вправо
|
||||||
|
case Direction.Right:
|
||||||
|
if (_startPosX + _truckWidth + EntityTruck.Step < _pictureWidth)
|
||||||
|
{
|
||||||
|
_startPosX += (int)EntityTruck.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//вниз
|
||||||
|
case Direction.Down:
|
||||||
|
if (_startPosY + _truckHeight + EntityTruck.Step < _pictureHeight)
|
||||||
|
{
|
||||||
|
_startPosY += (int)EntityTruck.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Прорисовка объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
public virtual void DrawTransport(Graphics g)
|
||||||
|
{
|
||||||
|
if (EntityTruck == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Brush brush = new SolidBrush(EntityTruck.BodyColor);
|
||||||
|
g.FillRectangle(brush, _startPosX, _startPosY + 40, 160, 10);
|
||||||
|
g.FillRectangle(brush, _startPosX + 120, _startPosY, 40, 40);
|
||||||
|
g.FillEllipse(brush, _startPosX, _startPosY + 50, 40, 40);
|
||||||
|
g.FillEllipse(brush, _startPosX + 40, _startPosY + 50, 40, 40);
|
||||||
|
g.FillEllipse(brush, _startPosX + 120, _startPosY + 50, 40, 40);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
DumpTruck/DumpTruck.csproj
Normal file
26
DumpTruck/DumpTruck.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>
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.3.32929.385
|
VisualStudioVersion = 17.5.33530.505
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DumpTruck", "DumpTruck\DumpTruck.csproj", "{26796F32-D785-418E-9A6B-E3BAC62BAFEA}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DumpTruck", "DumpTruck.csproj", "{6B4E6B76-8A8E-41F4-8152-149554710311}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -11,15 +11,15 @@ Global
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{26796F32-D785-418E-9A6B-E3BAC62BAFEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{6B4E6B76-8A8E-41F4-8152-149554710311}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{26796F32-D785-418E-9A6B-E3BAC62BAFEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{6B4E6B76-8A8E-41F4-8152-149554710311}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{26796F32-D785-418E-9A6B-E3BAC62BAFEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{6B4E6B76-8A8E-41F4-8152-149554710311}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{26796F32-D785-418E-9A6B-E3BAC62BAFEA}.Release|Any CPU.Build.0 = Release|Any CPU
|
{6B4E6B76-8A8E-41F4-8152-149554710311}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {379CC8BC-ED77-4529-A5E0-2F1171582BE4}
|
SolutionGuid = {E03F6674-51B1-427F-A0F7-7F63C642A734}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
39
DumpTruck/DumpTruck/Form1.Designer.cs
generated
39
DumpTruck/DumpTruck/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
|||||||
namespace DumpTruck
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.components = new System.ComponentModel.Container();
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
|
||||||
this.Text = "Form1";
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace DumpTruck
|
|
||||||
{
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
namespace DumpTruck
|
|
||||||
{
|
|
||||||
internal static class Program
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
|
||||||
static void Main()
|
|
||||||
{
|
|
||||||
// To customize application configuration such as set high DPI settings or default font,
|
|
||||||
// see https://aka.ms/applicationconfiguration.
|
|
||||||
ApplicationConfiguration.Initialize();
|
|
||||||
Application.Run(new Form1());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
46
DumpTruck/Entities/EntityDumpTruck.cs
Normal file
46
DumpTruck/Entities/EntityDumpTruck.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DumpTruck.Entities
|
||||||
|
{
|
||||||
|
public class EntityDumpTruck : EntityTruck
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Признак (опция) наличия тента
|
||||||
|
/// </summary>
|
||||||
|
public bool Tent { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Признак (опция) наличия кузова
|
||||||
|
/// </summary>
|
||||||
|
public bool DumpBox { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Цвет кузова
|
||||||
|
/// </summary>
|
||||||
|
public Color DumpBoxColor { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Цвет тента
|
||||||
|
/// </summary>
|
||||||
|
public Color TentColor { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес самосвала</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет самосвала</param>
|
||||||
|
/// <param name="tent">Признак наличия тента</param>
|
||||||
|
/// <param name="dumpBox">Признак наличия кузова</param>
|
||||||
|
/// <param name="dumpBoxColor">Цвет кузова</param>
|
||||||
|
/// <param name="tentColor">Цвет тента</param>
|
||||||
|
|
||||||
|
public EntityDumpTruck(int speed, double weight, Color bodyColor, bool tent, bool dumpBox, Color tentColor, Color dumpBoxColor) : base(speed, weight, bodyColor)
|
||||||
|
{
|
||||||
|
Tent = tent;
|
||||||
|
DumpBox = dumpBox;
|
||||||
|
DumpBoxColor = dumpBoxColor;
|
||||||
|
TentColor = tentColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
41
DumpTruck/Entities/EntityTruck.cs
Normal file
41
DumpTruck/Entities/EntityTruck.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DumpTruck.Entities
|
||||||
|
{
|
||||||
|
public class EntityTruck
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Скорость
|
||||||
|
/// </summary>
|
||||||
|
public int Speed { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Вес
|
||||||
|
/// </summary>
|
||||||
|
public double Weight { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Основной цвет
|
||||||
|
/// </summary>
|
||||||
|
public Color BodyColor { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг
|
||||||
|
/// </summary>
|
||||||
|
public double Step => (double)Speed * 100 / Weight;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес грузовика</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет грузовика</param>
|
||||||
|
public EntityTruck(int speed, double weight, Color bodyColor)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
BodyColor = bodyColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
192
DumpTruck/FormDumpTruck.Designer.cs
generated
Normal file
192
DumpTruck/FormDumpTruck.Designer.cs
generated
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
namespace DumpTruck
|
||||||
|
{
|
||||||
|
partial class FormDumpTruck
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.pictureBoxDumpTruck = new System.Windows.Forms.PictureBox();
|
||||||
|
this.ButtonCreateDumpTruck = new System.Windows.Forms.Button();
|
||||||
|
this.buttonLeft = new System.Windows.Forms.Button();
|
||||||
|
this.buttonUp = new System.Windows.Forms.Button();
|
||||||
|
this.buttonRight = new System.Windows.Forms.Button();
|
||||||
|
this.buttonDown = new System.Windows.Forms.Button();
|
||||||
|
this.comboBoxStrategy = new System.Windows.Forms.ComboBox();
|
||||||
|
this.ButtonCreateTruck = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonStep = new System.Windows.Forms.Button();
|
||||||
|
this.buttonSelectTruck = new System.Windows.Forms.Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxDumpTruck)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// pictureBoxDumpTruck
|
||||||
|
//
|
||||||
|
this.pictureBoxDumpTruck.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.pictureBoxDumpTruck.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.pictureBoxDumpTruck.Name = "pictureBoxDumpTruck";
|
||||||
|
this.pictureBoxDumpTruck.Size = new System.Drawing.Size(800, 450);
|
||||||
|
this.pictureBoxDumpTruck.TabIndex = 0;
|
||||||
|
this.pictureBoxDumpTruck.TabStop = false;
|
||||||
|
//
|
||||||
|
// ButtonCreateDumpTruck
|
||||||
|
//
|
||||||
|
this.ButtonCreateDumpTruck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.ButtonCreateDumpTruck.Location = new System.Drawing.Point(12, 408);
|
||||||
|
this.ButtonCreateDumpTruck.Name = "ButtonCreateDumpTruck";
|
||||||
|
this.ButtonCreateDumpTruck.Size = new System.Drawing.Size(130, 30);
|
||||||
|
this.ButtonCreateDumpTruck.TabIndex = 1;
|
||||||
|
this.ButtonCreateDumpTruck.Text = "Создать самосвал";
|
||||||
|
this.ButtonCreateDumpTruck.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonCreateDumpTruck.Click += new System.EventHandler(this.ButtonCreateDumpTruck_Click);
|
||||||
|
//
|
||||||
|
// buttonLeft
|
||||||
|
//
|
||||||
|
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.buttonLeft.BackgroundImage = global::DumpTruck.Properties.Resources.left;
|
||||||
|
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||||
|
this.buttonLeft.Location = new System.Drawing.Point(686, 408);
|
||||||
|
this.buttonLeft.Name = "buttonLeft";
|
||||||
|
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
||||||
|
this.buttonLeft.TabIndex = 2;
|
||||||
|
this.buttonLeft.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||||
|
//
|
||||||
|
// buttonUp
|
||||||
|
//
|
||||||
|
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.buttonUp.BackgroundImage = global::DumpTruck.Properties.Resources.up;
|
||||||
|
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||||
|
this.buttonUp.Location = new System.Drawing.Point(722, 372);
|
||||||
|
this.buttonUp.Name = "buttonUp";
|
||||||
|
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
||||||
|
this.buttonUp.TabIndex = 3;
|
||||||
|
this.buttonUp.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonUp.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::DumpTruck.Properties.Resources.right;
|
||||||
|
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||||
|
this.buttonRight.Location = new System.Drawing.Point(758, 408);
|
||||||
|
this.buttonRight.Name = "buttonRight";
|
||||||
|
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
||||||
|
this.buttonRight.TabIndex = 4;
|
||||||
|
this.buttonRight.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonRight.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::DumpTruck.Properties.Resources.down;
|
||||||
|
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||||
|
this.buttonDown.Location = new System.Drawing.Point(722, 408);
|
||||||
|
this.buttonDown.Name = "buttonDown";
|
||||||
|
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
||||||
|
this.buttonDown.TabIndex = 5;
|
||||||
|
this.buttonDown.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonDown.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[] {
|
||||||
|
"0",
|
||||||
|
"1"});
|
||||||
|
this.comboBoxStrategy.Location = new System.Drawing.Point(667, 12);
|
||||||
|
this.comboBoxStrategy.Name = "comboBoxStrategy";
|
||||||
|
this.comboBoxStrategy.Size = new System.Drawing.Size(121, 23);
|
||||||
|
this.comboBoxStrategy.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// ButtonCreateTruck
|
||||||
|
//
|
||||||
|
this.ButtonCreateTruck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.ButtonCreateTruck.Location = new System.Drawing.Point(148, 408);
|
||||||
|
this.ButtonCreateTruck.Name = "ButtonCreateTruck";
|
||||||
|
this.ButtonCreateTruck.Size = new System.Drawing.Size(130, 30);
|
||||||
|
this.ButtonCreateTruck.TabIndex = 7;
|
||||||
|
this.ButtonCreateTruck.Text = "Создать грузовик";
|
||||||
|
this.ButtonCreateTruck.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonCreateTruck.Click += new System.EventHandler(this.ButtonCreateTruck_Click);
|
||||||
|
//
|
||||||
|
// 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(713, 41);
|
||||||
|
this.ButtonStep.Name = "ButtonStep";
|
||||||
|
this.ButtonStep.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.ButtonStep.TabIndex = 8;
|
||||||
|
this.ButtonStep.Text = "Шаг";
|
||||||
|
this.ButtonStep.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonStep.Click += new System.EventHandler(this.ButtonStep_Click);
|
||||||
|
//
|
||||||
|
// buttonSelectTruck
|
||||||
|
//
|
||||||
|
this.buttonSelectTruck.Location = new System.Drawing.Point(284, 408);
|
||||||
|
this.buttonSelectTruck.Name = "buttonSelectTruck";
|
||||||
|
this.buttonSelectTruck.Size = new System.Drawing.Size(75, 30);
|
||||||
|
this.buttonSelectTruck.TabIndex = 9;
|
||||||
|
this.buttonSelectTruck.Text = "Выбрать";
|
||||||
|
this.buttonSelectTruck.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonSelectTruck.Click += new System.EventHandler(this.buttonSelectTruck_Click);
|
||||||
|
//
|
||||||
|
// FormDumpTruck
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.buttonSelectTruck);
|
||||||
|
this.Controls.Add(this.ButtonStep);
|
||||||
|
this.Controls.Add(this.ButtonCreateTruck);
|
||||||
|
this.Controls.Add(this.comboBoxStrategy);
|
||||||
|
this.Controls.Add(this.buttonDown);
|
||||||
|
this.Controls.Add(this.buttonRight);
|
||||||
|
this.Controls.Add(this.buttonUp);
|
||||||
|
this.Controls.Add(this.buttonLeft);
|
||||||
|
this.Controls.Add(this.ButtonCreateDumpTruck);
|
||||||
|
this.Controls.Add(this.pictureBoxDumpTruck);
|
||||||
|
this.Name = "FormDumpTruck";
|
||||||
|
this.Text = "FormDumpTruck";
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxDumpTruck)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private PictureBox pictureBoxDumpTruck;
|
||||||
|
private Button ButtonCreateDumpTruck;
|
||||||
|
private Button buttonLeft;
|
||||||
|
private Button buttonUp;
|
||||||
|
private Button buttonRight;
|
||||||
|
private Button buttonDown;
|
||||||
|
private ComboBox comboBoxStrategy;
|
||||||
|
private Button ButtonCreateTruck;
|
||||||
|
private Button ButtonStep;
|
||||||
|
private Button buttonSelectTruck;
|
||||||
|
}
|
||||||
|
}
|
151
DumpTruck/FormDumpTruck.cs
Normal file
151
DumpTruck/FormDumpTruck.cs
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
using DumpTruck.DrawingObjects;
|
||||||
|
using DumpTruck.MovementStrategy;
|
||||||
|
|
||||||
|
namespace DumpTruck
|
||||||
|
{
|
||||||
|
public partial class FormDumpTruck : Form
|
||||||
|
{
|
||||||
|
private DrawingTruck? _drawingTruck;
|
||||||
|
|
||||||
|
private AbstractStrategy? _strategy;
|
||||||
|
|
||||||
|
public DrawingTruck? SelectedTruck { get; private set; }
|
||||||
|
|
||||||
|
public FormDumpTruck()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_strategy = null;
|
||||||
|
SelectedTruck = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Draw()
|
||||||
|
{
|
||||||
|
if (_drawingTruck == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Bitmap bmp = new(pictureBoxDumpTruck.Width,
|
||||||
|
pictureBoxDumpTruck.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_drawingTruck.DrawTransport(gr);
|
||||||
|
pictureBoxDumpTruck.Image = bmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonMove_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawingTruck == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||||
|
switch (name)
|
||||||
|
{
|
||||||
|
case "buttonUp":
|
||||||
|
_drawingTruck.MoveTransport(Direction.Up);
|
||||||
|
break;
|
||||||
|
case "buttonDown":
|
||||||
|
_drawingTruck.MoveTransport(Direction.Down);
|
||||||
|
break;
|
||||||
|
case "buttonLeft":
|
||||||
|
_drawingTruck.MoveTransport(Direction.Left);
|
||||||
|
break;
|
||||||
|
case "buttonRight":
|
||||||
|
_drawingTruck.MoveTransport(Direction.Right);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCreateDumpTruck_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Random random = new();
|
||||||
|
Color bodyColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
|
ColorDialog dialog = new();
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
bodyColor = dialog.Color;
|
||||||
|
}
|
||||||
|
|
||||||
|
Color dumpBoxColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
|
ColorDialog secondDialog = new();
|
||||||
|
if (secondDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
dumpBoxColor = secondDialog.Color;
|
||||||
|
}
|
||||||
|
|
||||||
|
Color tentColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
|
ColorDialog thirdDialog = new();
|
||||||
|
if (thirdDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
tentColor = thirdDialog.Color;
|
||||||
|
}
|
||||||
|
|
||||||
|
_drawingTruck = new DrawingDumpTruck(random.Next(100, 300), random.Next(1000, 3000),
|
||||||
|
bodyColor,
|
||||||
|
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
|
||||||
|
tentColor,
|
||||||
|
dumpBoxColor,
|
||||||
|
pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height);
|
||||||
|
_drawingTruck.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCreateTruck_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Random random = new();
|
||||||
|
Color bodyColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
|
ColorDialog dialog = new();
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
bodyColor = dialog.Color;
|
||||||
|
}
|
||||||
|
_drawingTruck = new DrawingTruck(random.Next(100, 300), random.Next(1000, 3000), bodyColor,
|
||||||
|
pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height);
|
||||||
|
_drawingTruck.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonStep_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawingTruck == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (comboBoxStrategy.Enabled)
|
||||||
|
{
|
||||||
|
_strategy = comboBoxStrategy.SelectedIndex
|
||||||
|
switch
|
||||||
|
{
|
||||||
|
0 => new MoveToCenter(),
|
||||||
|
1 => new MoveToBorder(),
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
if (_strategy == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_strategy.SetData(new
|
||||||
|
DrawningObjectTruck(_drawingTruck), pictureBoxDumpTruck.Width,
|
||||||
|
pictureBoxDumpTruck.Height);
|
||||||
|
comboBoxStrategy.Enabled = false;
|
||||||
|
}
|
||||||
|
if (_strategy == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_strategy.MakeStep();
|
||||||
|
Draw();
|
||||||
|
if (_strategy.GetStatus() == Status.Finish)
|
||||||
|
{
|
||||||
|
comboBoxStrategy.Enabled = true;
|
||||||
|
_strategy = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSelectTruck_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SelectedTruck = _drawingTruck;
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
DumpTruck/FormDumpTruck.resx
Normal file
60
DumpTruck/FormDumpTruck.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
137
DumpTruck/FormTruckCollection.Designer.cs
generated
Normal file
137
DumpTruck/FormTruckCollection.Designer.cs
generated
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
namespace DumpTruck
|
||||||
|
{
|
||||||
|
partial class FormTruckCollection
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.panelTools = new System.Windows.Forms.Panel();
|
||||||
|
this.buttonRefreshCollection = new System.Windows.Forms.Button();
|
||||||
|
this.labelTools = new System.Windows.Forms.Label();
|
||||||
|
this.buttonRemoveTruck = new System.Windows.Forms.Button();
|
||||||
|
this.buttonAddTruck = new System.Windows.Forms.Button();
|
||||||
|
this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
|
||||||
|
this.maskedTextBoxNumber = new System.Windows.Forms.MaskedTextBox();
|
||||||
|
this.panelTools.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// panelTools
|
||||||
|
//
|
||||||
|
this.panelTools.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.panelTools.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.panelTools.Controls.Add(this.maskedTextBoxNumber);
|
||||||
|
this.panelTools.Controls.Add(this.buttonRefreshCollection);
|
||||||
|
this.panelTools.Controls.Add(this.labelTools);
|
||||||
|
this.panelTools.Controls.Add(this.buttonRemoveTruck);
|
||||||
|
this.panelTools.Controls.Add(this.buttonAddTruck);
|
||||||
|
this.panelTools.Location = new System.Drawing.Point(596, 3);
|
||||||
|
this.panelTools.Name = "panelTools";
|
||||||
|
this.panelTools.Size = new System.Drawing.Size(203, 445);
|
||||||
|
this.panelTools.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonRefreshCollection
|
||||||
|
//
|
||||||
|
this.buttonRefreshCollection.Location = new System.Drawing.Point(25, 168);
|
||||||
|
this.buttonRefreshCollection.Name = "buttonRefreshCollection";
|
||||||
|
this.buttonRefreshCollection.Size = new System.Drawing.Size(150, 30);
|
||||||
|
this.buttonRefreshCollection.TabIndex = 3;
|
||||||
|
this.buttonRefreshCollection.Text = "Обновить коллекцию";
|
||||||
|
this.buttonRefreshCollection.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonRefreshCollection.Click += new System.EventHandler(this.buttonRefreshCollection_Click);
|
||||||
|
//
|
||||||
|
// labelTools
|
||||||
|
//
|
||||||
|
this.labelTools.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||||
|
this.labelTools.AutoSize = true;
|
||||||
|
this.labelTools.Location = new System.Drawing.Point(62, 0);
|
||||||
|
this.labelTools.Name = "labelTools";
|
||||||
|
this.labelTools.Size = new System.Drawing.Size(83, 15);
|
||||||
|
this.labelTools.TabIndex = 0;
|
||||||
|
this.labelTools.Text = "Инструменты";
|
||||||
|
//
|
||||||
|
// buttonRemoveTruck
|
||||||
|
//
|
||||||
|
this.buttonRemoveTruck.Location = new System.Drawing.Point(25, 109);
|
||||||
|
this.buttonRemoveTruck.Name = "buttonRemoveTruck";
|
||||||
|
this.buttonRemoveTruck.Size = new System.Drawing.Size(150, 30);
|
||||||
|
this.buttonRemoveTruck.TabIndex = 2;
|
||||||
|
this.buttonRemoveTruck.Text = "Удалить грузовик";
|
||||||
|
this.buttonRemoveTruck.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonRemoveTruck.Click += new System.EventHandler(this.buttonRemoveTruck_Click);
|
||||||
|
//
|
||||||
|
// buttonAddTruck
|
||||||
|
//
|
||||||
|
this.buttonAddTruck.Location = new System.Drawing.Point(25, 30);
|
||||||
|
this.buttonAddTruck.Name = "buttonAddTruck";
|
||||||
|
this.buttonAddTruck.Size = new System.Drawing.Size(150, 30);
|
||||||
|
this.buttonAddTruck.TabIndex = 1;
|
||||||
|
this.buttonAddTruck.Text = "Добавить грузовик";
|
||||||
|
this.buttonAddTruck.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAddTruck.Click += new System.EventHandler(this.buttonAddTruck_Click);
|
||||||
|
//
|
||||||
|
// pictureBoxCollection
|
||||||
|
//
|
||||||
|
this.pictureBoxCollection.Location = new System.Drawing.Point(2, 3);
|
||||||
|
this.pictureBoxCollection.Name = "pictureBoxCollection";
|
||||||
|
this.pictureBoxCollection.Size = new System.Drawing.Size(588, 445);
|
||||||
|
this.pictureBoxCollection.TabIndex = 1;
|
||||||
|
this.pictureBoxCollection.TabStop = false;
|
||||||
|
//
|
||||||
|
// maskedTextBoxNumber
|
||||||
|
//
|
||||||
|
this.maskedTextBoxNumber.Location = new System.Drawing.Point(25, 75);
|
||||||
|
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||||
|
this.maskedTextBoxNumber.Size = new System.Drawing.Size(150, 23);
|
||||||
|
this.maskedTextBoxNumber.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// FormTruckCollection
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.pictureBoxCollection);
|
||||||
|
this.Controls.Add(this.panelTools);
|
||||||
|
this.Name = "FormTruckCollection";
|
||||||
|
this.Text = "FormTruckCollection";
|
||||||
|
this.panelTools.ResumeLayout(false);
|
||||||
|
this.panelTools.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panelTools;
|
||||||
|
private Button buttonAddTruck;
|
||||||
|
private Label labelTools;
|
||||||
|
private Button buttonRefreshCollection;
|
||||||
|
private Button buttonRemoveTruck;
|
||||||
|
private PictureBox pictureBoxCollection;
|
||||||
|
private MaskedTextBox maskedTextBoxNumber;
|
||||||
|
}
|
||||||
|
}
|
77
DumpTruck/FormTruckCollection.cs
Normal file
77
DumpTruck/FormTruckCollection.cs
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using DumpTruck.Generics;
|
||||||
|
using DumpTruck.DrawingObjects;
|
||||||
|
using DumpTruck.MovementStrategy;
|
||||||
|
|
||||||
|
namespace DumpTruck
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Форма для работы с набором объектов класса DrawingTruck
|
||||||
|
/// </summary>
|
||||||
|
public partial class FormTruckCollection : Form
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Набор объектов
|
||||||
|
/// </summary>
|
||||||
|
private readonly TrucksGenericCollection<DrawingTruck, DrawningObjectTruck> _trucks;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
public FormTruckCollection()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_trucks = new TrucksGenericCollection<DrawingTruck, DrawningObjectTruck>(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAddTruck_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
FormDumpTruck form = new();
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
if (_trucks + form.SelectedTruck != -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект добавлен");
|
||||||
|
pictureBoxCollection.Image = _trucks.ShowTrucks();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonRemoveTruck_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Удалить объект?", "Удаление",
|
||||||
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
||||||
|
if (_trucks - pos)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект удален");
|
||||||
|
pictureBoxCollection.Image = _trucks.ShowTrucks();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось удалить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonRefreshCollection_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
pictureBoxCollection.Image = _trucks.ShowTrucks();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
60
DumpTruck/FormTruckCollection.resx
Normal file
60
DumpTruck/FormTruckCollection.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
92
DumpTruck/Generics/SetGeneric.cs
Normal file
92
DumpTruck/Generics/SetGeneric.cs
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DumpTruck.Generics
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Параметризованный набор объектов
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
internal class SetGeneric<T>
|
||||||
|
where T : class
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Массив объектов, которые храним
|
||||||
|
/// </summary>
|
||||||
|
private readonly T?[] _places;
|
||||||
|
/// <summary>
|
||||||
|
/// Количество объектов в массиве
|
||||||
|
/// </summary>
|
||||||
|
public int Count => _places.Length;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="count"></param>
|
||||||
|
public SetGeneric(int count)
|
||||||
|
{
|
||||||
|
_places = new T?[count];
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление объекта в набор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="truck">Добавляемый грузовик</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int Insert(T truck)
|
||||||
|
{
|
||||||
|
return Insert(truck, 0);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление объекта в набор на конкретную позицию
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="truck">Добавляемый грузовик</param>
|
||||||
|
/// <param name="position">Позиция</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int Insert(T truck, int position)
|
||||||
|
{
|
||||||
|
if (position < 0 || position >= Count) return -1;
|
||||||
|
|
||||||
|
int index = -1;
|
||||||
|
for (int i = position; i < Count; i++)
|
||||||
|
{
|
||||||
|
if (_places[i] == null)
|
||||||
|
{
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index < 0) return -1;
|
||||||
|
|
||||||
|
for (int i = index; i > position; i--)
|
||||||
|
{
|
||||||
|
_places[i] = _places[i - 1];
|
||||||
|
}
|
||||||
|
_places[position] = truck;
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление объекта из набора с конкретной позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool Remove(int position)
|
||||||
|
{
|
||||||
|
if (position < 0 || position >= Count) return false;
|
||||||
|
_places[position] = null;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение объекта из набора по позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public T? Get(int position)
|
||||||
|
{
|
||||||
|
if (position < 0 || position >= Count) return null;
|
||||||
|
return _places[position];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
142
DumpTruck/Generics/TrucksGenericCollection.cs
Normal file
142
DumpTruck/Generics/TrucksGenericCollection.cs
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using DumpTruck.DrawingObjects;
|
||||||
|
using DumpTruck.MovementStrategy;
|
||||||
|
|
||||||
|
namespace DumpTruck.Generics
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Параметризованный класс для набора объектов DrawingTruck
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <typeparam name="U"></typeparam>
|
||||||
|
internal class TrucksGenericCollection<T, U>
|
||||||
|
where T : DrawingTruck
|
||||||
|
where U : IMoveableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина окна прорисовки
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _pictureWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота окна прорисовки
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _pictureHeight;
|
||||||
|
/// <summary>
|
||||||
|
/// Размер занимаемого объектом места (ширина)
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _placeSizeWidth = 180;
|
||||||
|
/// <summary>
|
||||||
|
/// Размер занимаемого объектом места (высота)
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _placeSizeHeight = 100;
|
||||||
|
/// <summary>
|
||||||
|
/// Набор объектов
|
||||||
|
/// </summary>
|
||||||
|
private readonly SetGeneric<T> _collection;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="picWidth"></param>
|
||||||
|
/// <param name="picHeight"></param>
|
||||||
|
public TrucksGenericCollection(int picWidth, int picHeight)
|
||||||
|
{
|
||||||
|
int width = picWidth / _placeSizeWidth;
|
||||||
|
int height = picHeight / _placeSizeHeight;
|
||||||
|
_pictureWidth = picWidth;
|
||||||
|
_pictureHeight = picHeight;
|
||||||
|
_collection = new SetGeneric<T>(width * height);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перегрузка оператора сложения
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="collect"></param>
|
||||||
|
/// <param name="obj"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int operator +(TrucksGenericCollection<T, U> collect, T? obj)
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return collect._collection.Insert(obj);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перегрузка оператора вычитания
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="collect"></param>
|
||||||
|
/// <param name="pos"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool operator -(TrucksGenericCollection<T, U> collect, int pos)
|
||||||
|
{
|
||||||
|
T? obj = collect._collection.Get(pos);
|
||||||
|
if (obj != null)
|
||||||
|
{
|
||||||
|
return collect._collection.Remove(pos);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение объекта IMoveableObject
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pos"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public U? GetU(int pos)
|
||||||
|
{
|
||||||
|
return (U?)_collection.Get(pos)?.GetMoveableObject;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Вывод всего набора объектов
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Bitmap ShowTrucks()
|
||||||
|
{
|
||||||
|
Bitmap bmp = new(_pictureWidth, _pictureHeight);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
DrawBackground(gr);
|
||||||
|
DrawObjects(gr);
|
||||||
|
return bmp;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Метод отрисовки фона
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
private void DrawBackground(Graphics g)
|
||||||
|
{
|
||||||
|
Pen pen = new(Color.Black, 3);
|
||||||
|
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < _pictureHeight / _placeSizeHeight +
|
||||||
|
1; ++j)
|
||||||
|
{//линия рамзетки места
|
||||||
|
g.DrawLine(pen, i * _placeSizeWidth, j *
|
||||||
|
_placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j *
|
||||||
|
_placeSizeHeight);
|
||||||
|
}
|
||||||
|
g.DrawLine(pen, i * _placeSizeWidth, 0, i *
|
||||||
|
_placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Метод прорисовки объектов
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
private void DrawObjects(Graphics g)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _collection.Count; i++)
|
||||||
|
{
|
||||||
|
T? obj = _collection.Get(i);
|
||||||
|
|
||||||
|
if (obj != null)
|
||||||
|
{
|
||||||
|
obj.SetPosition(i % (_pictureWidth / _placeSizeWidth) * _placeSizeWidth, i / (_pictureWidth / _placeSizeWidth) * _placeSizeHeight);
|
||||||
|
obj.DrawTransport(g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
129
DumpTruck/MovementStrategy/AbstractStrategy.cs
Normal file
129
DumpTruck/MovementStrategy/AbstractStrategy.cs
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DumpTruck.MovementStrategy
|
||||||
|
{
|
||||||
|
public abstract class AbstractStrategy
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещаемый объект
|
||||||
|
/// </summary>
|
||||||
|
private IMoveableObject? _moveableObject;
|
||||||
|
/// <summary>
|
||||||
|
/// Статус перемещения
|
||||||
|
/// </summary>
|
||||||
|
private Status _state = Status.NotInit;
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина поля
|
||||||
|
/// </summary>
|
||||||
|
protected int FieldWidth { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Высота поля
|
||||||
|
/// </summary>
|
||||||
|
protected int FieldHeight { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Статус перемещения
|
||||||
|
/// </summary>
|
||||||
|
public Status GetStatus() { return _state; }
|
||||||
|
/// <summary>
|
||||||
|
/// Установка данных
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="moveableObject">Перемещаемый объект</param>
|
||||||
|
/// <param name="width">Ширина поля</param>
|
||||||
|
/// <param name="height">Высота поля</param>
|
||||||
|
public void SetData(IMoveableObject moveableObject, int width, int height)
|
||||||
|
{
|
||||||
|
if (moveableObject == null)
|
||||||
|
{
|
||||||
|
_state = Status.NotInit;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_state = Status.InProgress;
|
||||||
|
_moveableObject = moveableObject;
|
||||||
|
FieldWidth = width;
|
||||||
|
FieldHeight = height;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг перемещения
|
||||||
|
/// </summary>
|
||||||
|
public void MakeStep()
|
||||||
|
{
|
||||||
|
if (_state != Status.InProgress)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (IsTargetDestinaion())
|
||||||
|
{
|
||||||
|
_state = Status.Finish;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveToTarget();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение влево
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
protected bool MoveLeft() => MoveTo(Direction.Left);
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение вправо
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
protected bool MoveRight() => MoveTo(Direction.Right);
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение вверх
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
protected bool MoveUp() => MoveTo(Direction.Up);
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение вниз
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
protected bool MoveDown() => MoveTo(Direction.Down);
|
||||||
|
/// <summary>
|
||||||
|
/// Параметры объекта
|
||||||
|
/// </summary>
|
||||||
|
protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition;
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected int? GetStep()
|
||||||
|
{
|
||||||
|
if (_state != Status.InProgress)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return _moveableObject?.GetStep;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение к цели
|
||||||
|
/// </summary>
|
||||||
|
protected abstract void MoveToTarget();
|
||||||
|
/// <summary>
|
||||||
|
/// Достигнута ли цель
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected abstract bool IsTargetDestinaion();
|
||||||
|
/// <summary>
|
||||||
|
/// Попытка перемещения в требуемом направлении
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="directionType">Направление</param>
|
||||||
|
/// <returns>Результат попытки (true - удалось переместиться, false - неудача)</returns>
|
||||||
|
private bool MoveTo(Direction directionType)
|
||||||
|
{
|
||||||
|
if (_state != Status.InProgress)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (_moveableObject?.CheckCanMove(directionType) ?? false)
|
||||||
|
{
|
||||||
|
_moveableObject.MoveObject(directionType);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
36
DumpTruck/MovementStrategy/DrawningObjectTruck.cs
Normal file
36
DumpTruck/MovementStrategy/DrawningObjectTruck.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using DumpTruck.DrawingObjects;
|
||||||
|
|
||||||
|
namespace DumpTruck.MovementStrategy
|
||||||
|
{
|
||||||
|
public class DrawningObjectTruck : IMoveableObject
|
||||||
|
{
|
||||||
|
private readonly DrawingTruck? _drawingTruck = null;
|
||||||
|
public DrawningObjectTruck(DrawingTruck drawningCar)
|
||||||
|
{
|
||||||
|
_drawingTruck = drawningCar;
|
||||||
|
}
|
||||||
|
public ObjectParameters? GetObjectPosition
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_drawingTruck == null || _drawingTruck.EntityTruck ==
|
||||||
|
null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new ObjectParameters(_drawingTruck.GetPosX,
|
||||||
|
_drawingTruck.GetPosY, _drawingTruck.GetWidth, _drawingTruck.GetHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int GetStep => (int)(_drawingTruck?.EntityTruck?.Step ?? 0);
|
||||||
|
public bool CheckCanMove(Direction direction) =>
|
||||||
|
_drawingTruck?.CanMove(direction) ?? false;
|
||||||
|
public void MoveObject(Direction direction) =>
|
||||||
|
_drawingTruck?.MoveTransport(direction);
|
||||||
|
}
|
||||||
|
}
|
31
DumpTruck/MovementStrategy/IMoveableObject.cs
Normal file
31
DumpTruck/MovementStrategy/IMoveableObject.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DumpTruck.MovementStrategy
|
||||||
|
{
|
||||||
|
public interface IMoveableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Получение координаты X объекта
|
||||||
|
/// </summary>
|
||||||
|
ObjectParameters? GetObjectPosition { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг объекта
|
||||||
|
/// </summary>
|
||||||
|
int GetStep { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Проверка, можно ли переместиться по нужному направлению
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool CheckCanMove(Direction direction);
|
||||||
|
/// <summary>
|
||||||
|
/// Изменение направления пермещения объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction">Направление</param>
|
||||||
|
void MoveObject(Direction direction);
|
||||||
|
}
|
||||||
|
}
|
49
DumpTruck/MovementStrategy/MoveToBorder.cs
Normal file
49
DumpTruck/MovementStrategy/MoveToBorder.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DumpTruck.MovementStrategy
|
||||||
|
{
|
||||||
|
public 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)
|
||||||
|
{
|
||||||
|
MoveRight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var diffY = objParams.ObjectMiddleVertical - FieldHeight;
|
||||||
|
if (Math.Abs(diffY) > GetStep())
|
||||||
|
{
|
||||||
|
if (diffY < 0)
|
||||||
|
{
|
||||||
|
MoveDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
56
DumpTruck/MovementStrategy/MoveToCenter.cs
Normal file
56
DumpTruck/MovementStrategy/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 DumpTruck.MovementStrategy
|
||||||
|
{
|
||||||
|
public class MoveToCenter : AbstractStrategy
|
||||||
|
{
|
||||||
|
protected override bool IsTargetDestinaion()
|
||||||
|
{
|
||||||
|
var objParams = GetObjectParameters;
|
||||||
|
if (objParams == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return objParams.ObjectMiddleHorizontal <= FieldWidth / 2 &&
|
||||||
|
objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
||||||
|
objParams.ObjectMiddleVertical <= FieldHeight / 2 &&
|
||||||
|
objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
||||||
|
}
|
||||||
|
protected override void MoveToTarget()
|
||||||
|
{
|
||||||
|
var objParams = GetObjectParameters;
|
||||||
|
if (objParams == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
|
||||||
|
if (Math.Abs(diffX) > GetStep())
|
||||||
|
{
|
||||||
|
if (diffX > 0)
|
||||||
|
{
|
||||||
|
MoveLeft();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MoveRight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
|
||||||
|
if (Math.Abs(diffY) > GetStep())
|
||||||
|
{
|
||||||
|
if (diffY > 0)
|
||||||
|
{
|
||||||
|
MoveUp();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MoveDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
54
DumpTruck/MovementStrategy/ObjectParameters.cs
Normal file
54
DumpTruck/MovementStrategy/ObjectParameters.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DumpTruck.MovementStrategy
|
||||||
|
{
|
||||||
|
public class ObjectParameters
|
||||||
|
{
|
||||||
|
private readonly int _x;
|
||||||
|
private readonly int _y;
|
||||||
|
private readonly int _width;
|
||||||
|
private readonly int _height;
|
||||||
|
/// <summary>
|
||||||
|
/// Левая граница
|
||||||
|
/// </summary>
|
||||||
|
public int LeftBorder => _x;
|
||||||
|
/// <summary>
|
||||||
|
/// Верхняя граница
|
||||||
|
/// </summary>
|
||||||
|
public int TopBorder => _y;
|
||||||
|
/// <summary>
|
||||||
|
/// Правая граница
|
||||||
|
/// </summary>
|
||||||
|
public int RightBorder => _x + _width;
|
||||||
|
/// <summary>
|
||||||
|
/// Нижняя граница
|
||||||
|
/// </summary>
|
||||||
|
public int DownBorder => _y + _height;
|
||||||
|
/// <summary>
|
||||||
|
/// Середина объекта
|
||||||
|
/// </summary>
|
||||||
|
public int ObjectMiddleHorizontal => _x + _width / 2;
|
||||||
|
/// <summary>
|
||||||
|
/// Середина объекта
|
||||||
|
/// </summary>
|
||||||
|
public int ObjectMiddleVertical => _y + _height / 2;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">Координата X</param>
|
||||||
|
/// <param name="y">Координата Y</param>
|
||||||
|
/// <param name="width">Ширина</param>
|
||||||
|
/// <param name="height">Высота</param>
|
||||||
|
public ObjectParameters(int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
_x = x;
|
||||||
|
_y = y;
|
||||||
|
_width = width;
|
||||||
|
_height = height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
DumpTruck/MovementStrategy/Status.cs
Normal file
15
DumpTruck/MovementStrategy/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 DumpTruck.MovementStrategy
|
||||||
|
{
|
||||||
|
public enum Status
|
||||||
|
{
|
||||||
|
NotInit,
|
||||||
|
InProgress,
|
||||||
|
Finish
|
||||||
|
}
|
||||||
|
}
|
17
DumpTruck/Program.cs
Normal file
17
DumpTruck/Program.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace DumpTruck
|
||||||
|
{
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The main entry point for the application.
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
|
// see https://aka.ms/applicationconfiguration.
|
||||||
|
ApplicationConfiguration.Initialize();
|
||||||
|
Application.Run(new FormTruckCollection());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
103
DumpTruck/Properties/Resources.Designer.cs
generated
Normal file
103
DumpTruck/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace DumpTruck.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("DumpTruck.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 down {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("down", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap left {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("left", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap right {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("right", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap up {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("up", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -117,4 +117,17 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="down" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="left" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="right" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="up" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
BIN
DumpTruck/Resources/down.png
Normal file
BIN
DumpTruck/Resources/down.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
DumpTruck/Resources/left.png
Normal file
BIN
DumpTruck/Resources/left.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
DumpTruck/Resources/right.png
Normal file
BIN
DumpTruck/Resources/right.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
DumpTruck/Resources/up.png
Normal file
BIN
DumpTruck/Resources/up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Loading…
Reference in New Issue
Block a user