Compare commits

...

5 Commits
main ... lab5

37 changed files with 2710 additions and 84 deletions

27
DumpTruck/Direction.cs Normal file
View 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
}
}

View 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);
}
}
}
}

View 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>
public int _pictureWidth;
/// <summary>
/// Высота окна
/// </summary>
public 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 из объекта DrawningCar
/// </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);
}
}
}

View 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>

View File

@ -1,9 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32929.385
VisualStudioVersion = 17.5.33530.505
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
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -11,15 +11,15 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{26796F32-D785-418E-9A6B-E3BAC62BAFEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26796F32-D785-418E-9A6B-E3BAC62BAFEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26796F32-D785-418E-9A6B-E3BAC62BAFEA}.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}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B4E6B76-8A8E-41F4-8152-149554710311}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B4E6B76-8A8E-41F4-8152-149554710311}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6B4E6B76-8A8E-41F4-8152-149554710311}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {379CC8BC-ED77-4529-A5E0-2F1171582BE4}
SolutionGuid = {E03F6674-51B1-427F-A0F7-7F63C642A734}
EndGlobalSection
EndGlobal

View File

@ -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>

View File

@ -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
}
}

View File

@ -1,10 +0,0 @@
namespace DumpTruck
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -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());
}
}
}

View 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; set; }
/// <summary>
/// Цвет тента
/// </summary>
public Color TentColor { get; 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;
}
}
}

View 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; 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
View 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
View 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;
}
}
}

View 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>

211
DumpTruck/FormTruckCollection.Designer.cs generated Normal file
View File

@ -0,0 +1,211 @@
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.panelStorages = new System.Windows.Forms.Panel();
this.labelStorages = new System.Windows.Forms.Label();
this.textBoxStorageName = new System.Windows.Forms.TextBox();
this.buttonDelObject = new System.Windows.Forms.Button();
this.buttonAddObject = new System.Windows.Forms.Button();
this.listBoxStorages = new System.Windows.Forms.ListBox();
this.maskedTextBoxNumber = new System.Windows.Forms.MaskedTextBox();
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.panelTools.SuspendLayout();
this.panelStorages.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.panelStorages);
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;
//
// panelStorages
//
this.panelStorages.Controls.Add(this.labelStorages);
this.panelStorages.Controls.Add(this.textBoxStorageName);
this.panelStorages.Controls.Add(this.buttonDelObject);
this.panelStorages.Controls.Add(this.buttonAddObject);
this.panelStorages.Controls.Add(this.listBoxStorages);
this.panelStorages.Location = new System.Drawing.Point(3, 18);
this.panelStorages.Name = "panelStorages";
this.panelStorages.Size = new System.Drawing.Size(200, 221);
this.panelStorages.TabIndex = 5;
//
// labelStorages
//
this.labelStorages.AutoSize = true;
this.labelStorages.Location = new System.Drawing.Point(25, 0);
this.labelStorages.Name = "labelStorages";
this.labelStorages.Size = new System.Drawing.Size(52, 15);
this.labelStorages.TabIndex = 4;
this.labelStorages.Text = "Наборы";
//
// textBoxStorageName
//
this.textBoxStorageName.Location = new System.Drawing.Point(25, 26);
this.textBoxStorageName.Name = "textBoxStorageName";
this.textBoxStorageName.Size = new System.Drawing.Size(150, 23);
this.textBoxStorageName.TabIndex = 3;
//
// buttonDelObject
//
this.buttonDelObject.Location = new System.Drawing.Point(25, 185);
this.buttonDelObject.Name = "buttonDelObject";
this.buttonDelObject.Size = new System.Drawing.Size(150, 23);
this.buttonDelObject.TabIndex = 2;
this.buttonDelObject.Text = "Удалить набор";
this.buttonDelObject.UseVisualStyleBackColor = true;
this.buttonDelObject.Click += new System.EventHandler(this.buttonDelObject_Click);
//
// buttonAddObject
//
this.buttonAddObject.Location = new System.Drawing.Point(25, 56);
this.buttonAddObject.Name = "buttonAddObject";
this.buttonAddObject.Size = new System.Drawing.Size(150, 23);
this.buttonAddObject.TabIndex = 1;
this.buttonAddObject.Text = "Добавить набор";
this.buttonAddObject.UseVisualStyleBackColor = true;
this.buttonAddObject.Click += new System.EventHandler(this.buttonAddObject_Click);
//
// listBoxStorages
//
this.listBoxStorages.FormattingEnabled = true;
this.listBoxStorages.ItemHeight = 15;
this.listBoxStorages.Location = new System.Drawing.Point(25, 85);
this.listBoxStorages.Name = "listBoxStorages";
this.listBoxStorages.Size = new System.Drawing.Size(150, 94);
this.listBoxStorages.TabIndex = 0;
this.listBoxStorages.SelectedIndexChanged += new System.EventHandler(this.ListBoxObjects_SelectedIndexChanged);
//
// maskedTextBoxNumber
//
this.maskedTextBoxNumber.Location = new System.Drawing.Point(28, 302);
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
this.maskedTextBoxNumber.Size = new System.Drawing.Size(150, 23);
this.maskedTextBoxNumber.TabIndex = 4;
//
// buttonRefreshCollection
//
this.buttonRefreshCollection.Location = new System.Drawing.Point(28, 395);
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(28, 336);
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(28, 257);
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;
//
// 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();
this.panelStorages.ResumeLayout(false);
this.panelStorages.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;
private Panel panelStorages;
private Button buttonDelObject;
private Button buttonAddObject;
private ListBox listBoxStorages;
private Label labelStorages;
private TextBox textBoxStorageName;
}
}

