4 Commits

Author SHA1 Message Date
fc50fb687b в 2024-05-23 02:29:26 +04:00
7e45e6b25a в 2024-05-22 21:53:40 +04:00
fabe2bf5c2 в 2024-05-22 03:37:06 +04:00
77141b976c d 2024-05-22 03:01:41 +04:00
6 changed files with 38 additions and 38 deletions

View File

@@ -22,7 +22,7 @@ namespace ProjectArtilleryUnit.CollectionGenericObjects
int width = _pictureWidth / _placeSizeWidth;
int height = _pictureHeight / _placeSizeHeight;
Pen pen = new(Color.Black, 2);
for (int i = 0; i < width + 1; i++)
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height + 1; ++j)
{
@@ -47,7 +47,7 @@ namespace ProjectArtilleryUnit.CollectionGenericObjects
_collection.Get(i).SetPosition(_placeSizeWidth * curWidth + 10, curHeight * _placeSizeHeight + 10);
}
if (curWidth < width)
if (curWidth < width - 1)
curWidth++;
else
{

View File

@@ -14,14 +14,14 @@ namespace ProjectArtilleryUnit.Drawnings
/// <param name="weight">Вес</param>
/// <param name="bodyColor">Основной цвет</param>
/// <param name="additionalColor">Дополнительный цвет</param>
/// <param name="helicopterArea">Признак наличия вертолетной площадки</param>
/// <param name="gun">Признак наличия шлюпок</param>
/// <param name="luke">Признак наличия пушки</param>
/// <param name="muzzle">Признак наличия дула</param>
/// <param name="gun">Признак наличия ракетной установки</param>
/// <param name="luke">Признак наличия люка</param>
public DrawningMilitaryArtilleryUnit(int speed, double weight, Color bodyColor, Color additionalColor, bool helicopterArea, bool gun, bool luke)
public DrawningMilitaryArtilleryUnit(int speed, double weight, Color bodyColor, Color additionalColor, bool muzzle, bool gun, bool luke)
: base(150, 50)
{
EntityArtilleryUnit = new EntityMilitaryArtilleryUnit(speed, weight, bodyColor, additionalColor, helicopterArea, gun, luke);
EntityArtilleryUnit = new EntityMilitaryArtilleryUnit(speed, weight, bodyColor, additionalColor, muzzle, gun, luke);
}
public override void DrawTransport(Graphics g)

View File

@@ -3,11 +3,11 @@
internal class EntityMilitaryArtilleryUnit : EntityArtilleryUnit
{
/// <summary>
/// Признак (опция) наличие пушка
/// Признак (опция) наличие дула
/// </summary>
public bool Muzzle { get; private set; }
/// <summary>
/// Признак (опция) наличие артелирийской пушки
/// Признак (опция) наличие ракетной установки
/// </summary>
public bool Gun { get; private set; }
/// <summary>

View File

@@ -51,32 +51,32 @@
groupBoxTools.Controls.Add(ButtonAddArtilleryUnit);
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
groupBoxTools.Dock = DockStyle.Right;
groupBoxTools.Location = new Point(525, 0);
groupBoxTools.Location = new Point(590, 0);
groupBoxTools.Margin = new Padding(3, 2, 3, 2);
groupBoxTools.Name = "groupBoxTools";
groupBoxTools.Padding = new Padding(3, 2, 3, 2);
groupBoxTools.Size = new Size(204, 430);
groupBoxTools.Size = new Size(177, 430);
groupBoxTools.TabIndex = 0;
groupBoxTools.TabStop = false;
groupBoxTools.Text = "инструменты";
//
// maskedTextBoxPosision
//
maskedTextBoxPosision.Location = new Point(17, 172);
maskedTextBoxPosision.Location = new Point(6, 172);
maskedTextBoxPosision.Margin = new Padding(3, 2, 3, 2);
maskedTextBoxPosision.Mask = "00";
maskedTextBoxPosision.Name = "maskedTextBoxPosision";
maskedTextBoxPosision.Size = new Size(175, 23);
maskedTextBoxPosision.Size = new Size(163, 23);
maskedTextBoxPosision.TabIndex = 2;
maskedTextBoxPosision.ValidatingType = typeof(int);
//
// buttonRefresh
//
buttonRefresh.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonRefresh.Location = new Point(17, 358);
buttonRefresh.Location = new Point(6, 356);
buttonRefresh.Margin = new Padding(3, 2, 3, 2);
buttonRefresh.Name = "buttonRefresh";
buttonRefresh.Size = new Size(175, 30);
buttonRefresh.Size = new Size(163, 30);
buttonRefresh.TabIndex = 5;
buttonRefresh.Text = "обновить";
buttonRefresh.UseVisualStyleBackColor = true;
@@ -85,10 +85,10 @@
// buttonGetToTest
//
buttonGetToTest.Anchor = AnchorStyles.Right;
buttonGetToTest.Location = new Point(17, 268);
buttonGetToTest.Location = new Point(6, 269);
buttonGetToTest.Margin = new Padding(3, 2, 3, 2);
buttonGetToTest.Name = "buttonGetToTest";
buttonGetToTest.Size = new Size(175, 30);
buttonGetToTest.Size = new Size(163, 30);
buttonGetToTest.TabIndex = 4;
buttonGetToTest.Text = "передать на тесты";
buttonGetToTest.UseVisualStyleBackColor = true;
@@ -97,10 +97,10 @@
// ButtonRemoveArtilleryUnit
//
ButtonRemoveArtilleryUnit.Anchor = AnchorStyles.Right;
ButtonRemoveArtilleryUnit.Location = new Point(17, 199);
ButtonRemoveArtilleryUnit.Location = new Point(6, 199);
ButtonRemoveArtilleryUnit.Margin = new Padding(3, 2, 3, 2);
ButtonRemoveArtilleryUnit.Name = "ButtonRemoveArtilleryUnit";
ButtonRemoveArtilleryUnit.Size = new Size(175, 41);
ButtonRemoveArtilleryUnit.Size = new Size(163, 41);
ButtonRemoveArtilleryUnit.TabIndex = 3;
ButtonRemoveArtilleryUnit.Text = "удалить артиллерийскую установку";
ButtonRemoveArtilleryUnit.UseVisualStyleBackColor = true;
@@ -109,10 +109,10 @@
// ButtonAddMilitaryArtilleryUnit
//
ButtonAddMilitaryArtilleryUnit.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonAddMilitaryArtilleryUnit.Location = new Point(17, 130);
ButtonAddMilitaryArtilleryUnit.Location = new Point(6, 130);
ButtonAddMilitaryArtilleryUnit.Margin = new Padding(3, 2, 3, 2);
ButtonAddMilitaryArtilleryUnit.Name = "ButtonAddMilitaryArtilleryUnit";
ButtonAddMilitaryArtilleryUnit.Size = new Size(175, 38);
ButtonAddMilitaryArtilleryUnit.Size = new Size(163, 38);
ButtonAddMilitaryArtilleryUnit.TabIndex = 2;
ButtonAddMilitaryArtilleryUnit.Text = "добавлене военной артиллерийской установки";
ButtonAddMilitaryArtilleryUnit.UseVisualStyleBackColor = true;
@@ -122,10 +122,10 @@
//
ButtonAddArtilleryUnit.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonAddArtilleryUnit.BackgroundImageLayout = ImageLayout.Center;
ButtonAddArtilleryUnit.Location = new Point(17, 80);
ButtonAddArtilleryUnit.Location = new Point(6, 80);
ButtonAddArtilleryUnit.Margin = new Padding(3, 2, 3, 2);
ButtonAddArtilleryUnit.Name = "ButtonAddArtilleryUnit";
ButtonAddArtilleryUnit.Size = new Size(175, 46);
ButtonAddArtilleryUnit.Size = new Size(163, 46);
ButtonAddArtilleryUnit.TabIndex = 1;
ButtonAddArtilleryUnit.Text = "добваление артиллерийской установки";
ButtonAddArtilleryUnit.UseVisualStyleBackColor = true;
@@ -136,10 +136,10 @@
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSelectorCompany.FormattingEnabled = true;
comboBoxSelectorCompany.Items.AddRange(new object[] { "хранилище" });
comboBoxSelectorCompany.Location = new Point(17, 20);
comboBoxSelectorCompany.Location = new Point(6, 20);
comboBoxSelectorCompany.Margin = new Padding(3, 2, 3, 2);
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
comboBoxSelectorCompany.Size = new Size(175, 23);
comboBoxSelectorCompany.Size = new Size(163, 23);
comboBoxSelectorCompany.TabIndex = 0;
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged_1;
//
@@ -149,7 +149,7 @@
pictureBoxArtilleryUnit.Location = new Point(0, 0);
pictureBoxArtilleryUnit.Margin = new Padding(3, 2, 3, 2);
pictureBoxArtilleryUnit.Name = "pictureBoxArtilleryUnit";
pictureBoxArtilleryUnit.Size = new Size(525, 430);
pictureBoxArtilleryUnit.Size = new Size(590, 430);
pictureBoxArtilleryUnit.TabIndex = 1;
pictureBoxArtilleryUnit.TabStop = false;
pictureBoxArtilleryUnit.Click += pictureBoxArtilleryUnit_Click;
@@ -158,7 +158,7 @@
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(729, 430);
ClientSize = new Size(767, 430);
Controls.Add(pictureBoxArtilleryUnit);
Controls.Add(groupBoxTools);
Margin = new Padding(3, 2, 3, 2);

View File

@@ -10,36 +10,36 @@ namespace ProjectArtilleryUnit.MovementStrategy
/// <summary>
/// Поле-объект класса DrawningArtilleryUnit или его наследника
/// </summary>
private readonly DrawningArtilleryUnit? _tank = null;
private readonly DrawningArtilleryUnit? _artilleryUnit = null;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="tank">Объект класса DrawningArtilleryUnit</param>
public MoveableArtilleryUnit(DrawningArtilleryUnit tank)
/// <param name="artilleryUnit">Объект класса DrawningArtilleryUnit</param>
public MoveableArtilleryUnit(DrawningArtilleryUnit artilleryUnit)
{
_tank = tank;
_artilleryUnit = artilleryUnit;
}
public ObjectParameters? GetObjectPosition
{
get
{
if (_tank == null || _tank.EntityArtilleryUnit == null ||
!_tank.GetPosX.HasValue || !_tank.GetPosY.HasValue)
if (_artilleryUnit == null || _artilleryUnit.EntityArtilleryUnit == null ||
!_artilleryUnit.GetPosX.HasValue || !_artilleryUnit.GetPosY.HasValue)
{
return null;
}
return new ObjectParameters(_tank.GetPosX.Value,
_tank.GetPosY.Value, _tank.GetWidth, _tank.GetHeight);
return new ObjectParameters(_artilleryUnit.GetPosX.Value,
_artilleryUnit.GetPosY.Value, _artilleryUnit.GetWidth, _artilleryUnit.GetHeight);
}
}
public int GetStep => (int)(_tank?.EntityArtilleryUnit?.Step ?? 0);
public int GetStep => (int)(_artilleryUnit?.EntityArtilleryUnit?.Step ?? 0);
public bool TryMoveObject(MovementDirection direction)
{
if (_tank == null || _tank.EntityArtilleryUnit == null)
if (_artilleryUnit == null || _artilleryUnit.EntityArtilleryUnit == null)
{
return false;
}
return _tank.MoveTransport(GetDirectionType(direction));
return _artilleryUnit.MoveTransport(GetDirectionType(direction));
}
/// <summary>
/// Конвертация из MovementDirection в DirectionType