From 3cc7bee7ad5cc70beb073f182cfbd457f2f2a63f Mon Sep 17 00:00:00 2001 From: kirkorovka <147087189+kirkorovka@users.noreply.github.com> Date: Tue, 7 May 2024 09:45:07 +0400 Subject: [PATCH] Correction due to changes in lab5 --- .../Drawings/DrawingSAU.cs | 13 ++++++------- .../Entity/EntitySAU.cs | 8 ++++---- .../FormSAUConfig.Designer.cs | 13 +++++++++++++ .../FormSAUConfig.cs | 2 +- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/Drawings/DrawingSAU.cs b/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/Drawings/DrawingSAU.cs index 2d6292a..2fa55d4 100644 --- a/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/Drawings/DrawingSAU.cs +++ b/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/Drawings/DrawingSAU.cs @@ -12,9 +12,9 @@ public class DrawingSAU : DrawingBase { - public DrawingSAU(int speed, double weight, Color bodyColor, Color additionalColor, bool guns) : base(150, 100) + public DrawingSAU(int speed, double weight, Color bodyColor, Color additionalColor, bool tracks, bool guns) : base(150, 100) { - BaseSAU = new EntitySAU( speed, weight, bodyColor, additionalColor, guns); + BaseSAU = new EntitySAU( speed, weight, bodyColor, additionalColor, tracks, guns); } public DrawingSAU(BaseSAU? baseSAU) @@ -36,10 +36,6 @@ public class DrawingSAU : DrawingBase Brush additionalBrush = new SolidBrush(SAU.AdditionalColor); - //гусеницы - g.FillEllipse(additionalBrush, _startPosX.Value, _startPosY.Value + 55, 130, 40); - - //пулеметы if (SAU.Guns) @@ -53,7 +49,10 @@ public class DrawingSAU : DrawingBase base.DrawSAU(g); //гусеницы - g.FillEllipse(additionalBrush, _startPosX.Value, _startPosY.Value + 55, 130, 40); + if (SAU.Tracks) + { + g.FillEllipse(additionalBrush, _startPosX.Value, _startPosY.Value + 55, 130, 40); + } } diff --git a/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/Entity/EntitySAU.cs b/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/Entity/EntitySAU.cs index bf32933..637a35f 100644 --- a/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/Entity/EntitySAU.cs +++ b/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/Entity/EntitySAU.cs @@ -11,14 +11,14 @@ public class EntitySAU: BaseSAU public Color AdditionalColor { get; private set; } - //public bool Tracks { get; private set; } + public bool Tracks { get; private set; } public bool Guns { get; private set; } - public EntitySAU(int speed, double weight, Color bodyColor, Color additionalColor, bool guns) : base(speed, weight, bodyColor) + public EntitySAU(int speed, double weight, Color bodyColor, Color additionalColor, bool tracks, bool guns) : base(speed, weight, bodyColor) { AdditionalColor = additionalColor; - + Tracks = tracks; Guns = guns; } public void SetAdditionalColor(Color additionalColor) @@ -39,6 +39,6 @@ public class EntitySAU: BaseSAU } return new EntitySAU(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]), Color.FromName(strs[4]), - Convert.ToBoolean(strs[5])); + Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6])); } } diff --git a/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/FormSAUConfig.Designer.cs b/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/FormSAUConfig.Designer.cs index 04c90eb..f09e979 100644 --- a/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/FormSAUConfig.Designer.cs +++ b/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/FormSAUConfig.Designer.cs @@ -51,6 +51,7 @@ panelObject = new Panel(); labelAdditionalColor = new Label(); labelBodyColor = new Label(); + checkBoxTracks = new CheckBox(); groupBoxConfig.SuspendLayout(); groupBoxColors.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit(); @@ -61,6 +62,7 @@ // // groupBoxConfig // + groupBoxConfig.Controls.Add(checkBoxTracks); groupBoxConfig.Controls.Add(groupBoxColors); groupBoxConfig.Controls.Add(labelSimpleObject); groupBoxConfig.Controls.Add(checkBoxGuns); @@ -310,6 +312,16 @@ labelBodyColor.DragDrop += labelBodyColor_DragDrop; labelBodyColor.DragEnter += labelBodyColor_DragEnter; // + // checkBoxTracks + // + checkBoxTracks.AutoSize = true; + checkBoxTracks.Location = new Point(12, 135); + checkBoxTracks.Name = "checkBoxTracks"; + checkBoxTracks.Size = new Size(232, 24); + checkBoxTracks.TabIndex = 9; + checkBoxTracks.Text = "Признак наличия пулеметов"; + checkBoxTracks.UseVisualStyleBackColor = true; + // // FormSAUConfig // AutoScaleDimensions = new SizeF(8F, 20F); @@ -356,5 +368,6 @@ private Panel panelObject; private Label labelBodyColor; private Label labelAdditionalColor; + private CheckBox checkBoxTracks; } } \ No newline at end of file diff --git a/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/FormSAUConfig.cs b/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/FormSAUConfig.cs index 8b3ba62..eef3ee4 100644 --- a/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/FormSAUConfig.cs +++ b/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/FormSAUConfig.cs @@ -68,7 +68,7 @@ public partial class FormSAUConfig : Form break; case "labelModifiedObject": _drawingBase = new DrawingSAU((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White, - Color.Black, checkBoxGuns.Checked); + Color.Black, checkBoxTracks.Checked, checkBoxGuns.Checked); break; }