View File

@ -0,0 +1,175 @@
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 TrucksGenericStorage _storage;
/// <summary>
/// Конструктор
/// </summary>
public FormTruckCollection()
{
InitializeComponent();
_storage = new TrucksGenericStorage(pictureBoxCollection.Width, pictureBoxCollection.Height);
}
private void ReloadObjects()
{
int index = listBoxStorages.SelectedIndex;
listBoxStorages.Items.Clear();
for (int i = 0; i < _storage.Keys.Count; i++)
{
listBoxStorages.Items.Add(_storage.Keys[i]);
}
if (listBoxStorages.Items.Count > 0 && (index == -1 || index
>= listBoxStorages.Items.Count))
{
listBoxStorages.SelectedIndex = 0;
}
else if (listBoxStorages.Items.Count > 0 && index > -1 &&
index < listBoxStorages.Items.Count)
{
listBoxStorages.SelectedIndex = index;
}
}
/// <summary>
/// Добавление набора в коллекцию
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonAddObject_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxStorageName.Text))
{
MessageBox.Show("Не все данные заполнены", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_storage.AddSet(textBoxStorageName.Text);
ReloadObjects();
}
/// <summary>
/// Выбор набора
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ListBoxObjects_SelectedIndexChanged(object sender, EventArgs e)
{
pictureBoxCollection.Image = _storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowTrucks();
}
/// <summary>
/// Удаление набора
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonDelObject_Click(object sender, EventArgs e)
{
if (listBoxStorages.SelectedIndex == -1)
{
return;
}
if (MessageBox.Show($"Удалить объект { listBoxStorages.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes)
{
_storage.DelSet(listBoxStorages.SelectedItem.ToString() ?? string.Empty);
ReloadObjects();
}
}
private void AddTruck(DrawingTruck truck)
{
truck._pictureWidth = pictureBoxCollection.Width;
truck._pictureHeight = pictureBoxCollection.Height;
if (listBoxStorages.SelectedIndex == -1)
{
return;
}
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
if (obj == null)
{
return;
}
if (obj + truck != -1)
{
MessageBox.Show("Объект добавлен");
pictureBoxCollection.Image = obj.ShowTrucks();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
}
private void buttonAddTruck_Click(object sender, EventArgs e)
{
if (listBoxStorages.SelectedIndex == -1)
{
return;
}
var formTruckConfig = new FormTruckConfig();
formTruckConfig.AddEvent(AddTruck);
formTruckConfig.Show();
}
private void buttonRemoveTruck_Click(object sender, EventArgs e)
{
if (listBoxStorages.SelectedIndex == -1)
{
return;
}
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
if (obj == null)
{
return;
}
if (MessageBox.Show("Удалить объект?", "Удаление",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return;
}
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
if (obj - pos != null)
{
MessageBox.Show("Объект удален");
pictureBoxCollection.Image = obj.ShowTrucks();
}
else
{
MessageBox.Show("Не удалось удалить объект");
}
}
private void buttonRefreshCollection_Click(object sender, EventArgs e)
{
if (listBoxStorages.SelectedIndex == -1)
{
return;
}
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
if (obj == null)
{
return;
}
pictureBoxCollection.Image = obj.ShowTrucks();
}
}
}

View 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>

405
DumpTruck/FormTruckConfig.Designer.cs generated Normal file
View File

@ -0,0 +1,405 @@
namespace DumpTruck
{
partial class FormTruckConfig
{
/// <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.groupBoxParameters = new System.Windows.Forms.GroupBox();
this.labelModifiedObject = new System.Windows.Forms.Label();
this.labelSimpleObject = new System.Windows.Forms.Label();
this.groupBoxColors = new System.Windows.Forms.GroupBox();
this.panelPurple = new System.Windows.Forms.Panel();
this.panelBlack = new System.Windows.Forms.Panel();
this.panelGray = new System.Windows.Forms.Panel();
this.panelWhite = new System.Windows.Forms.Panel();
this.panelYellow = new System.Windows.Forms.Panel();
this.panelBlue = new System.Windows.Forms.Panel();
this.panelGreen = new System.Windows.Forms.Panel();
this.panelRed = new System.Windows.Forms.Panel();
this.checkBoxTent = new System.Windows.Forms.CheckBox();
this.checkBoxDumpBox = new System.Windows.Forms.CheckBox();
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
this.labelWeight = new System.Windows.Forms.Label();
this.labelSpeed = new System.Windows.Forms.Label();
this.pictureBoxObject = new System.Windows.Forms.PictureBox();
this.PanelObject = new System.Windows.Forms.Panel();
this.labelTentColor = new System.Windows.Forms.Label();
this.labelDumpBoxColor = new System.Windows.Forms.Label();
this.labelBaseColor = new System.Windows.Forms.Label();
this.buttonAdd = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBoxParameters.SuspendLayout();
this.groupBoxColors.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
this.PanelObject.SuspendLayout();
this.SuspendLayout();
//
// groupBoxParameters
//
this.groupBoxParameters.Controls.Add(this.labelModifiedObject);
this.groupBoxParameters.Controls.Add(this.labelSimpleObject);
this.groupBoxParameters.Controls.Add(this.groupBoxColors);
this.groupBoxParameters.Controls.Add(this.checkBoxTent);
this.groupBoxParameters.Controls.Add(this.checkBoxDumpBox);
this.groupBoxParameters.Controls.Add(this.numericUpDownWeight);
this.groupBoxParameters.Controls.Add(this.numericUpDownSpeed);
this.groupBoxParameters.Controls.Add(this.labelWeight);
this.groupBoxParameters.Controls.Add(this.labelSpeed);
this.groupBoxParameters.Location = new System.Drawing.Point(12, 12);
this.groupBoxParameters.Name = "groupBoxParameters";
this.groupBoxParameters.Size = new System.Drawing.Size(463, 246);
this.groupBoxParameters.TabIndex = 0;
this.groupBoxParameters.TabStop = false;
this.groupBoxParameters.Text = "Параметры";
//
// labelModifiedObject
//
this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelModifiedObject.Location = new System.Drawing.Point(335, 158);
this.labelModifiedObject.Name = "labelModifiedObject";
this.labelModifiedObject.Size = new System.Drawing.Size(100, 23);
this.labelModifiedObject.TabIndex = 8;
this.labelModifiedObject.Text = "Продвинутый";
this.labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelModifiedObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
//
// labelSimpleObject
//
this.labelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelSimpleObject.Location = new System.Drawing.Point(229, 158);
this.labelSimpleObject.Name = "labelSimpleObject";
this.labelSimpleObject.Size = new System.Drawing.Size(100, 23);
this.labelSimpleObject.TabIndex = 7;
this.labelSimpleObject.Text = "Простой";
this.labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelSimpleObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
//
// groupBoxColors
//
this.groupBoxColors.Controls.Add(this.panelPurple);
this.groupBoxColors.Controls.Add(this.panelBlack);
this.groupBoxColors.Controls.Add(this.panelGray);
this.groupBoxColors.Controls.Add(this.panelWhite);
this.groupBoxColors.Controls.Add(this.panelYellow);
this.groupBoxColors.Controls.Add(this.panelBlue);
this.groupBoxColors.Controls.Add(this.panelGreen);
this.groupBoxColors.Controls.Add(this.panelRed);
this.groupBoxColors.Location = new System.Drawing.Point(229, 38);
this.groupBoxColors.Name = "groupBoxColors";
this.groupBoxColors.Size = new System.Drawing.Size(206, 100);
this.groupBoxColors.TabIndex = 6;
this.groupBoxColors.TabStop = false;
this.groupBoxColors.Text = "Цвета";
//
// panelPurple
//
this.panelPurple.BackColor = System.Drawing.Color.Purple;
this.panelPurple.Location = new System.Drawing.Point(136, 55);
this.panelPurple.Name = "panelPurple";
this.panelPurple.Size = new System.Drawing.Size(30, 30);
this.panelPurple.TabIndex = 2;
this.panelPurple.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
//
// panelBlack
//
this.panelBlack.BackColor = System.Drawing.Color.Black;
this.panelBlack.Location = new System.Drawing.Point(100, 55);
this.panelBlack.Name = "panelBlack";
this.panelBlack.Size = new System.Drawing.Size(30, 30);
this.panelBlack.TabIndex = 2;
this.panelBlack.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
//
// panelGray
//
this.panelGray.BackColor = System.Drawing.Color.Gray;
this.panelGray.Location = new System.Drawing.Point(64, 55);
this.panelGray.Name = "panelGray";
this.panelGray.Size = new System.Drawing.Size(30, 30);
this.panelGray.TabIndex = 2;
this.panelGray.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
//
// panelWhite
//
this.panelWhite.BackColor = System.Drawing.Color.White;
this.panelWhite.Location = new System.Drawing.Point(28, 55);
this.panelWhite.Name = "panelWhite";
this.panelWhite.Size = new System.Drawing.Size(30, 30);
this.panelWhite.TabIndex = 2;
this.panelWhite.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
//
// panelYellow
//
this.panelYellow.BackColor = System.Drawing.Color.Yellow;
this.panelYellow.Location = new System.Drawing.Point(136, 19);
this.panelYellow.Name = "panelYellow";
this.panelYellow.Size = new System.Drawing.Size(30, 30);
this.panelYellow.TabIndex = 2;
this.panelYellow.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
//
// panelBlue
//
this.panelBlue.BackColor = System.Drawing.Color.Blue;
this.panelBlue.Location = new System.Drawing.Point(100, 19);
this.panelBlue.Name = "panelBlue";
this.panelBlue.Size = new System.Drawing.Size(30, 30);
this.panelBlue.TabIndex = 1;
this.panelBlue.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
//
// panelGreen
//
this.panelGreen.BackColor = System.Drawing.Color.Green;
this.panelGreen.Location = new System.Drawing.Point(64, 19);
this.panelGreen.Name = "panelGreen";
this.panelGreen.Size = new System.Drawing.Size(30, 30);
this.panelGreen.TabIndex = 1;
this.panelGreen.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
//
// panelRed
//
this.panelRed.BackColor = System.Drawing.Color.Red;
this.panelRed.Location = new System.Drawing.Point(28, 19);
this.panelRed.Name = "panelRed";
this.panelRed.Size = new System.Drawing.Size(30, 30);
this.panelRed.TabIndex = 0;
this.panelRed.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
//
// checkBoxTent
//
this.checkBoxTent.AutoSize = true;
this.checkBoxTent.Location = new System.Drawing.Point(23, 158);
this.checkBoxTent.Name = "checkBoxTent";
this.checkBoxTent.Size = new System.Drawing.Size(155, 19);
this.checkBoxTent.TabIndex = 5;
this.checkBoxTent.Text = "Признак наличия тента";
this.checkBoxTent.UseVisualStyleBackColor = true;
//
// checkBoxDumpBox
//
this.checkBoxDumpBox.AutoSize = true;
this.checkBoxDumpBox.Location = new System.Drawing.Point(23, 119);
this.checkBoxDumpBox.Name = "checkBoxDumpBox";
this.checkBoxDumpBox.Size = new System.Drawing.Size(162, 19);
this.checkBoxDumpBox.TabIndex = 4;
this.checkBoxDumpBox.Text = "Признак наличия кузова";
this.checkBoxDumpBox.UseVisualStyleBackColor = true;
//
// numericUpDownWeight
//
this.numericUpDownWeight.Location = new System.Drawing.Point(71, 62);
this.numericUpDownWeight.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.numericUpDownWeight.Minimum = new decimal(new int[] {
100,
0,
0,
0});
this.numericUpDownWeight.Name = "numericUpDownWeight";
this.numericUpDownWeight.Size = new System.Drawing.Size(82, 23);
this.numericUpDownWeight.TabIndex = 3;
this.numericUpDownWeight.Value = new decimal(new int[] {
100,
0,
0,
0});
//
// numericUpDownSpeed
//
this.numericUpDownSpeed.Location = new System.Drawing.Point(71, 19);
this.numericUpDownSpeed.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.numericUpDownSpeed.Minimum = new decimal(new int[] {
100,
0,
0,
0});
this.numericUpDownSpeed.Name = "numericUpDownSpeed";
this.numericUpDownSpeed.Size = new System.Drawing.Size(82, 23);
this.numericUpDownSpeed.TabIndex = 2;
this.numericUpDownSpeed.Value = new decimal(new int[] {
100,
0,
0,
0});
//
// labelWeight
//
this.labelWeight.AutoSize = true;
this.labelWeight.Location = new System.Drawing.Point(6, 64);
this.labelWeight.Name = "labelWeight";
this.labelWeight.Size = new System.Drawing.Size(26, 15);
this.labelWeight.TabIndex = 1;
this.labelWeight.Text = "Вес";
//
// labelSpeed
//
this.labelSpeed.AutoSize = true;
this.labelSpeed.Location = new System.Drawing.Point(6, 19);
this.labelSpeed.Name = "labelSpeed";
this.labelSpeed.Size = new System.Drawing.Size(59, 15);
this.labelSpeed.TabIndex = 0;
this.labelSpeed.Text = "Скорость";
//
// pictureBoxObject
//
this.pictureBoxObject.Location = new System.Drawing.Point(46, 56);
this.pictureBoxObject.Name = "pictureBoxObject";
this.pictureBoxObject.Size = new System.Drawing.Size(226, 131);
this.pictureBoxObject.TabIndex = 1;
this.pictureBoxObject.TabStop = false;
//
// PanelObject
//
this.PanelObject.AllowDrop = true;
this.PanelObject.Controls.Add(this.labelTentColor);
this.PanelObject.Controls.Add(this.labelDumpBoxColor);
this.PanelObject.Controls.Add(this.labelBaseColor);
this.PanelObject.Controls.Add(this.pictureBoxObject);
this.PanelObject.Location = new System.Drawing.Point(481, 12);
this.PanelObject.Name = "PanelObject";
this.PanelObject.Size = new System.Drawing.Size(307, 196);
this.PanelObject.TabIndex = 2;
this.PanelObject.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
this.PanelObject.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
//
// labelTentColor
//
this.labelTentColor.AllowDrop = true;
this.labelTentColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelTentColor.Location = new System.Drawing.Point(202, 13);
this.labelTentColor.Name = "labelTentColor";
this.labelTentColor.Size = new System.Drawing.Size(70, 40);
this.labelTentColor.TabIndex = 4;
this.labelTentColor.Text = "Цвет тента";
this.labelTentColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelTentColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelTentColor_DragDrop);
this.labelTentColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter);
//
// labelDumpBoxColor
//
this.labelDumpBoxColor.AllowDrop = true;
this.labelDumpBoxColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelDumpBoxColor.Location = new System.Drawing.Point(124, 13);
this.labelDumpBoxColor.Name = "labelDumpBoxColor";
this.labelDumpBoxColor.Size = new System.Drawing.Size(70, 40);
this.labelDumpBoxColor.TabIndex = 3;
this.labelDumpBoxColor.Text = "Цвет кузова";
this.labelDumpBoxColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelDumpBoxColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelDumpBoxColor_DragDrop);
this.labelDumpBoxColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter);
//
// labelBaseColor
//
this.labelBaseColor.AllowDrop = true;
this.labelBaseColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelBaseColor.Location = new System.Drawing.Point(46, 13);
this.labelBaseColor.Name = "labelBaseColor";
this.labelBaseColor.Size = new System.Drawing.Size(70, 40);
this.labelBaseColor.TabIndex = 2;
this.labelBaseColor.Text = "Основной цвет";
this.labelBaseColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelBaseColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelBaseColor_DragDrop);
this.labelBaseColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter);
//
// buttonAdd
//
this.buttonAdd.Location = new System.Drawing.Point(527, 221);
this.buttonAdd.Name = "buttonAdd";
this.buttonAdd.Size = new System.Drawing.Size(100, 30);
this.buttonAdd.TabIndex = 0;
this.buttonAdd.Text = "Добавить";
this.buttonAdd.UseVisualStyleBackColor = true;
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
//
// buttonCancel
//
this.buttonCancel.Location = new System.Drawing.Point(653, 221);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(100, 30);
this.buttonCancel.TabIndex = 3;
this.buttonCancel.Text = "Отмена";
this.buttonCancel.UseVisualStyleBackColor = true;
//
// FormTruckConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 271);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonAdd);
this.Controls.Add(this.PanelObject);
this.Controls.Add(this.groupBoxParameters);
this.Name = "FormTruckConfig";
this.Text = "Создание объекта";
this.groupBoxParameters.ResumeLayout(false);
this.groupBoxParameters.PerformLayout();
this.groupBoxColors.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
this.PanelObject.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private GroupBox groupBoxParameters;
private Label labelModifiedObject;
private Label labelSimpleObject;
private GroupBox groupBoxColors;
private Panel panelPurple;
private Panel panelBlack;
private Panel panelGray;
private Panel panelWhite;
private Panel panelYellow;
private Panel panelBlue;
private Panel panelGreen;
private Panel panelRed;
private CheckBox checkBoxTent;
private CheckBox checkBoxDumpBox;
private NumericUpDown numericUpDownWeight;
private NumericUpDown numericUpDownSpeed;
private Label labelWeight;
private Label labelSpeed;
private PictureBox pictureBoxObject;
private Panel PanelObject;
private Label labelDumpBoxColor;
private Label labelBaseColor;
private Button buttonAdd;
private Button buttonCancel;
private Label labelTentColor;
}
}

