Compare commits
No commits in common. "Lab1" and "main" have entirely different histories.
@ -1,19 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Bulldozer
|
|
||||||
{
|
|
||||||
public enum DirectionTypeBulldozer
|
|
||||||
{
|
|
||||||
Up = 1,
|
|
||||||
|
|
||||||
Down = 2,
|
|
||||||
|
|
||||||
Left = 3,
|
|
||||||
|
|
||||||
Right = 4
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,209 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Bulldozer
|
|
||||||
{
|
|
||||||
public class DrawningBulldozer
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Класс-сущность
|
|
||||||
/// </summary>
|
|
||||||
public EntityBulldozer? EntityBulldozer { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина окна
|
|
||||||
/// </summary>
|
|
||||||
private int _pictureWidth;
|
|
||||||
/// <summary>
|
|
||||||
/// Высота окна
|
|
||||||
/// </summary>
|
|
||||||
private int _pictureHeight;
|
|
||||||
/// <summary>
|
|
||||||
/// Левая координата прорисовки бульдозера
|
|
||||||
/// </summary>
|
|
||||||
private int _startPosX;
|
|
||||||
/// <summary>
|
|
||||||
/// Верхняя кооридната прорисовки бульдозера
|
|
||||||
/// </summary>
|
|
||||||
private int _startPosY;
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина прорисовки бульдозера
|
|
||||||
/// </summary>
|
|
||||||
private readonly int bulldozerWidth = 170;
|
|
||||||
/// <summary>
|
|
||||||
/// Высота прорисовки бульдозера
|
|
||||||
/// </summary>
|
|
||||||
private readonly int bulldozerHeight = 85;
|
|
||||||
/// <summary>
|
|
||||||
/// Инициализация свойств
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="speed">Скорость</param>
|
|
||||||
/// <param name="weight">Вес</param>
|
|
||||||
/// <param name="bulldozerColor">Основной цвет</param>
|
|
||||||
/// <param name="cabinColor">Дополнительный цвет</param>
|
|
||||||
/// <param name="covshColor">Цвет для ковша</param>
|
|
||||||
/// <param name="hasMoldboardfront">Признак наличия переднего ковша</param>
|
|
||||||
/// <param name="hasRipper">Признак наличия заднего ковша</param>
|
|
||||||
/// <param name="width">Ширина картинки</param>
|
|
||||||
/// <param name="height">Высота картинки</param>
|
|
||||||
/// <returns>true - объект создан, false - проверка не пройдена,
|
|
||||||
public bool Init(int speed, double weight, Color bulldozerColor, Color cabinColor, Color covshColor, bool hasMoldboardfront, bool hasRipper, int width, int height)
|
|
||||||
{
|
|
||||||
if (width < _pictureWidth || height < _pictureHeight)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
EntityBulldozer = new EntityBulldozer();
|
|
||||||
EntityBulldozer.Init(speed, weight, bulldozerColor, cabinColor, covshColor, hasMoldboardfront, hasRipper);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Установка позиции
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="x">Координата X</param>
|
|
||||||
/// <param name="y">Координата Y</param>
|
|
||||||
public void SetPosition(int x, int y)
|
|
||||||
{
|
|
||||||
if (x < 0 || y < 0 || x + bulldozerWidth > _pictureWidth || y + bulldozerHeight > _pictureHeight)
|
|
||||||
{
|
|
||||||
x = 10;
|
|
||||||
y = 10;
|
|
||||||
}
|
|
||||||
_startPosX = x;
|
|
||||||
_startPosY = y;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Изменение направления перемещения
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="direction">Направление</param>
|
|
||||||
public void MoveTransport(DirectionTypeBulldozer direction)
|
|
||||||
{
|
|
||||||
if (EntityBulldozer == null)
|
|
||||||
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
//влево
|
|
||||||
case DirectionTypeBulldozer.Left:
|
|
||||||
if (_startPosX - EntityBulldozer.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosX -= (int)EntityBulldozer.Step;
|
|
||||||
}
|
|
||||||
if (_startPosX - EntityBulldozer.Step < 0)
|
|
||||||
{
|
|
||||||
_startPosX -= _startPosX - (int)EntityBulldozer.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
//вверх
|
|
||||||
case DirectionTypeBulldozer.Up:
|
|
||||||
if (_startPosY - EntityBulldozer.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosY -= (int)EntityBulldozer.Step;
|
|
||||||
}
|
|
||||||
else if (_startPosY - EntityBulldozer.Step < 0)
|
|
||||||
{
|
|
||||||
_startPosY -= _startPosY - (int)EntityBulldozer.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// вправо
|
|
||||||
case DirectionTypeBulldozer.Right:
|
|
||||||
if (_startPosX + EntityBulldozer.Step + bulldozerWidth < _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX += (int)EntityBulldozer.Step;
|
|
||||||
}
|
|
||||||
else if (_startPosX + EntityBulldozer.Step + bulldozerWidth > _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX += _pictureWidth - _startPosX - bulldozerWidth;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
//вниз
|
|
||||||
case DirectionTypeBulldozer.Down:
|
|
||||||
if (_startPosY + EntityBulldozer.Step + bulldozerHeight < _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY += (int)EntityBulldozer.Step;
|
|
||||||
}
|
|
||||||
else if (_startPosY + EntityBulldozer.Step + bulldozerHeight > _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY += _pictureHeight - _startPosY - bulldozerHeight;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Прорисовка объекта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="g"></param>
|
|
||||||
public void DrawTransport(Graphics g)
|
|
||||||
{
|
|
||||||
if (EntityBulldozer == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Pen pen = new(Color.Black);
|
|
||||||
Brush additionalBrush = new SolidBrush(EntityBulldozer.CabinColor);
|
|
||||||
|
|
||||||
// Тело трактора
|
|
||||||
Brush bulldozerColor = new SolidBrush(EntityBulldozer.BulldozerColor);
|
|
||||||
g.FillRectangle(bulldozerColor, _startPosX + 25, _startPosY + 20, 110, 30);
|
|
||||||
g.FillRectangle(bulldozerColor, _startPosX + 60, _startPosY, 10, 30);
|
|
||||||
|
|
||||||
int x = _startPosX + 30; // начальная позиция X
|
|
||||||
int y = _startPosY; // начальная позиция Y
|
|
||||||
int width = 110; // ширина прямоугольника
|
|
||||||
int height = 30; // высота прямоугольника
|
|
||||||
int radius = 20; // радиус закругления углов
|
|
||||||
|
|
||||||
// Рисуем закругленный прямоугольник
|
|
||||||
g.DrawArc(pen, x - 5, y + 50, radius * 2, radius * 2, 180, 90); // верхний левый угол
|
|
||||||
g.DrawLine(pen, x + radius - 5, y + 50, x + width - radius - 5, y + 50); // верхняя горизонталь
|
|
||||||
g.DrawArc(pen, x + width - radius * 2 - 5, y + 50, radius * 2, radius * 2, 270, 90); // верхний правый угол
|
|
||||||
g.DrawArc(pen, x + width - radius * 2 - 5, y + height - radius * 2 + 50, radius * 2, radius * 2, 0, 90); // нижний правый угол
|
|
||||||
g.DrawLine(pen, x + width - radius - 5, y + height + 50, x + radius - 5, y + height + 50); // нижняя горизонталь
|
|
||||||
g.DrawArc(pen, x - 5, y + height - radius * 2 + 50, radius * 2, radius * 2, 90, 90); // нижний левый угол
|
|
||||||
|
|
||||||
int wheelRadius = 15;
|
|
||||||
|
|
||||||
// Рисуем колеса трактора
|
|
||||||
g.DrawEllipse(pen, _startPosX + 30, _startPosY + 50, wheelRadius * 2, wheelRadius * 2);
|
|
||||||
g.FillEllipse(additionalBrush, _startPosX + 30, _startPosY + 50, wheelRadius * 2, wheelRadius * 2);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 65, _startPosY + 50, wheelRadius * 2, wheelRadius * 2);
|
|
||||||
g.FillEllipse(additionalBrush, _startPosX + 65, _startPosY + 50, wheelRadius * 2, wheelRadius * 2);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 100, _startPosY + 50, wheelRadius * 2, wheelRadius * 2);
|
|
||||||
g.FillEllipse(additionalBrush, _startPosX + 100, _startPosY + 50, wheelRadius * 2, wheelRadius * 2);
|
|
||||||
|
|
||||||
// Кабина
|
|
||||||
Brush cabinColor = new SolidBrush(EntityBulldozer.CabinColor);
|
|
||||||
g.FillRectangle(cabinColor, _startPosX + 105, _startPosY, 30, 20);
|
|
||||||
|
|
||||||
// Рисуем ковш спереди
|
|
||||||
if (EntityBulldozer.HasMoldboardfront)
|
|
||||||
{
|
|
||||||
Point[] trianglePoints = new Point[]
|
|
||||||
{
|
|
||||||
new Point(_startPosX + 25, _startPosY + 30),
|
|
||||||
new Point(_startPosX + 25, _startPosY + 80),
|
|
||||||
new Point(_startPosX, _startPosY + 80),
|
|
||||||
};
|
|
||||||
g.DrawPolygon(pen, trianglePoints);
|
|
||||||
}
|
|
||||||
// Рисуем ковш сзади
|
|
||||||
if (EntityBulldozer.HasRipper)
|
|
||||||
{
|
|
||||||
Point[] trianglePoints2 = new Point[]
|
|
||||||
{
|
|
||||||
new Point(_startPosX + 130, _startPosY + 50),
|
|
||||||
new Point(_startPosX + 160, _startPosY + 50),
|
|
||||||
new Point(_startPosX + 160, _startPosY + 80)
|
|
||||||
|
|
||||||
};
|
|
||||||
g.DrawPolygon(pen, trianglePoints2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Bulldozer
|
|
||||||
{
|
|
||||||
public class EntityBulldozer
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Скорость
|
|
||||||
/// </summary>
|
|
||||||
public int Speed { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Вес
|
|
||||||
/// </summary>
|
|
||||||
public double Weight { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Основной цвет
|
|
||||||
/// </summary>
|
|
||||||
public Color BulldozerColor { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Дополнительный цвет (для опциональных элементов)
|
|
||||||
/// </summary>
|
|
||||||
public Color CabinColor { get; private set; }
|
|
||||||
public Color CovshColor { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Признак (опция) наличия переднего ковша
|
|
||||||
/// </summary>
|
|
||||||
public bool HasMoldboardfront { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Признак (опция) наличия заднего ковша
|
|
||||||
/// </summary>
|
|
||||||
public bool HasRipper { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Шаг перемещения автомобиля
|
|
||||||
/// </summary>
|
|
||||||
public double Step => (double)Speed * 100 / Weight;
|
|
||||||
/// <summary>
|
|
||||||
/// Инициализация полей объекта-класса спортивного автомобиля
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="speed">Скорость</param>
|
|
||||||
/// <param name="weight">Вес автомобиля</param>
|
|
||||||
/// <param name="bulldozerColor">Основной цвет</param>
|
|
||||||
/// <param name="cabinColor">Дополнительный цвет</param>
|
|
||||||
/// <param name="covshColor">Цвет для ковша</param>
|
|
||||||
/// <param name="hasMoldboardfront">Признак наличия переднего ковша</param>
|
|
||||||
/// <param name="hasRipper">Признак наличия заднего ковша</param>
|
|
||||||
public void Init(int speed, double weight, Color bulldozerColor, Color cabinColor, Color covshColor, bool hasMoldboardfront, bool hasRipper)
|
|
||||||
{
|
|
||||||
Speed = speed;
|
|
||||||
Weight = weight;
|
|
||||||
BulldozerColor = bulldozerColor;
|
|
||||||
CabinColor = cabinColor;
|
|
||||||
CovshColor = covshColor;
|
|
||||||
HasMoldboardfront = hasMoldboardfront;
|
|
||||||
HasRipper = hasRipper;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
45
Bulldozer/Bulldozer/Form1.Designer.cs
generated
Normal file
45
Bulldozer/Bulldozer/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
namespace Bulldozer
|
||||||
|
{
|
||||||
|
partial class FormBulldozer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// FormBulldozer
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Name = "FormBulldozer";
|
||||||
|
Text = "Form1";
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
10
Bulldozer/Bulldozer/Form1.cs
Normal file
10
Bulldozer/Bulldozer/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace Bulldozer
|
||||||
|
{
|
||||||
|
public partial class FormBulldozer : Form
|
||||||
|
{
|
||||||
|
public FormBulldozer()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
136
Bulldozer/Bulldozer/FormBulldozer.Designer.cs
generated
136
Bulldozer/Bulldozer/FormBulldozer.Designer.cs
generated
@ -1,136 +0,0 @@
|
|||||||
namespace Bulldozer
|
|
||||||
{
|
|
||||||
partial class FormBulldozer
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
pictureBoxBulldozer = new PictureBox();
|
|
||||||
ButtonCreateBulldozer = new Button();
|
|
||||||
buttonLeft = new Button();
|
|
||||||
buttonRight = new Button();
|
|
||||||
buttonUp = new Button();
|
|
||||||
buttonDown = new Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxBulldozer).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// pictureBoxBulldozer
|
|
||||||
//
|
|
||||||
pictureBoxBulldozer.Dock = DockStyle.Fill;
|
|
||||||
pictureBoxBulldozer.Location = new Point(0, 0);
|
|
||||||
pictureBoxBulldozer.Name = "pictureBoxBulldozer";
|
|
||||||
pictureBoxBulldozer.Size = new Size(800, 450);
|
|
||||||
pictureBoxBulldozer.SizeMode = PictureBoxSizeMode.AutoSize;
|
|
||||||
pictureBoxBulldozer.TabIndex = 0;
|
|
||||||
pictureBoxBulldozer.TabStop = false;
|
|
||||||
//
|
|
||||||
// ButtonCreateBulldozer
|
|
||||||
//
|
|
||||||
ButtonCreateBulldozer.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
ButtonCreateBulldozer.Location = new Point(54, 396);
|
|
||||||
ButtonCreateBulldozer.Name = "ButtonCreateBulldozer";
|
|
||||||
ButtonCreateBulldozer.Size = new Size(75, 23);
|
|
||||||
ButtonCreateBulldozer.TabIndex = 1;
|
|
||||||
ButtonCreateBulldozer.Text = "Создать";
|
|
||||||
ButtonCreateBulldozer.UseVisualStyleBackColor = true;
|
|
||||||
ButtonCreateBulldozer.Click += ButtonCreateBulldozer_Click;
|
|
||||||
//
|
|
||||||
// buttonLeft
|
|
||||||
//
|
|
||||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
|
||||||
buttonLeft.Location = new Point(660, 373);
|
|
||||||
buttonLeft.Name = "buttonLeft";
|
|
||||||
buttonLeft.Size = new Size(30, 30);
|
|
||||||
buttonLeft.TabIndex = 2;
|
|
||||||
buttonLeft.Text = "<";
|
|
||||||
buttonLeft.UseVisualStyleBackColor = true;
|
|
||||||
buttonLeft.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonRight
|
|
||||||
//
|
|
||||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
|
||||||
buttonRight.Location = new Point(732, 373);
|
|
||||||
buttonRight.Name = "buttonRight";
|
|
||||||
buttonRight.Size = new Size(30, 30);
|
|
||||||
buttonRight.TabIndex = 3;
|
|
||||||
buttonRight.Text = ">";
|
|
||||||
buttonRight.UseVisualStyleBackColor = true;
|
|
||||||
buttonRight.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonUp
|
|
||||||
//
|
|
||||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
|
||||||
buttonUp.Location = new Point(696, 342);
|
|
||||||
buttonUp.Name = "buttonUp";
|
|
||||||
buttonUp.Size = new Size(30, 30);
|
|
||||||
buttonUp.TabIndex = 4;
|
|
||||||
buttonUp.Text = "^";
|
|
||||||
buttonUp.UseVisualStyleBackColor = true;
|
|
||||||
buttonUp.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonDown
|
|
||||||
//
|
|
||||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
|
||||||
buttonDown.Location = new Point(696, 403);
|
|
||||||
buttonDown.Name = "buttonDown";
|
|
||||||
buttonDown.Size = new Size(30, 30);
|
|
||||||
buttonDown.TabIndex = 5;
|
|
||||||
buttonDown.Text = "v";
|
|
||||||
buttonDown.UseVisualStyleBackColor = true;
|
|
||||||
buttonDown.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// FormBulldozer
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(800, 450);
|
|
||||||
Controls.Add(buttonDown);
|
|
||||||
Controls.Add(buttonUp);
|
|
||||||
Controls.Add(buttonRight);
|
|
||||||
Controls.Add(buttonLeft);
|
|
||||||
Controls.Add(ButtonCreateBulldozer);
|
|
||||||
Controls.Add(pictureBoxBulldozer);
|
|
||||||
Name = "FormBulldozer";
|
|
||||||
Text = "Бульдозер";
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxBulldozer).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private PictureBox pictureBoxBulldozer;
|
|
||||||
private Button ButtonCreateBulldozer;
|
|
||||||
private Button buttonLeft;
|
|
||||||
private Button buttonRight;
|
|
||||||
private Button buttonUp;
|
|
||||||
private Button buttonDown;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace Bulldozer
|
|
||||||
{
|
|
||||||
public partial class FormBulldozer : Form
|
|
||||||
{
|
|
||||||
private DrawningBulldozer? _drawningBulldozer;
|
|
||||||
public FormBulldozer()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
private void Draw()
|
|
||||||
{
|
|
||||||
if (_drawningBulldozer == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Bitmap bmp = new(pictureBoxBulldozer.Width,
|
|
||||||
pictureBoxBulldozer.Height);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
_drawningBulldozer.DrawTransport(gr);
|
|
||||||
pictureBoxBulldozer.Image = bmp;
|
|
||||||
}
|
|
||||||
private void ButtonMove_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_drawningBulldozer == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
|
||||||
switch (name)
|
|
||||||
{
|
|
||||||
case "buttonUp":
|
|
||||||
_drawningBulldozer.MoveTransport(DirectionTypeBulldozer.Up);
|
|
||||||
break;
|
|
||||||
case "buttonDown":
|
|
||||||
_drawningBulldozer.MoveTransport(DirectionTypeBulldozer.Down);
|
|
||||||
break;
|
|
||||||
case "buttonLeft":
|
|
||||||
_drawningBulldozer.MoveTransport(DirectionTypeBulldozer.Left);
|
|
||||||
break;
|
|
||||||
case "buttonRight":
|
|
||||||
_drawningBulldozer.MoveTransport(DirectionTypeBulldozer.Right);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCreateBulldozer_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Random random = new();
|
|
||||||
_drawningBulldozer = new DrawningBulldozer();
|
|
||||||
_drawningBulldozer.Init(random.Next(100, 300),
|
|
||||||
random.Next(1000, 3000),
|
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
|
||||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), pictureBoxBulldozer.Width, pictureBoxBulldozer.Height);
|
|
||||||
_drawningBulldozer.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
103
Bulldozer/Bulldozer/Properties/Resources.Designer.cs
generated
103
Bulldozer/Bulldozer/Properties/Resources.Designer.cs
generated
@ -1,103 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программой.
|
|
||||||
// Исполняемая версия:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
|
||||||
// повторной генерации кода.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace Bulldozer.Properties {
|
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
|
||||||
/// </summary>
|
|
||||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
|
||||||
// с помощью такого средства, как ResGen или Visual Studio.
|
|
||||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
|
||||||
// с параметром /str или перестройте свой проект VS.
|
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
||||||
internal class Resources {
|
|
||||||
|
|
||||||
private static global::System.Resources.ResourceManager resourceMan;
|
|
||||||
|
|
||||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
|
||||||
|
|
||||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
|
||||||
internal Resources() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
|
||||||
get {
|
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Bulldozer_Lab1.Properties.Resources", typeof(Resources).Assembly);
|
|
||||||
resourceMan = temp;
|
|
||||||
}
|
|
||||||
return resourceMan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
|
||||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Globalization.CultureInfo Culture {
|
|
||||||
get {
|
|
||||||
return resourceCulture;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
resourceCulture = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap arrow_down {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("arrow_down", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap arrow_left {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("arrow_left", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap arrow_right {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("arrow_right", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap arrow_up {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("arrow_up", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,133 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="arrow_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\arrow_down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="arrow_left" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\arrow_left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="arrow_right" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\arrow_right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="arrow_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\arrow_up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
Binary file not shown.
Before Width: | Height: | Size: 264 B |
Binary file not shown.
Before Width: | Height: | Size: 225 B |
Binary file not shown.
Before Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 294 B |
Loading…
Reference in New Issue
Block a user