From eb527d5c1075528a2a9358ce2cc60953644d66ef Mon Sep 17 00:00:00 2001
From: Pyro <732603@gmail.com>
Date: Sun, 18 Feb 2024 19:37:19 +0400
Subject: [PATCH] revert 1f0eb7baa586ccdedefee88752ed11f6f596b53b
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
revert Лабораторная работа №1 (усложнённая)
---
.../ProjectMotorBoat/DrawingMotorBoat.cs | 44 +++++--------------
.../ProjectMotorBoat/EntityMotorBoat.cs | 28 +++---------
.../ProjectMotorBoat/FormMotorBoat.cs | 2 +-
3 files changed, 18 insertions(+), 56 deletions(-)
diff --git a/ProjectMotorBoat/ProjectMotorBoat/DrawingMotorBoat.cs b/ProjectMotorBoat/ProjectMotorBoat/DrawingMotorBoat.cs
index 5b0c30f..b379b19 100644
--- a/ProjectMotorBoat/ProjectMotorBoat/DrawingMotorBoat.cs
+++ b/ProjectMotorBoat/ProjectMotorBoat/DrawingMotorBoat.cs
@@ -13,11 +13,6 @@ public class DrawingMotorBoat
///
public EntityMotorBoat? EntityMotorBoat { get; private set; }
- ///
- /// Класс-сущность
- ///
- public EntityPaddle? EntityPaddle { get; private set; }
-
///
/// Ширина окна
///
@@ -59,12 +54,10 @@ public class DrawingMotorBoat
///
///
///
- public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool protectiveGlass, int paddle)
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool paddle, bool protectiveGlass)
{
EntityMotorBoat = new EntityMotorBoat();
- EntityMotorBoat.Init(speed, weight, bodyColor, additionalColor, inboardEngine, protectiveGlass);
- EntityPaddle = new EntityPaddle();
- EntityPaddle.Init(paddle);
+ EntityMotorBoat.Init(speed, weight, bodyColor, additionalColor, inboardEngine, paddle, protectiveGlass);
_pictureWidth = null;
_pictureHeight = null;
_startPosX = null;
@@ -252,32 +245,17 @@ public class DrawingMotorBoat
}
// Вёсла
- if (EntityPaddle.Paddle != 0)
+ if (EntityMotorBoat.Paddle)
{
- if (EntityPaddle.Paddle >= 1)
- {
- g.DrawRectangle(pen, _startPosX.Value + 32, _startPosY.Value + 3, 2, 17);
- g.FillRectangle(additionalBrush, _startPosX.Value + 33, _startPosY.Value + 3, 1, 17);
+ g.DrawRectangle(pen, _startPosX.Value + 32, _startPosY.Value + 3, 2, 17);
+ g.DrawRectangle(pen, _startPosX.Value + 32, _startPosY.Value + 30, 2, 17);
+ g.FillRectangle(additionalBrush, _startPosX.Value + 33, _startPosY.Value + 3, 1, 17);
+ g.FillRectangle(additionalBrush, _startPosX.Value + 33, _startPosY.Value + 31, 1, 16);
- g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value, 6, 8);
- g.FillEllipse(additionalBrush, _startPosX.Value + 30, _startPosY.Value, 6, 8);
- }
- if (EntityPaddle.Paddle >= 2)
- {
- g.DrawRectangle(pen, _startPosX.Value + 27, _startPosY.Value + 30, 2, 17);
- g.FillRectangle(additionalBrush, _startPosX.Value + 28, _startPosY.Value + 31, 1, 16);
-
- g.DrawEllipse(pen, _startPosX.Value + 25, _startPosY.Value + 42, 6, 8);
- g.FillEllipse(additionalBrush, _startPosX.Value + 25, _startPosY.Value + 42, 6, 8);
- }
- if (EntityPaddle.Paddle == 3)
- {
- g.DrawRectangle(pen, _startPosX.Value + 36, _startPosY.Value + 30, 2, 17);
- g.FillRectangle(additionalBrush, _startPosX.Value + 37, _startPosY.Value + 31, 1, 16);
-
- g.DrawEllipse(pen, _startPosX.Value + 34, _startPosY.Value + 42, 6, 8);
- g.FillEllipse(additionalBrush, _startPosX.Value + 34, _startPosY.Value + 42, 6, 8);
- }
+ g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value, 6, 8);
+ g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 42, 6, 8);
+ g.FillEllipse(additionalBrush, _startPosX.Value + 30, _startPosY.Value, 6, 8);
+ g.FillEllipse(additionalBrush, _startPosX.Value + 30, _startPosY.Value + 42, 6, 8);
}
// Защитное стекло
diff --git a/ProjectMotorBoat/ProjectMotorBoat/EntityMotorBoat.cs b/ProjectMotorBoat/ProjectMotorBoat/EntityMotorBoat.cs
index 61179d9..9d238ad 100644
--- a/ProjectMotorBoat/ProjectMotorBoat/EntityMotorBoat.cs
+++ b/ProjectMotorBoat/ProjectMotorBoat/EntityMotorBoat.cs
@@ -30,10 +30,10 @@ public class EntityMotorBoat
///
public bool InboardEngine { get; private set; }
- /////
- ///// Признак (опция) наличия вёсел
- /////
- //public int Paddle { get; private set; }
+ ///
+ /// Признак (опция) наличия вёсел
+ ///
+ public bool Paddle { get; private set; }
///
/// Возможность глиссирования
@@ -55,30 +55,14 @@ public class EntityMotorBoat
///
///
///
- public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool protectiveGlass)
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool paddle, bool protectiveGlass)
{
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
AdditionalColor = additionalColor;
InboardEngine = inboardEngine;
+ Paddle = paddle;
ProtectiveGlass = protectiveGlass;
}
-}
-
-public class EntityPaddle
-{
- ///
- /// Признак (опция) наличия вёсел
- ///
- public int Paddle { get; private set; }
-
- ///
- /// Инициализация полей объекта-класса вёсел
- ///
- ///
- public void Init(int paddle)
- {
- Paddle = paddle;
- }
}
\ No newline at end of file
diff --git a/ProjectMotorBoat/ProjectMotorBoat/FormMotorBoat.cs b/ProjectMotorBoat/ProjectMotorBoat/FormMotorBoat.cs
index 705ed40..b12a68c 100644
--- a/ProjectMotorBoat/ProjectMotorBoat/FormMotorBoat.cs
+++ b/ProjectMotorBoat/ProjectMotorBoat/FormMotorBoat.cs
@@ -47,7 +47,7 @@ public partial class FormMotorBoat : Form
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
- random.Next(0, 4));
+ Convert.ToBoolean(random.Next(0, 2)));
_drawingMotorBoat.SetPictureSize(pictureBoxMotorBoat.Width, pictureBoxMotorBoat.Height);
_drawingMotorBoat.SetPosition(random.Next(10, 100), random.Next(10, 100));