View File

@ -0,0 +1,177 @@
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.DrawingObjects;
using DumpTruck.Entities;
namespace DumpTruck
{
public partial class FormTruckConfig : Form
{
/// <summary>
/// Переменная-выбранный грузовик
/// </summary>
DrawingTruck? _truck = null;
/// <summary>
/// Событие
/// </summary>
private event Action<DrawingTruck>? EventAddTruck;
/// <summary>
/// Конструктор
/// </summary>
public FormTruckConfig()
{
InitializeComponent();
panelBlack.MouseDown += PanelColor_MouseDown;
panelPurple.MouseDown += PanelColor_MouseDown;
panelGray.MouseDown += PanelColor_MouseDown;
panelGreen.MouseDown += PanelColor_MouseDown;
panelRed.MouseDown += PanelColor_MouseDown;
panelWhite.MouseDown += PanelColor_MouseDown;
panelYellow.MouseDown += PanelColor_MouseDown;
panelBlue.MouseDown += PanelColor_MouseDown;
buttonCancel.Click += (object sender, EventArgs e) => Close();
}
/// <summary>
/// Отрисовать грузовик
/// </summary>
private void DrawTruck()
{
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
Graphics gr = Graphics.FromImage(bmp);
_truck?.SetPosition(5, 5);
_truck?.DrawTransport(gr);
pictureBoxObject.Image = bmp;
}
/// <summary>
/// Добавление события
/// </summary>
/// <param name="ev">Привязанный метод</param>
public void AddEvent(Action<DrawingTruck> ev)
{
if (EventAddTruck == null)
{
EventAddTruck = ev;
}
else
{
EventAddTruck += ev;
}
}
/// <summary>
/// Передаем информацию при нажатии на Label
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
{
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
}
/// <summary>
/// Проверка получаемой информации (ее типа на соответствие требуемому)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PanelObject_DragEnter(object sender, DragEventArgs e)
{
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
/// <summary>
/// Действия при приеме перетаскиваемой информации
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PanelObject_DragDrop(object sender, DragEventArgs e)
{
switch (e.Data?.GetData(DataFormats.Text).ToString())
{
case "labelSimpleObject":
_truck = new DrawingTruck((int)numericUpDownSpeed.Value,
(int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width,
pictureBoxObject.Height);
break;
case "labelModifiedObject":
_truck = new DrawingDumpTruck((int)numericUpDownSpeed.Value,
(int)numericUpDownWeight.Value, Color.White, checkBoxTent.Checked,
checkBoxDumpBox.Checked, Color.Black, Color.Gray, pictureBoxObject.Width,
pictureBoxObject.Height);
break;
}
DrawTruck();
}
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
{
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
}
private void labelColor_DragEnter(object sender, DragEventArgs e)
{
if (e.Data?.GetDataPresent(typeof(Color)) ?? false)
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void labelBaseColor_DragDrop(object sender, DragEventArgs e)
{
if (_truck != null)
{
if (e.Data.GetDataPresent(typeof(Color)))
{
_truck.EntityTruck.BodyColor = (Color)e.Data.GetData(typeof(Color));
}
DrawTruck();
}
}
private void labelDumpBoxColor_DragDrop(object sender, DragEventArgs e)
{
if (_truck != null && _truck.EntityTruck is EntityDumpTruck entityDumpTruck)
{
if (e.Data.GetDataPresent(typeof(Color)))
{
entityDumpTruck.DumpBoxColor = (Color)e.Data.GetData(typeof(Color));
}
DrawTruck();
}
}
private void labelTentColor_DragDrop(object sender, DragEventArgs e)
{
if (_truck != null && _truck.EntityTruck is EntityDumpTruck entityDumpTruck)
{
if (e.Data.GetDataPresent(typeof(Color)))
{
entityDumpTruck.TentColor = (Color)e.Data.GetData(typeof(Color));
}
DrawTruck();
}
}
/// <summary>
/// Добавление грузовика
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonAdd_Click(object sender, EventArgs e)
{
EventAddTruck?.Invoke(_truck);
Close();
}
}
}

View 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>

View File

@ -0,0 +1,106 @@
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 List<T?> _places;
/// <summary>
/// Количество объектов в массиве
/// </summary>
public int Count => _places.Count;
/// <summary>
/// Максимальное количество объектов в списке
/// </summary>
private readonly int _maxCount;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="count"></param>
public SetGeneric(int count)
{
_maxCount = count;
_places = new List<T?>(count);
}
/// <summary>
/// Добавление объекта в набор
/// </summary>
/// <param name="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 || Count >= _maxCount) return -1;
_places.Insert(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.RemoveAt(position);
return true;
}
/// <summary>
/// Получение объекта из набора по позиции
/// </summary>
/// <param name="position"></param>
/// <returns></returns>
public T? this[int position]
{
get
{
if (position < 0 || position >= Count) return null;
return _places[position];
}
set
{
if (position < 0 || position > Count || Count >= _maxCount) return;
_places.Insert(position, value);
}
}
/// <summary>
/// Проход по списку
/// </summary>
/// <returns></returns>
public IEnumerable<T?> GetTrucks(int? maxTrucks = null)
{
for (int i = 0; i < _places.Count; ++i)
{
yield return _places[i];
if (maxTrucks.HasValue && i == maxTrucks.Value)
{
yield break;
}
}
}
}
}

View File

@ -0,0 +1,141 @@
using System;
using System.Collections.Generic;
using System.Linq;
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 T? operator -(TrucksGenericCollection<T, U> collect, int pos)
{
T? obj = collect._collection[pos];
if (obj != null)
{
collect._collection.Remove(pos);
}
return obj;
}
/// <summary>
/// Получение объекта IMoveableObject
/// </summary>
/// <param name="pos"></param>
/// <returns></returns>
public U? GetU(int pos)
{
return (U?)_collection[pos]?.GetMoveableObject;
}
/// <summary>
/// Вывод всего набора объектов
/// </summary>
/// <returns></returns>
public Bitmap 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)
{
int index = 0;
foreach (var truck in _collection.GetTrucks())
{
if (truck != null)
{
truck.SetPosition(index % (_pictureWidth / _placeSizeWidth) * _placeSizeWidth, index / (_pictureWidth / _placeSizeWidth) * _placeSizeHeight);
truck.DrawTransport(g);
}
index++;
}
}
}
}

