diff --git a/ElectricLocomotive/ElectricLocomotive/DrawningObjectLocomotive.cs b/ElectricLocomotive/ElectricLocomotive/DrawningObjectLocomotive.cs
index 6e45855..53378eb 100644
--- a/ElectricLocomotive/ElectricLocomotive/DrawningObjectLocomotive.cs
+++ b/ElectricLocomotive/ElectricLocomotive/DrawningObjectLocomotive.cs
@@ -13,12 +13,6 @@ namespace ElectricLocomotive
{
_locomotive = locomotive;
}
-
- public void Metod(int x)
- {
- x = 150;
- Console.WriteLine(x);
- }
public float Step => _locomotive?.Locomotive?.Step ?? 0;
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
diff --git a/ElectricLocomotive/ElectricLocomotive/FormLocomotive.Designer.cs b/ElectricLocomotive/ElectricLocomotive/FormLocomotive.Designer.cs
index 0ee7bcd..4ac4aa2 100644
--- a/ElectricLocomotive/ElectricLocomotive/FormLocomotive.Designer.cs
+++ b/ElectricLocomotive/ElectricLocomotive/FormLocomotive.Designer.cs
@@ -168,7 +168,7 @@
this.buttonselectlocomotive.TabIndex = 8;
this.buttonselectlocomotive.Text = "Выбрать";
this.buttonselectlocomotive.UseVisualStyleBackColor = true;
- this.buttonselectlocomotive.Click += new System.EventHandler(this.ButtonSelectCar_Click);
+ this.buttonselectlocomotive.Click += new System.EventHandler(this.ButtonSelectLocomotive_Click);
//
// FormLocomotive
//
diff --git a/ElectricLocomotive/ElectricLocomotive/FormLocomotive.cs b/ElectricLocomotive/ElectricLocomotive/FormLocomotive.cs
index 712c4b4..f09b942 100644
--- a/ElectricLocomotive/ElectricLocomotive/FormLocomotive.cs
+++ b/ElectricLocomotive/ElectricLocomotive/FormLocomotive.cs
@@ -18,9 +18,6 @@ namespace ElectricLocomotive
{
InitializeComponent();
}
- ///
- /// Метод прорисовки машины
- ///
private void Draw()
{
Bitmap bmp = new(pictureBox1.Width, pictureBox1.Height);
@@ -28,9 +25,6 @@ namespace ElectricLocomotive
_locomotive?.DrawTransport(gr);
pictureBox1.Image = bmp;
}
- ///
- /// Метод установки данных
- ///
private void SetData()
{
Random rnd = new();
@@ -40,7 +34,6 @@ namespace ElectricLocomotive
toolStripStatusLabelWeight.Text = $"Вес: {_locomotive.Locomotive.Weight}";
toolStripStatusLabelColor.Text = $"Цвет: { _locomotive.Locomotive.BodyColor.Name} ";
}
-
private void ButtonCreate_Click(object sender, EventArgs e)
{
Random rnd = new();
@@ -79,7 +72,7 @@ namespace ElectricLocomotive
Draw();
}
- private void PictureBoxCar_Resize(object sender, EventArgs e)
+ private void PictureBoxLocomotive_Resize(object sender, EventArgs e)
{
_locomotive?.ChangeBorders(pictureBox1.Width, pictureBox1.Height);
Draw();
@@ -110,7 +103,7 @@ namespace ElectricLocomotive
Draw();
}
- private void ButtonSelectCar_Click(object sender, EventArgs e)
+ private void ButtonSelectLocomotive_Click(object sender, EventArgs e)
{
SelectedLocomotive = _locomotive;
DialogResult = DialogResult.OK;
diff --git a/ElectricLocomotive/ElectricLocomotive/FormMapWithSetLocomotive.Designer.cs b/ElectricLocomotive/ElectricLocomotive/FormMapWithSetLocomotive.Designer.cs
index 994c835..9f7b19b 100644
--- a/ElectricLocomotive/ElectricLocomotive/FormMapWithSetLocomotive.Designer.cs
+++ b/ElectricLocomotive/ElectricLocomotive/FormMapWithSetLocomotive.Designer.cs
@@ -123,7 +123,7 @@
this.buttonAddLocomotive.TabIndex = 17;
this.buttonAddLocomotive.Text = "Добавить локомотив";
this.buttonAddLocomotive.UseVisualStyleBackColor = true;
- this.buttonAddLocomotive.Click += new System.EventHandler(this.ButtonAddCar_Click);
+ this.buttonAddLocomotive.Click += new System.EventHandler(this.ButtonAddLocomotive_Click);
//
// comboBoxSelectorMap
//
@@ -156,7 +156,7 @@
this.buttonRemoveCar.TabIndex = 24;
this.buttonRemoveCar.Text = "Удалить локомотив";
this.buttonRemoveCar.UseVisualStyleBackColor = true;
- this.buttonRemoveCar.Click += new System.EventHandler(this.ButtonRemoveCar_Click);
+ this.buttonRemoveCar.Click += new System.EventHandler(this.ButtonRemoveLocomotive_Click);
//
// buttonShowStorage
//
diff --git a/ElectricLocomotive/ElectricLocomotive/FormMapWithSetLocomotive.cs b/ElectricLocomotive/ElectricLocomotive/FormMapWithSetLocomotive.cs
index fc656b3..1bddbe1 100644
--- a/ElectricLocomotive/ElectricLocomotive/FormMapWithSetLocomotive.cs
+++ b/ElectricLocomotive/ElectricLocomotive/FormMapWithSetLocomotive.cs
@@ -12,22 +12,11 @@ namespace ElectricLocomotive
{
public partial class FormMapWithSetLocomotive : Form
{
- ///
- /// Объект от класса карты с набором объектов
- ///
- private MapWithSetLocomotivGeneric _mapCarsCollectionGeneric;
- ///
- /// Конструктор
- ///
+ private MapWithSetLocomotivGeneric _mapLocomotivesCollectionGeneric;
public FormMapWithSetLocomotive()
{
InitializeComponent();
}
- ///
- /// Выбор карты
- ///
- ///
- ///
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender,
EventArgs e)
{
@@ -46,32 +35,27 @@ namespace ElectricLocomotive
}
if (map != null)
{
- _mapCarsCollectionGeneric = new MapWithSetLocomotivGeneric(pictureBox1.Width, pictureBox1.Height, map);
+ _mapLocomotivesCollectionGeneric = new MapWithSetLocomotivGeneric(pictureBox1.Width, pictureBox1.Height, map);
}
else
{
- _mapCarsCollectionGeneric = null;
+ _mapLocomotivesCollectionGeneric = null;
}
}
- ///
- /// Добавление объекта
- ///
- ///
- ///
- private void ButtonAddCar_Click(object sender, EventArgs e)
+ private void ButtonAddLocomotive_Click(object sender, EventArgs e)
{
- if (_mapCarsCollectionGeneric == null)
+ if (_mapLocomotivesCollectionGeneric == null)
{
return;
}
FormLocomotive form = new();
if (form.ShowDialog() == DialogResult.OK)
{
- DrawningObjectLocomotive ship = new(form.SelectedLocomotive);
- if (_mapCarsCollectionGeneric + ship != -1)
+ DrawningObjectLocomotive Locomotive = new(form.SelectedLocomotive);
+ if (_mapLocomotivesCollectionGeneric + Locomotive != -1)
{
MessageBox.Show("Объект добавлен");
- pictureBox1.Image = _mapCarsCollectionGeneric.ShowSet();
+ pictureBox1.Image = _mapLocomotivesCollectionGeneric.ShowSet();
}
else
{
@@ -79,12 +63,7 @@ namespace ElectricLocomotive
}
}
}
- ///
- /// Удаление объекта
- ///
- ///
- ///
- private void ButtonRemoveCar_Click(object sender, EventArgs e)
+ private void ButtonRemoveLocomotive_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))
{
@@ -96,50 +75,35 @@ namespace ElectricLocomotive
return;
}
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
- if (_mapCarsCollectionGeneric - pos != null)
+ if (_mapLocomotivesCollectionGeneric - pos != null)
{
MessageBox.Show("Объект удален");
- pictureBox1.Image = _mapCarsCollectionGeneric.ShowSet();
+ pictureBox1.Image = _mapLocomotivesCollectionGeneric.ShowSet();
}
else
{
MessageBox.Show("Не удалось удалить объект");
}
}
- ///
- /// Вывод набора
- ///
- ///
- ///
private void ButtonShowStorage_Click(object sender, EventArgs e)
{
- if (_mapCarsCollectionGeneric == null)
+ if (_mapLocomotivesCollectionGeneric == null)
{
return;
}
- pictureBox1.Image = _mapCarsCollectionGeneric.ShowSet();
+ pictureBox1.Image = _mapLocomotivesCollectionGeneric.ShowSet();
}
- ///
- /// Вывод карты
- ///
- ///
- ///
private void ButtonShowOnMap_Click(object sender, EventArgs e)
{
- if (_mapCarsCollectionGeneric == null)
+ if (_mapLocomotivesCollectionGeneric == null)
{
return;
}
- pictureBox1.Image = _mapCarsCollectionGeneric.ShowOnMap();
+ pictureBox1.Image = _mapLocomotivesCollectionGeneric.ShowOnMap();
}
- ///
- /// Перемещение
- ///
- ///
- ///
private void ButtonMove_Click(object sender, EventArgs e)
{
- if (_mapCarsCollectionGeneric == null)
+ if (_mapLocomotivesCollectionGeneric == null)
{
return;
}
@@ -161,7 +125,7 @@ namespace ElectricLocomotive
dir = Direction.Right;
break;
}
- pictureBox1.Image = _mapCarsCollectionGeneric.MoveObject(dir);
+ pictureBox1.Image = _mapLocomotivesCollectionGeneric.MoveObject(dir);
}
}
}
diff --git a/ElectricLocomotive/ElectricLocomotive/MapWithSetLocomotivGeneric.cs b/ElectricLocomotive/ElectricLocomotive/MapWithSetLocomotivGeneric.cs
index 6377c9c..9a1bdfe 100644
--- a/ElectricLocomotive/ElectricLocomotive/MapWithSetLocomotivGeneric.cs
+++ b/ElectricLocomotive/ElectricLocomotive/MapWithSetLocomotivGeneric.cs
@@ -35,9 +35,9 @@ namespace ElectricLocomotive
_map = map;
}
// Перегрузка оператора сложения
- public static int operator +(MapWithSetLocomotivGeneric map, T Ship)
+ public static int operator +(MapWithSetLocomotivGeneric map, T Locomotive)
{
- return map._setLocomotive.Insert(Ship);
+ return map._setLocomotive.Insert(Locomotive);
}
// Перегрузка оператора вычитания
public static T operator -(MapWithSetLocomotivGeneric map, int position)
@@ -62,7 +62,7 @@ namespace ElectricLocomotive
Bitmap bmp = new(_pictureWidth, _pictureHeight);
Graphics gr = Graphics.FromImage(bmp);
DrawBackground(gr);
- DrawShip(gr);
+ DrawLocomotive(gr);
return bmp;
}
// Просмотр объекта на карте
@@ -71,10 +71,10 @@ namespace ElectricLocomotive
Shaking();
for (int i = 0; i < _setLocomotive.Count; i++)
{
- var Ship = _setLocomotive.Get(i);
- if (Ship != null)
+ var Locomotive = _setLocomotive.Get(i);
+ if (Locomotive != null)
{
- return _map.CreateMap(_pictureWidth, _pictureHeight, Ship);
+ return _map.CreateMap(_pictureWidth, _pictureHeight, Locomotive);
}
}
return new(_pictureWidth, _pictureHeight);
@@ -98,10 +98,10 @@ namespace ElectricLocomotive
{
for (; j > i; j--)
{
- var Ship = _setLocomotive.Get(j);
- if (Ship != null)
+ var Locomotive = _setLocomotive.Get(j);
+ if (Locomotive != null)
{
- _setLocomotive.Insert(Ship, i);
+ _setLocomotive.Insert(Locomotive, i);
_setLocomotive.Remove(j);
break;
}
@@ -130,7 +130,7 @@ namespace ElectricLocomotive
}
}
// Метод прорисовки объектов
- private void DrawShip(Graphics g)
+ private void DrawLocomotive(Graphics g)
{
int widthEl = _pictureWidth / _placeSizeWidth;
int heightEl = _pictureHeight / _placeSizeHeight;