diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/CollectionGenericObjects/AbstractCompany.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/CollectionGenericObjects/AbstractCompany.cs
index b62b879..39e9cdf 100644
--- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/CollectionGenericObjects/AbstractCompany.cs
+++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/CollectionGenericObjects/AbstractCompany.cs
@@ -15,7 +15,7 @@ public abstract class AbstractCompany
///
/// Размер места (высота)
///
- protected readonly int _placeSizeHeight = 80;
+ protected readonly int _placeSizeHeight = 120;
///
/// Ширина окна
@@ -73,6 +73,7 @@ public abstract class AbstractCompany
return company._collection?.Remove(position);
}
+
///
/// Получение случайного объекта из коллекции
///
diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/CollectionGenericObjects/ArtilleryBase.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/CollectionGenericObjects/ArtilleryBase.cs
index e5afd86..4405975 100644
--- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/CollectionGenericObjects/ArtilleryBase.cs
+++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/CollectionGenericObjects/ArtilleryBase.cs
@@ -19,11 +19,44 @@ public class ArtilleryBase : AbstractCompany
protected override void DrawBackgound(Graphics g)
{
- throw new NotImplementedException();
+ int width = _pictureWidth / _placeSizeWidth;
+ int height = _pictureHeight / _placeSizeHeight;
+ Pen pen = new(Color.Black, 3);
+ for (int i = 0; i < width; i++)
+ {
+ for (int j = 0; j < height + 1; ++j)
+ {
+ g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth - 5, j * _placeSizeHeight);
+ }
+ }
}
protected override void SetObjectsPosition()
{
- throw new NotImplementedException();
+ int width = _pictureWidth / _placeSizeWidth;
+ int height = _pictureHeight / _placeSizeHeight;
+
+ int curWidth = width - 1;
+ int curHeight = 0;
+
+ for (int i = 0; i < (_collection?.Count ?? 0); i++)
+ {
+ if (_collection.Get(i) != null)
+ {
+ _collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
+ _collection.Get(i).SetPosition(_placeSizeWidth * curWidth + 40, curHeight * _placeSizeHeight + 4);
+ }
+ if (curWidth > 0)
+ curWidth--;
+ else
+ {
+ curWidth = width - 1;
+ curHeight++;
+ }
+ if (curHeight > height)
+ {
+ return;
+ }
+ }
}
}
diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Drawnings/DrawningPropelledArtillery.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Drawnings/DrawningPropelledArtillery.cs
index c1a3260..1b7ea63 100644
--- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Drawnings/DrawningPropelledArtillery.cs
+++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Drawnings/DrawningPropelledArtillery.cs
@@ -229,7 +229,7 @@ public class DrawningPropelledArtillery
g.DrawRectangle(pen, _startPosX.Value + 15, _startPosY.Value + 75, 90, 30);
//границы ЦВЕТ
- Brush brOlive = new SolidBrush(Color.Olive);
+ Brush brOlive = new SolidBrush(EntityPropelledArtillery.BodyColor);
g.FillRectangle(brOlive, _startPosX.Value + 25, _startPosY.Value + 40, 35, 30);//башня
g.FillEllipse(brOlive, _startPosX.Value + 0, _startPosY.Value + 75, 30, 30);
g.FillEllipse(brOlive, _startPosX.Value + 90, _startPosY.Value + 75, 30, 30);
diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Drawnings/DrawningSelfPropelledArtilleryUnit.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Drawnings/DrawningSelfPropelledArtilleryUnit.cs
index 628afb9..e45c473 100644
--- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Drawnings/DrawningSelfPropelledArtilleryUnit.cs
+++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Drawnings/DrawningSelfPropelledArtilleryUnit.cs
@@ -29,6 +29,7 @@ public class DrawningSelfPropelledArtilleryUnit : DrawningPropelledArtillery
Pen pen = new(Color.Black);
Brush additionalBrush = new SolidBrush(selfpropelledartilleryunit.AdditionalColor);
+ base.DrawTransport(g);
if (selfpropelledartilleryunit.TurretCannon)
{
g.FillEllipse(additionalBrush, _startPosX.Value + 26, _startPosY.Value + 35, 50, 30);
@@ -51,7 +52,6 @@ public class DrawningSelfPropelledArtilleryUnit : DrawningPropelledArtillery
g.FillRectangle(additionalBrush, _startPosX.Value + 10, _startPosY.Value + 25, 15, 5);
}
- base.DrawTransport(g);
}
diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormPropelledArtilleryCollection.Designer.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormPropelledArtilleryCollection.Designer.cs
index dcaee96..3311f7c 100644
--- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormPropelledArtilleryCollection.Designer.cs
+++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormPropelledArtilleryCollection.Designer.cs
@@ -111,6 +111,7 @@
buttonAddSelfPropelledArtilleryUnit.TabIndex = 2;
buttonAddSelfPropelledArtilleryUnit.Text = "Добавление самоходная арт. установки";
buttonAddSelfPropelledArtilleryUnit.UseVisualStyleBackColor = true;
+ buttonAddSelfPropelledArtilleryUnit.Click += buttonAddSelfPropelledArtilleryUnit_Click_1;
//
// buttonAddPropelledArtillery
//
@@ -121,6 +122,7 @@
buttonAddPropelledArtillery.TabIndex = 1;
buttonAddPropelledArtillery.Text = "Добавление бронированной машины";
buttonAddPropelledArtillery.UseVisualStyleBackColor = true;
+ buttonAddPropelledArtillery.Click += buttonAddPropelledArtillery_Click_1;
//
// comboBoxSelectorCompany
//
diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormPropelledArtilleryCollection.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormPropelledArtilleryCollection.cs
index a33e363..8fc01bf 100644
--- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormPropelledArtilleryCollection.cs
+++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormPropelledArtilleryCollection.cs
@@ -42,20 +42,24 @@ public partial class FormPropelledArtilleryCollection : Form
break;
}
}
+ private void buttonAddPropelledArtillery_Click_1(object sender, EventArgs e) => CreateObject(nameof(DrawningPropelledArtillery));
+
- ///
- /// Добавление Бронированная машина
- ///
- ///
- ///
- private void ButtonAddPropelledArtillery_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningPropelledArtillery));
+ private void buttonAddSelfPropelledArtilleryUnit_Click_1(object sender, EventArgs e) => CreateObject(nameof(DrawningSelfPropelledArtilleryUnit));
- ///
- /// Добавление Самоходная арт. установка
- ///
- ///
- ///
- private void ButtonAddSelfPropelledArtilleryUnit_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningSelfPropelledArtilleryUnit));
+ // ///
+ ///// Добавление Бронированная машина
+ /////
+ /////
+ /////
+ //private void ButtonAddPropelledArtillery_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningPropelledArtillery));
+
+ // ///
+ // /// Добавление Самоходная арт. установка
+ // ///
+ // ///
+ // ///
+ // private void ButtonAddSelfPropelledArtilleryUnit_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningSelfPropelledArtilleryUnit));
///
/// Создание объекта класса-перемещения
@@ -192,6 +196,8 @@ public partial class FormPropelledArtilleryCollection : Form
}
pictureBox.Image = _company.Show();
}
+
+
}