View File

@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DumpTruck.DrawingObjects;
using DumpTruck.MovementStrategy;
namespace DumpTruck.Generics
{
/// <summary>
/// Класс для хранения коллекции
/// </summary>
internal class TrucksGenericStorage
{
/// <summary>
/// Словарь (хранилище)
/// </summary>
readonly Dictionary<string, TrucksGenericCollection<DrawingTruck, DrawningObjectTruck>> _truckStorages;
/// <summary>
/// Возвращение списка названий наборов
/// </summary>
public List<string> Keys => _truckStorages.Keys.ToList();
/// <summary>
/// Ширина окна отрисовки
/// </summary>
private readonly int _pictureWidth;
/// <summary>
/// Высота окна отрисовки
/// </summary>
private readonly int _pictureHeight;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="pictureWidth"></param>
/// <param name="pictureHeight"></param>
public TrucksGenericStorage(int pictureWidth, int pictureHeight)
{
_truckStorages = new Dictionary<string, TrucksGenericCollection<DrawingTruck, DrawningObjectTruck>>();
_pictureWidth = pictureWidth;
_pictureHeight = pictureHeight;
}
/// <summary>
/// Добавление набора
/// </summary>
/// <param name="name">Название набора</param>
public void AddSet(string name)
{
if (!_truckStorages.ContainsKey(name)) _truckStorages.Add(name, new TrucksGenericCollection<DrawingTruck, DrawningObjectTruck>(_pictureWidth, _pictureHeight));
}
/// <summary>
/// Удаление набора
/// </summary>
/// <param name="name">Название набора</param>
public void DelSet(string name)
{
if (_truckStorages.ContainsKey(name)) _truckStorages.Remove(name);
}
/// <summary>
/// Доступ к набору
/// </summary>
/// <param name="ind"></param>
/// <returns></returns>
public TrucksGenericCollection<DrawingTruck, DrawningObjectTruck>?
this[string ind]
{
get
{
if (_truckStorages.ContainsKey(ind)) return _truckStorages[ind];
return null;
}
}
}
}

View 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;
}
}
}

View 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);
}
}

View 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);
}
}

View 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();
}
}
}
}
}

View 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();
}
}
}
}
}

View 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;
}
}
}

View 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
View 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
View 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));
}
}
}
}

View File

@ -117,4 +117,17 @@
<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="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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
DumpTruck/Resources/up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB