From 0aaea573da2d8112d93e3665fc74f7bd44ea6d74 Mon Sep 17 00:00:00 2001 From: kaznacheeva Date: Wed, 27 Sep 2023 09:47:12 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=D0=B0=20=D0=B2=D1=81=D0=B5=20=D0=BD=D0=B5=D0=B4=D0=BE?= =?UTF-8?q?=D1=87=D0=B5=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Battleship/Battleship/Battleship.cs | 2 +- Battleship/Battleship/DrawningBattleship.cs | 58 ++++++++++----------- Battleship/Battleship/EntityBattleship.cs | 13 ++--- 3 files changed, 32 insertions(+), 41 deletions(-) diff --git a/Battleship/Battleship/Battleship.cs b/Battleship/Battleship/Battleship.cs index 93b0e84..36ee80e 100644 --- a/Battleship/Battleship/Battleship.cs +++ b/Battleship/Battleship/Battleship.cs @@ -13,7 +13,7 @@ namespace Battleship { InitializeComponent(); } - /// Μεςξδ οπξπθρξβκθ μΰψθνϋ + /// Μεςξδ οπξπθρξβκθ /// private void Draw() { diff --git a/Battleship/Battleship/DrawningBattleship.cs b/Battleship/Battleship/DrawningBattleship.cs index f538086..80f2e97 100644 --- a/Battleship/Battleship/DrawningBattleship.cs +++ b/Battleship/Battleship/DrawningBattleship.cs @@ -24,51 +24,49 @@ namespace Battleship /// private int _pictureHeight; /// - /// ЛСвая ΠΊΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚Π° прорисовки автомобиля + /// ЛСвая ΠΊΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚Π° прорисовки /// private int _startPosX; /// - /// ВСрхняя ΠΊΠΎΠΎΡ€ΠΈΠ΄Π½Π°Ρ‚Π° прорисовки автомобиля + /// ВСрхняя ΠΊΠΎΠΎΡ€ΠΈΠ΄Π½Π°Ρ‚Π° прорисовки /// private int _startPosY; /// - /// Π¨ΠΈΡ€ΠΈΠ½Π° прорисовки автомобиля + /// Π¨ΠΈΡ€ΠΈΠ½Π° прорисовки /// private readonly int _buttleshipWidth = 175; /// - /// Высота прорисовки автомобиля + /// Высота прорисовки /// private readonly int _buttleshipHeight = 80; - ///// - ///// Π˜Π½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·Π°Ρ†ΠΈΡ свойств - ///// - ///// Π‘ΠΊΠΎΡ€ΠΎΡΡ‚ΡŒ - ///// ВСс - ///// Π¦Π²Π΅Ρ‚ ΠΊΡƒΠ·ΠΎΠ²Π° - ///// Π”ΠΎΠΏΠΎΠ»Π½ΠΈΡ‚Π΅Π»ΡŒΠ½Ρ‹ΠΉ Ρ†Π²Π΅Ρ‚ - ///// ΠŸΡ€ΠΈΠ·Π½Π°ΠΊ наличия обвСса - ///// ΠŸΡ€ΠΈΠ·Π½Π°ΠΊ наличия Π°Π½Ρ‚ΠΈΠΊΡ€Ρ‹Π»Π° - ///// ΠŸΡ€ΠΈΠ·Π½Π°ΠΊ наличия Π³ΠΎΠ½ΠΎΡ‡Π½ΠΎΠΉ полосы - ///// Π¨ΠΈΡ€ΠΈΠ½Π° ΠΊΠ°Ρ€Ρ‚ΠΈΠ½ΠΊΠΈ - ///// Высота ΠΊΠ°Ρ€Ρ‚ΠΈΠ½ΠΊΠΈ - ///// true - ΠΎΠ±ΡŠΠ΅ΠΊΡ‚ создан, false - ΠΏΡ€ΠΎΠ²Π΅Ρ€ΠΊΠ° Π½Π΅ ΠΏΡ€ΠΎΠΉΠ΄Π΅Π½Π°, - /////нСльзя ΡΠΎΠ·Π΄Π°Ρ‚ΡŒ ΠΎΠ±ΡŠΠ΅ΠΊΡ‚ Π² этих Ρ€Π°Π·ΠΌΠ΅Ρ€Π°Ρ… + /// + /// Π˜Π½ΠΈΡ†ΠΈΠ°Π»ΠΈΠ·Π°Ρ†ΠΈΡ свойств + /// + /// Π‘ΠΊΠΎΡ€ΠΎΡΡ‚ΡŒ + /// ВСс + /// Π¦Π²Π΅Ρ‚ основы + /// Π”ΠΎΠΏΠΎΠ»Π½ΠΈΡ‚Π΅Π»ΡŒΠ½Ρ‹ΠΉ Ρ†Π²Π΅Ρ‚ + /// ΠŸΡ€ΠΈΠ·Π½Π°ΠΊ наличия ΠΎΡ€ΡƒΠ΄ΠΈΠΉΠ½ΠΎΠΉ башни + /// ΠŸΡ€ΠΈΠ·Π½Π°ΠΊ наличия отсСка ΠΏΠΎΠ΄ Ρ€Π°ΠΊΠ΅Ρ‚Ρ‹ + /// Π¨ΠΈΡ€ΠΈΠ½Π° ΠΊΠ°Ρ€Ρ‚ΠΈΠ½ΠΊΠΈ + /// Высота ΠΊΠ°Ρ€Ρ‚ΠΈΠ½ΠΊΠΈ + /// true - ΠΎΠ±ΡŠΠ΅ΠΊΡ‚ создан, false - ΠΏΡ€ΠΎΠ²Π΅Ρ€ΠΊΠ° Π½Π΅ ΠΏΡ€ΠΎΠΉΠ΄Π΅Π½Π°, + ///нСльзя ΡΠΎΠ·Π΄Π°Ρ‚ΡŒ ΠΎΠ±ΡŠΠ΅ΠΊΡ‚ Π² этих Ρ€Π°Π·ΠΌΠ΅Ρ€Π°Ρ… - public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool tower, bool section, int width, int height) + public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool tower, bool section, int width, int height) { - // TODO: ΠŸΡ€ΠΎΠ΄ΡƒΠΌΠ°Ρ‚ΡŒ ΠΏΡ€ΠΎΠ²Π΅Ρ€ΠΊΠΈ - if(width < _buttleshipWidth || height < _buttleshipHeight) + if (width < _buttleshipWidth || height < _buttleshipHeight) { return false; } - _pictureWidth = width; _pictureHeight = height; EntityBattleship = new EntityBattleship(); - EntityBattleship.Init(speed, weight, bodyColor, additionalColor, + EntityBattleship.Init(speed, weight, bodyColor, additionalColor, tower, section); return true; } + /// /// Установка ΠΏΠΎΠ·ΠΈΡ†ΠΈΠΈ /// @@ -76,7 +74,6 @@ namespace Battleship /// ΠšΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚Π° Y public void SetPosition(int x, int y) { - // TODO: ИзмСнСниС x, y if (x >= 0 && x + _buttleshipWidth <= _pictureWidth && y >= 0 && y + _buttleshipHeight <= _pictureHeight) { _startPosX = x; @@ -93,7 +90,6 @@ namespace Battleship { return; } - switch (direction) { //Π²Π»Π΅Π²ΠΎ @@ -144,11 +140,11 @@ namespace Battleship Brush mainBrush = new SolidBrush(EntityBattleship.BodyColor); Point[] hull = new Point[] { - new Point(_startPosX + 10, _startPosY + 0), + new Point(_startPosX + 5, _startPosY + 0), new Point(_startPosX + 120, _startPosY + 0), new Point(_startPosX + 160, _startPosY + 35), new Point(_startPosX + 120, _startPosY + 70), - new Point(_startPosX + 10, _startPosY + 70), + new Point(_startPosX + 5, _startPosY + 70), }; g.FillPolygon(mainBrush, hull); g.DrawPolygon(pen, hull); @@ -168,10 +164,10 @@ namespace Battleship //для ускорСния Brush speedBrush = new SolidBrush(Color.Gold); - g.FillRectangle(speedBrush, _startPosX + 5, _startPosY + 10, 5, 20); - g.DrawRectangle(pen, _startPosX + 5, _startPosY + 10, 5, 20); - g.FillRectangle(speedBrush, _startPosX + 5, _startPosY + 40, 5, 20); - g.DrawRectangle(pen, _startPosX + 5, _startPosY + 40, 5, 20); + g.FillRectangle(speedBrush, _startPosX + 0, _startPosY + 10, 5, 20); + g.DrawRectangle(pen, _startPosX + 0, _startPosY + 10, 5, 20); + g.FillRectangle(speedBrush, _startPosX + 0, _startPosY + 40, 5, 20); + g.DrawRectangle(pen, _startPosX + 0, _startPosY + 40, 5, 20); //орудийная башня if (EntityBattleship.Tower) diff --git a/Battleship/Battleship/EntityBattleship.cs b/Battleship/Battleship/EntityBattleship.cs index e3ce06a..425529a 100644 --- a/Battleship/Battleship/EntityBattleship.cs +++ b/Battleship/Battleship/EntityBattleship.cs @@ -25,19 +25,15 @@ namespace Battleship /// public Color AdditionalColor { get; private set; } /// - /// ΠŸΡ€ΠΈΠ·Π½Π°ΠΊ (опция) наличия обвСса + /// ΠŸΡ€ΠΈΠ·Π½Π°ΠΊ (опция) наличия башни /// - //public bool BodyKit { get; private set; } - // /// - // /// ΠŸΡ€ΠΈΠ·Π½Π°ΠΊ (опция) наличия башни - // /// public bool Tower { get; private set; } /// /// ΠŸΡ€ΠΈΠ·Π½Π°ΠΊ (опция) наличия сСкции ΠΏΠΎΠ΄ Ρ€Π°ΠΊΠ΅Ρ‚Ρ‹ /// public bool Section { get; private set; } /// - /// Π¨Π°Π³ пСрСмСщСния автомобиля + /// Π¨Π°Π³ пСрСмСщСния /// public double Step => (double)Speed * 100 / Weight; /// @@ -47,9 +43,8 @@ namespace Battleship /// ВСс автомобиля /// Основной Ρ†Π²Π΅Ρ‚ /// Π”ΠΎΠΏΠΎΠ»Π½ΠΈΡ‚Π΅Π»ΡŒΠ½Ρ‹ΠΉ Ρ†Π²Π΅Ρ‚ - /// ΠŸΡ€ΠΈΠ·Π½Π°ΠΊ наличия обвСса - /// ΠŸΡ€ΠΈΠ·Π½Π°ΠΊ наличия Π°Π½Ρ‚ΠΈΠΊΡ€Ρ‹Π»Π° - /// ΠŸΡ€ΠΈΠ·Π½Π°ΠΊ наличия Π³ΠΎΠ½ΠΎΡ‡Π½ΠΎΠΉ полосы + /// ΠŸΡ€ΠΈΠ·Π½Π°ΠΊ наличия ΠΎΡ€ΡƒΠ΄ΠΈΠΉΠ½ΠΎΠΉ башни + /// ΠŸΡ€ΠΈΠ·Π½Π°ΠΊ наличия отсСка ΠΏΠΎΠ΄ Ρ€Π°ΠΊΠ΅Ρ‚Ρ‹ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool tower, bool section) {