From 8bf8eab70b7776d0730b940ef96d171b02b8df7c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D1=81402?= <с402@LAPTOP-GSFF9G8M>
Date: Tue, 12 Mar 2024 11:58:14 +0300
Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D0=BB=20=D0=BD?=
=?UTF-8?q?=D0=B5=D0=BD=D1=83=D0=B6=D0=BD=D0=BE=D0=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Drawnings/DrawningElectricLocomotive.cs | 14 ++------------
.../Drawnings/DrawningLocomotive.cs | 15 +++++----------
.../MovementStrategy/IMoveableObject.cs | 6 ++++++
.../MovementStrategy/MovableLocomotive.cs | 1 +
4 files changed, 14 insertions(+), 22 deletions(-)
diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningElectricLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningElectricLocomotive.cs
index aafc9d9..c9283c8 100644
--- a/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningElectricLocomotive.cs
+++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningElectricLocomotive.cs
@@ -15,7 +15,6 @@ public class DrawningElectricLocomotive : DrawningLocomotive
///
///
///
- ///
///
///
public DrawningElectricLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, bool electricHorns, bool batteryPlacement) : base(83,45)
@@ -32,7 +31,7 @@ public class DrawningElectricLocomotive : DrawningLocomotive
//Создание перьев и кистей для прорисовки электровоза
Brush blackBrush = new SolidBrush(Color.Black);
- Pen penSolid = new(Color.Black, 2);
+ Pen penSolid = new(electricLocomotive.AdditionalColor, 2);
Pen penSolidYellow = new(Color.Yellow, 0.5f);
Brush additionalBrush = new SolidBrush(electricLocomotive.AdditionalColor);
@@ -40,7 +39,6 @@ public class DrawningElectricLocomotive : DrawningLocomotive
if (electricLocomotive.ElectricHorns)
{
-
//Инициализация опорных точек для прорисовки "рогов"
Point pointHorns1 = new Point(_startPosX.Value + 13, _startPosY.Value + 5);
Point pointHorns2 = new Point(_startPosX.Value + 16, _startPosY.Value + 2);
@@ -60,7 +58,7 @@ public class DrawningElectricLocomotive : DrawningLocomotive
Point pointLightning4 = new Point(_startPosX.Value + 37, _startPosY.Value + 41);
//Прорисовка "хранилища батарей" электровоза
- g.FillRectangle(blackBrush, _startPosX.Value + 36, _startPosY.Value + 37, 8, 4.5f);
+ g.FillRectangle(additionalBrush, _startPosX.Value + 36, _startPosY.Value + 37, 8, 4.5f);
g.DrawLine(penSolidYellow, pointLightning1, pointLightning2);
g.DrawLine(penSolidYellow, pointLightning2, pointLightning3);
g.DrawLine(penSolidYellow, pointLightning3, pointLightning4);
@@ -71,14 +69,6 @@ public class DrawningElectricLocomotive : DrawningLocomotive
base.DrawTransport(g);
_startPosY -= 5;
- //Опциональная прорисовка цвета передних колёс
- g.FillEllipse(additionalBrush, _startPosX.Value + 9, _startPosY.Value + 37, 8, 8);
- g.FillEllipse(additionalBrush, _startPosX.Value + 24, _startPosY.Value + 37, 8, 8);
-
- //Опциональная прорисовка цвета задних колёс
- g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 26, _startPosY.Value + 37, 8, 8);
- g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 37, _startPosY.Value + 37, 8, 8);
-
}
}
diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs
index f48b627..b5c64de 100644
--- a/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs
+++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Drawnings/DrawningLocomotive.cs
@@ -65,8 +65,6 @@ public class DrawningLocomotive
///
public int GetHeight => _drawningLocomotiveHeight;
-
-
///
/// Пустой конструктор
///
@@ -137,12 +135,9 @@ public class DrawningLocomotive
return;
}
-
_startPosX = x;
_startPosY = y;
-
-
if (_drawningLocomotiveHeight + y > _pictureHeight)
{
_startPosY = _pictureHeight - _drawningLocomotiveHeight;
@@ -229,6 +224,7 @@ public class DrawningLocomotive
Pen windowPen = new(Color.DeepSkyBlue);
Brush blackBrush = new SolidBrush(Color.Black);
Brush whiteBrush = new SolidBrush(Color.White);
+ Brush additionalBrush = new SolidBrush(EntityLocomotive.BodyColor);
//Инициализация опорных точек для прорисовки корпуса
Point pointStart = new Point(_startPosX.Value + 75, _startPosY.Value + 15);
@@ -285,7 +281,6 @@ public class DrawningLocomotive
g.FillRectangle(brWhite, _startPosX.Value + 36, _startPosY.Value + 11, 7, 10);
-
//Прорисовка передней и задней "юбки"
g.FillRectangle(blackBrush, _startPosX.Value + 7, _startPosY.Value + 32, 25, 5.3f);
g.FillRectangle(blackBrush, _startPosX.Value + 47, _startPosY.Value + 32, 22, 5.3f);
@@ -309,11 +304,11 @@ public class DrawningLocomotive
g.DrawRectangle(windowPen, _startPosX.Value + 63, _startPosY.Value + 4, 8, 8);
//Опциональная прорисовка цвета передних колёс
- g.FillEllipse(whiteBrush, _startPosX.Value + 9, _startPosY.Value + 32, 8, 8);
- g.FillEllipse(whiteBrush, _startPosX.Value + 24, _startPosY.Value + 32, 8, 8);
+ g.FillEllipse(additionalBrush, _startPosX.Value + 9, _startPosY.Value + 32, 8, 8);
+ g.FillEllipse(additionalBrush, _startPosX.Value + 24, _startPosY.Value + 32, 8, 8);
//Опциональная прорисовка цвета задних колёс
- g.FillEllipse(whiteBrush, _startPosX.Value + 25 + 26, _startPosY.Value + 32, 8, 8);
- g.FillEllipse(whiteBrush, _startPosX.Value + 25 + 37, _startPosY.Value + 32, 8, 8);
+ g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 26, _startPosY.Value + 32, 8, 8);
+ g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 37, _startPosY.Value + 32, 8, 8);
}
}
diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs
index 209f702..ecc6e64 100644
--- a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs
+++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/IMoveableObject.cs
@@ -24,4 +24,10 @@ public interface IMoveableObject
/// Направление
/// True - объект перемещен, false - перемещение невозможно
bool TryMoveObject(MovementDirection direction);
+
+ ///
+ /// Метод интерфейса для доп.задания
+ ///
+ ///
+
}
diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs
index d45a96a..ffd5249 100644
--- a/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs
+++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/MovementStrategy/MovableLocomotive.cs
@@ -64,4 +64,5 @@ public class MoveableLocomotive : IMoveableObject
_ => DirectionType.Unknow,
};
}
+
}