ISE_22.Aparyan.Bulldozer.Base Lab04 #4
@ -4,7 +4,7 @@ namespace ProjectBulldozer.Drawning
|
|||||||
public class DrawingBulldozer : DrawingTractor
|
public class DrawingBulldozer : DrawingTractor
|
||||||
{
|
{
|
||||||
public DrawingBulldozer(int speed, double weight, Color bodyColor, Color additionalColor,
|
public DrawingBulldozer(int speed, double weight, Color bodyColor, Color additionalColor,
|
||||||
bool horns, bool seifBatteries, int width, int height) : base(speed, weight, bodyColor, width, height, 140, 130)
|
bool horns, bool seifBatteries, int width, int height) : base(speed, weight, bodyColor, width, height, 120, 110)
|
||||||
{
|
{
|
||||||
if (EntityTractor != null)
|
if (EntityTractor != null)
|
||||||
{
|
{
|
||||||
@ -18,7 +18,6 @@ namespace ProjectBulldozer.Drawning
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pen pen = new(Color.Black);
|
Pen pen = new(Color.Black);
|
||||||
Brush blackBrush = new SolidBrush(Color.Black);
|
Brush blackBrush = new SolidBrush(Color.Black);
|
||||||
Brush windows = new SolidBrush(Color.LightBlue);
|
Brush windows = new SolidBrush(Color.LightBlue);
|
||||||
@ -31,6 +30,8 @@ namespace ProjectBulldozer.Drawning
|
|||||||
new Point(_startPosX + 118, _startPosY + 50),
|
new Point(_startPosX + 118, _startPosY + 50),
|
||||||
new Point(_startPosX + 148, _startPosY + 111),
|
new Point(_startPosX + 148, _startPosY + 111),
|
||||||
new Point(_startPosX+ 118, _startPosY + 111),
|
new Point(_startPosX+ 118, _startPosY + 111),
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
g.FillPolygon(additionalColor, Otval);
|
g.FillPolygon(additionalColor, Otval);
|
||||||
g.DrawPolygon(pen, Otval);
|
g.DrawPolygon(pen, Otval);
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
using System;
|
namespace ProjectBulldozer.Entities
|
||||||
namespace ProjectBulldozer.Entities
|
|
||||||
{
|
{
|
||||||
public class EntityBulldozer : EntityTractor
|
public class EntityBulldozer : EntityTractor
|
||||||
{
|
{
|
||||||
public Color AdditionalColor { get; private set; }
|
public Color AdditionalColor { get; private set; }
|
||||||
public bool Otval { get; private set; }
|
public bool Horns { get; private set; }
|
||||||
public bool SeifBatteries { get; private set; }
|
public bool SeifBatteries { get; private set; }
|
||||||
public EntityBulldozer(int speed, double weight, Color bodyColor, Color additionalColor, bool otval,
|
public EntityBulldozer(int speed, double weight, Color bodyColor, Color additionalColor, bool horns,
|
||||||
bool seifBatteries) : base(speed, weight, bodyColor)
|
bool seifBatteries) : base(speed, weight, bodyColor)
|
||||||
{
|
{
|
||||||
AdditionalColor = additionalColor;
|
AdditionalColor = additionalColor;
|
||||||
Otval = otval;
|
Horns = horns;
|
||||||
SeifBatteries = seifBatteries;
|
SeifBatteries = seifBatteries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
62
ProjectBulldozer/FormBulldozer.Designer.cs
generated
62
ProjectBulldozer/FormBulldozer.Designer.cs
generated
@ -4,6 +4,11 @@ namespace Bulldozer
|
|||||||
partial class FormBulldozer
|
partial class FormBulldozer
|
||||||
{
|
{
|
||||||
private System.ComponentModel.IContainer components = null;
|
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)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing && (components != null))
|
if (disposing && (components != null))
|
||||||
@ -13,8 +18,13 @@ namespace Bulldozer
|
|||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
#region Windows Form Designer generated code
|
#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()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormBulldozer));
|
||||||
pictureBoxBulldozer = new PictureBox();
|
pictureBoxBulldozer = new PictureBox();
|
||||||
buttonCreateBulldozer = new Button();
|
buttonCreateBulldozer = new Button();
|
||||||
buttonLeft = new Button();
|
buttonLeft = new Button();
|
||||||
@ -34,7 +44,7 @@ namespace Bulldozer
|
|||||||
pictureBoxBulldozer.Location = new Point(0, 0);
|
pictureBoxBulldozer.Location = new Point(0, 0);
|
||||||
pictureBoxBulldozer.Margin = new Padding(2);
|
pictureBoxBulldozer.Margin = new Padding(2);
|
||||||
pictureBoxBulldozer.Name = "pictureBoxBulldozer";
|
pictureBoxBulldozer.Name = "pictureBoxBulldozer";
|
||||||
pictureBoxBulldozer.Size = new Size(870, 390);
|
pictureBoxBulldozer.Size = new Size(870, 572);
|
||||||
pictureBoxBulldozer.SizeMode = PictureBoxSizeMode.AutoSize;
|
pictureBoxBulldozer.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||||
pictureBoxBulldozer.TabIndex = 0;
|
pictureBoxBulldozer.TabIndex = 0;
|
||||||
pictureBoxBulldozer.TabStop = false;
|
pictureBoxBulldozer.TabStop = false;
|
||||||
@ -42,24 +52,24 @@ namespace Bulldozer
|
|||||||
// buttonCreateBulldozer
|
// buttonCreateBulldozer
|
||||||
//
|
//
|
||||||
buttonCreateBulldozer.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
buttonCreateBulldozer.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
buttonCreateBulldozer.Location = new Point(11, 332);
|
buttonCreateBulldozer.Location = new Point(20, 514);
|
||||||
buttonCreateBulldozer.Margin = new Padding(2);
|
buttonCreateBulldozer.Margin = new Padding(2);
|
||||||
buttonCreateBulldozer.Name = "buttonCreateBulldozer";
|
buttonCreateBulldozer.Name = "buttonCreateBulldozer";
|
||||||
buttonCreateBulldozer.Size = new Size(95, 48);
|
buttonCreateBulldozer.Size = new Size(88, 48);
|
||||||
buttonCreateBulldozer.TabIndex = 1;
|
buttonCreateBulldozer.TabIndex = 1;
|
||||||
buttonCreateBulldozer.Text = "Создать булльдозер";
|
buttonCreateBulldozer.Text = "Создать бульдозер";
|
||||||
buttonCreateBulldozer.UseVisualStyleBackColor = true;
|
buttonCreateBulldozer.UseVisualStyleBackColor = true;
|
||||||
buttonCreateBulldozer.Click += buttonCreateBulldozer_Click;
|
buttonCreateBulldozer.Click += buttonCreateBulldozer_Click;
|
||||||
//
|
//
|
||||||
// buttonLeft
|
// buttonLeft
|
||||||
//
|
//
|
||||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
buttonLeft.BackgroundImage = ProjectBulldozer.Properties.Resources.left1;
|
buttonLeft.BackgroundImage = (Image)resources.GetObject("buttonLeft.BackgroundImage");
|
||||||
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonLeft.Location = new Point(767, 353);
|
buttonLeft.Location = new Point(732, 522);
|
||||||
buttonLeft.Margin = new Padding(2);
|
buttonLeft.Margin = new Padding(2);
|
||||||
buttonLeft.Name = "buttonLeft";
|
buttonLeft.Name = "buttonLeft";
|
||||||
buttonLeft.Size = new Size(30, 27);
|
buttonLeft.Size = new Size(40, 33);
|
||||||
buttonLeft.TabIndex = 2;
|
buttonLeft.TabIndex = 2;
|
||||||
buttonLeft.UseVisualStyleBackColor = true;
|
buttonLeft.UseVisualStyleBackColor = true;
|
||||||
buttonLeft.Click += buttonMove_Click;
|
buttonLeft.Click += buttonMove_Click;
|
||||||
@ -67,12 +77,12 @@ namespace Bulldozer
|
|||||||
// buttonUp
|
// buttonUp
|
||||||
//
|
//
|
||||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
buttonUp.BackgroundImage = ProjectBulldozer.Properties.Resources.up1;
|
buttonUp.BackgroundImage = (Image)resources.GetObject("buttonUp.BackgroundImage");
|
||||||
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonUp.Location = new Point(801, 320);
|
buttonUp.Location = new Point(776, 485);
|
||||||
buttonUp.Margin = new Padding(2);
|
buttonUp.Margin = new Padding(2);
|
||||||
buttonUp.Name = "buttonUp";
|
buttonUp.Name = "buttonUp";
|
||||||
buttonUp.Size = new Size(34, 28);
|
buttonUp.Size = new Size(40, 33);
|
||||||
buttonUp.TabIndex = 3;
|
buttonUp.TabIndex = 3;
|
||||||
buttonUp.UseVisualStyleBackColor = true;
|
buttonUp.UseVisualStyleBackColor = true;
|
||||||
buttonUp.Click += buttonMove_Click;
|
buttonUp.Click += buttonMove_Click;
|
||||||
@ -80,12 +90,12 @@ namespace Bulldozer
|
|||||||
// buttonRight
|
// buttonRight
|
||||||
//
|
//
|
||||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
buttonRight.BackgroundImage = ProjectBulldozer.Properties.Resources.right1;
|
buttonRight.BackgroundImage = (Image)resources.GetObject("buttonRight.BackgroundImage");
|
||||||
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonRight.Location = new Point(837, 353);
|
buttonRight.Location = new Point(819, 522);
|
||||||
buttonRight.Margin = new Padding(2);
|
buttonRight.Margin = new Padding(2);
|
||||||
buttonRight.Name = "buttonRight";
|
buttonRight.Name = "buttonRight";
|
||||||
buttonRight.Size = new Size(28, 26);
|
buttonRight.Size = new Size(40, 33);
|
||||||
buttonRight.TabIndex = 4;
|
buttonRight.TabIndex = 4;
|
||||||
buttonRight.UseVisualStyleBackColor = true;
|
buttonRight.UseVisualStyleBackColor = true;
|
||||||
buttonRight.Click += buttonMove_Click;
|
buttonRight.Click += buttonMove_Click;
|
||||||
@ -93,12 +103,12 @@ namespace Bulldozer
|
|||||||
// buttonDown
|
// buttonDown
|
||||||
//
|
//
|
||||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
buttonDown.BackgroundImage = ProjectBulldozer.Properties.Resources.down1;
|
buttonDown.BackgroundImage = (Image)resources.GetObject("buttonDown.BackgroundImage");
|
||||||
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonDown.Location = new Point(801, 353);
|
buttonDown.Location = new Point(776, 522);
|
||||||
buttonDown.Margin = new Padding(2);
|
buttonDown.Margin = new Padding(2);
|
||||||
buttonDown.Name = "buttonDown";
|
buttonDown.Name = "buttonDown";
|
||||||
buttonDown.Size = new Size(32, 27);
|
buttonDown.Size = new Size(40, 33);
|
||||||
buttonDown.TabIndex = 5;
|
buttonDown.TabIndex = 5;
|
||||||
buttonDown.UseVisualStyleBackColor = true;
|
buttonDown.UseVisualStyleBackColor = true;
|
||||||
buttonDown.Click += buttonMove_Click;
|
buttonDown.Click += buttonMove_Click;
|
||||||
@ -108,7 +118,7 @@ namespace Bulldozer
|
|||||||
comboBoxStrategy.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
comboBoxStrategy.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
comboBoxStrategy.FormattingEnabled = true;
|
comboBoxStrategy.FormattingEnabled = true;
|
||||||
comboBoxStrategy.Items.AddRange(new object[] { "К центру", "В угол" });
|
comboBoxStrategy.Items.AddRange(new object[] { "В центр", "В угол" });
|
||||||
comboBoxStrategy.Location = new Point(740, 8);
|
comboBoxStrategy.Location = new Point(740, 8);
|
||||||
comboBoxStrategy.Margin = new Padding(2);
|
comboBoxStrategy.Margin = new Padding(2);
|
||||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||||
@ -119,10 +129,10 @@ namespace Bulldozer
|
|||||||
// buttonCreateTractor
|
// buttonCreateTractor
|
||||||
//
|
//
|
||||||
buttonCreateTractor.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
buttonCreateTractor.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
buttonCreateTractor.Location = new Point(122, 332);
|
buttonCreateTractor.Location = new Point(122, 514);
|
||||||
buttonCreateTractor.Margin = new Padding(2);
|
buttonCreateTractor.Margin = new Padding(2);
|
||||||
buttonCreateTractor.Name = "buttonCreateTractor";
|
buttonCreateTractor.Name = "buttonCreateTractor";
|
||||||
buttonCreateTractor.Size = new Size(81, 47);
|
buttonCreateTractor.Size = new Size(88, 48);
|
||||||
buttonCreateTractor.TabIndex = 7;
|
buttonCreateTractor.TabIndex = 7;
|
||||||
buttonCreateTractor.Text = "Создать трактор";
|
buttonCreateTractor.Text = "Создать трактор";
|
||||||
buttonCreateTractor.UseVisualStyleBackColor = true;
|
buttonCreateTractor.UseVisualStyleBackColor = true;
|
||||||
@ -134,7 +144,7 @@ namespace Bulldozer
|
|||||||
buttonStep.Location = new Point(755, 39);
|
buttonStep.Location = new Point(755, 39);
|
||||||
buttonStep.Margin = new Padding(2);
|
buttonStep.Margin = new Padding(2);
|
||||||
buttonStep.Name = "buttonStep";
|
buttonStep.Name = "buttonStep";
|
||||||
buttonStep.Size = new Size(88, 20);
|
buttonStep.Size = new Size(88, 28);
|
||||||
buttonStep.TabIndex = 8;
|
buttonStep.TabIndex = 8;
|
||||||
buttonStep.Text = "Шаг";
|
buttonStep.Text = "Шаг";
|
||||||
buttonStep.UseVisualStyleBackColor = true;
|
buttonStep.UseVisualStyleBackColor = true;
|
||||||
@ -143,10 +153,10 @@ namespace Bulldozer
|
|||||||
// ButtonSelect_Tractor
|
// ButtonSelect_Tractor
|
||||||
//
|
//
|
||||||
ButtonSelect_Tractor.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
ButtonSelect_Tractor.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
ButtonSelect_Tractor.Location = new Point(755, 63);
|
ButtonSelect_Tractor.Location = new Point(755, 71);
|
||||||
ButtonSelect_Tractor.Margin = new Padding(2);
|
ButtonSelect_Tractor.Margin = new Padding(2);
|
||||||
ButtonSelect_Tractor.Name = "ButtonSelect_Tractor";
|
ButtonSelect_Tractor.Name = "ButtonSelect_Tractor";
|
||||||
ButtonSelect_Tractor.Size = new Size(88, 23);
|
ButtonSelect_Tractor.Size = new Size(88, 28);
|
||||||
ButtonSelect_Tractor.TabIndex = 9;
|
ButtonSelect_Tractor.TabIndex = 9;
|
||||||
ButtonSelect_Tractor.Text = "Выбрать";
|
ButtonSelect_Tractor.Text = "Выбрать";
|
||||||
ButtonSelect_Tractor.UseVisualStyleBackColor = true;
|
ButtonSelect_Tractor.UseVisualStyleBackColor = true;
|
||||||
@ -156,7 +166,7 @@ namespace Bulldozer
|
|||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(870, 390);
|
ClientSize = new Size(870, 572);
|
||||||
Controls.Add(ButtonSelect_Tractor);
|
Controls.Add(ButtonSelect_Tractor);
|
||||||
Controls.Add(buttonStep);
|
Controls.Add(buttonStep);
|
||||||
Controls.Add(buttonCreateTractor);
|
Controls.Add(buttonCreateTractor);
|
||||||
@ -175,11 +185,6 @@ namespace Bulldozer
|
|||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
private void comboBoxStrategy_SelectedIndexChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
private PictureBox pictureBoxBulldozer;
|
private PictureBox pictureBoxBulldozer;
|
||||||
private Button buttonCreateBulldozer;
|
private Button buttonCreateBulldozer;
|
||||||
@ -191,5 +196,6 @@ namespace Bulldozer
|
|||||||
private Button buttonCreateTractor;
|
private Button buttonCreateTractor;
|
||||||
private Button buttonStep;
|
private Button buttonStep;
|
||||||
private Button ButtonSelect_Tractor;
|
private Button ButtonSelect_Tractor;
|
||||||
|
private EventHandler comboBoxStrategy_SelectedIndexChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,9 @@
|
|||||||
using ProjectBulldozer;
|
using ProjectBulldozer;
|
||||||
using ProjectBulldozer.Drawning;
|
using ProjectBulldozer.Drawning;
|
||||||
using ProjectBulldozer.Generics;
|
|
||||||
using ProjectBulldozer.MovementStrategy;
|
using ProjectBulldozer.MovementStrategy;
|
||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Bulldozer
|
namespace Bulldozer
|
||||||
{
|
{
|
||||||
public partial class FormBulldozer : Form
|
public partial class FormBulldozer : Form
|
||||||
@ -30,7 +32,9 @@ namespace Bulldozer
|
|||||||
{
|
{
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
|
|
||||||
ColorDialog colorDialog = new ColorDialog();
|
ColorDialog colorDialog = new ColorDialog();
|
||||||
|
|
||||||
if (colorDialog.ShowDialog() == DialogResult.OK)
|
if (colorDialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
color = colorDialog.Color;
|
color = colorDialog.Color;
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
namespace ProjectBulldozer
|
|
||||||
|
namespace ProjectBulldozer
|
||||||
{
|
{
|
||||||
partial class FormTractorCollections
|
partial class FormTractorCollections
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
private System.ComponentModel.IContainer components = null;
|
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)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing && (components != null))
|
if (disposing && (components != null))
|
||||||
@ -11,8 +19,11 @@
|
|||||||
}
|
}
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
#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()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
components = new System.ComponentModel.Container();
|
components = new System.ComponentModel.Container();
|
||||||
@ -194,5 +205,6 @@
|
|||||||
private Button ButtonAddObject;
|
private Button ButtonAddObject;
|
||||||
private Button ButtonRemoveObject;
|
private Button ButtonRemoveObject;
|
||||||
private GroupBox Instruments;
|
private GroupBox Instruments;
|
||||||
|
private EventHandler textBoxStorageName_TextChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -115,9 +115,5 @@ namespace ProjectBulldozer
|
|||||||
}
|
}
|
||||||
pictureBoxCollections.Image = obj.ShowTractors();
|
pictureBoxCollections.Image = obj.ShowTractors();
|
||||||
}
|
}
|
||||||
private void textBoxStorageName_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using ProjectBulldozer.Drawning;
|
using ProjectBulldozer.Drawning;
|
||||||
using ProjectBulldozer.MovementStrategy;
|
using ProjectBulldozer.MovementStrategy;
|
||||||
|
|
||||||
namespace ProjectBulldozer.Generics
|
namespace ProjectBulldozer.Generics
|
||||||
{
|
{
|
||||||
internal class TractorGenericCollection<T, U> where T : DrawingTractor where U : IMoveableObject
|
internal class TractorGenericCollection<T, U> where T : DrawingTractor where U : IMoveableObject
|
||||||
@ -14,6 +15,7 @@ namespace ProjectBulldozer.Generics
|
|||||||
private readonly SetGeneric<T> _collection;
|
private readonly SetGeneric<T> _collection;
|
||||||
public TractorGenericCollection(int picWidth, int picHeight)
|
public TractorGenericCollection(int picWidth, int picHeight)
|
||||||
{
|
{
|
||||||
|
|
||||||
// высчитываем размер массива для setgeneric
|
// высчитываем размер массива для setgeneric
|
||||||
int width = picWidth / _placeSizeWidth;
|
int width = picWidth / _placeSizeWidth;
|
||||||
int height = picHeight / _placeSizeHeight;
|
int height = picHeight / _placeSizeHeight;
|
||||||
@ -67,6 +69,7 @@ namespace ProjectBulldozer.Generics
|
|||||||
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
|
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawObjects(Graphics g)
|
private void DrawObjects(Graphics g)
|
||||||
{
|
{
|
||||||
int width = _pictureWidth / _placeSizeWidth;
|
int width = _pictureWidth / _placeSizeWidth;
|
||||||
@ -85,7 +88,8 @@ namespace ProjectBulldozer.Generics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
{
|
{
|
||||||
internal class SetGeneric<T> where T : class
|
internal class SetGeneric<T> where T : class
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly List<T?> _places;
|
private readonly List<T?> _places;
|
||||||
public int Count => _places.Count;
|
public int Count => _places.Count;
|
||||||
/// Максимальное количество объектов в списке
|
/// Максимальное количество объектов в списке
|
||||||
@ -12,6 +11,7 @@
|
|||||||
_maxCount = count;
|
_maxCount = count;
|
||||||
_places = new List<T?>(count);
|
_places = new List<T?>(count);
|
||||||
}
|
}
|
||||||
|
/// Добавление объекта в набор
|
||||||
public int Insert(T tract)
|
public int Insert(T tract)
|
||||||
{
|
{
|
||||||
return Insert(tract, 0);
|
return Insert(tract, 0);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace ProjectBulldozer.Generics
|
namespace ProjectBulldozer.MovementStrategy
|
||||||
{
|
{
|
||||||
public enum Status
|
public enum Status
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using ProjectBulldozer.Drawning;
|
using ProjectBulldozer.Drawning;
|
||||||
|
using ProjectBulldozer.MovementStrategy;
|
||||||
namespace ProjectBulldozer.Generics
|
namespace ProjectBulldozer.Generics
|
||||||
{
|
{
|
||||||
internal class TractorGenericStorage
|
internal class TractorGenericStorage
|
||||||
@ -7,8 +8,6 @@ namespace ProjectBulldozer.Generics
|
|||||||
public List<string> Keys => _TractorsStorage.Keys.ToList();
|
public List<string> Keys => _TractorsStorage.Keys.ToList();
|
||||||
private readonly int _pictureWidth;
|
private readonly int _pictureWidth;
|
||||||
private readonly int _pictureHeight;
|
private readonly int _pictureHeight;
|
||||||
/// <param name="pictureWidth"></param>
|
|
||||||
/// <param name="pictureHeight"></param>
|
|
||||||
public TractorGenericStorage(int pictureWidth, int pictureHeight)
|
public TractorGenericStorage(int pictureWidth, int pictureHeight)
|
||||||
{
|
{
|
||||||
_TractorsStorage = new Dictionary<string, TractorGenericCollection<DrawingTractor, DrawingObjectTractor>>();
|
_TractorsStorage = new Dictionary<string, TractorGenericCollection<DrawingTractor, DrawingObjectTractor>>();
|
||||||
@ -29,17 +28,16 @@ namespace ProjectBulldozer.Generics
|
|||||||
_TractorsStorage.Remove(name);
|
_TractorsStorage.Remove(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// Доступ к набору
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ind"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public TractorGenericCollection<DrawingTractor, DrawingObjectTractor>?
|
public TractorGenericCollection<DrawingTractor, DrawingObjectTractor>?
|
||||||
this[string ind]
|
this[string ind]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (_TractorsStorage.ContainsKey(ind))
|
||||||
|
{
|
||||||
|
return _TractorsStorage[ind];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
using ProjectBulldozer.Generics;
|
namespace ProjectBulldozer.MovementStrategy
|
||||||
|
|
||||||
namespace ProjectBulldozer.MovementStrategy
|
|
||||||
{
|
{
|
||||||
public abstract class AbstractStrategy
|
public abstract class AbstractStrategy
|
||||||
{
|
{
|
||||||
@ -10,6 +8,7 @@ namespace ProjectBulldozer.MovementStrategy
|
|||||||
protected int FieldWidth { get; private set; }
|
protected int FieldWidth { get; private set; }
|
||||||
protected int FieldHeight { get; private set; }
|
protected int FieldHeight { get; private set; }
|
||||||
public Status GetStatus() { return _state; }
|
public Status GetStatus() { return _state; }
|
||||||
|
|
||||||
public void SetData(IMoveableObject moveableObject, int width, int height)
|
public void SetData(IMoveableObject moveableObject, int width, int height)
|
||||||
{
|
{
|
||||||
if (moveableObject == null)
|
if (moveableObject == null)
|
||||||
@ -22,7 +21,6 @@ namespace ProjectBulldozer.MovementStrategy
|
|||||||
FieldWidth = width;
|
FieldWidth = width;
|
||||||
FieldHeight = height;
|
FieldHeight = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MakeStep()
|
public void MakeStep()
|
||||||
{
|
{
|
||||||
if (_state != Status.InProgress)
|
if (_state != Status.InProgress)
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
using ProjectBulldozer.Drawning;
|
using Bulldozer;
|
||||||
namespace ProjectBulldozer.MovementStrategy
|
using ProjectBulldozer.MovementStrategy;
|
||||||
|
namespace ProjectBulldozer.Drawning
|
||||||
{
|
{
|
||||||
public class DrawingObjectTractor : IMoveableObject
|
public class DrawingObjectTractor : IMoveableObject
|
||||||
{
|
{
|
||||||
private readonly DrawingTractor? _drawningTractor = null;
|
private readonly DrawingTractor? _drawningTractor = null;
|
||||||
|
|
||||||
public DrawingObjectTractor(DrawingTractor drawningTractor)
|
public DrawingObjectTractor(DrawingTractor drawningTractor)
|
||||||
{
|
{
|
||||||
_drawningTractor = drawningTractor;
|
_drawningTractor = drawningTractor;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
namespace ProjectBulldozer.MovementStrategy
|
using Bulldozer;
|
||||||
|
namespace ProjectBulldozer.MovementStrategy
|
||||||
{
|
{
|
||||||
public interface IMoveableObject
|
public interface IMoveableObject
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user