From 1c81aec3af02b85a1dac9ed5abd2603e123c1e64 Mon Sep 17 00:00:00 2001 From: kaznacheeva Date: Tue, 5 Dec 2023 21:52:05 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Battleship/Battleship/DrawningBattleship.cs | 4 ++++ Battleship/Battleship/DrawningShip.cs | 8 ++++++++ Battleship/Battleship/EntityBattleship.cs | 6 +++--- Battleship/Battleship/EntityShip.cs | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Battleship/Battleship/DrawningBattleship.cs b/Battleship/Battleship/DrawningBattleship.cs index c0c8d7a..524c6ba 100644 --- a/Battleship/Battleship/DrawningBattleship.cs +++ b/Battleship/Battleship/DrawningBattleship.cs @@ -48,5 +48,9 @@ namespace Battleship.DrawningObjects g.DrawRectangle(pen, _startPosX + 75, _startPosY + 70, 40, 10); } } + public void SetAddColor(Color color) + { + ((EntityBattleship)EntityShip).AdditionalColor = color; + } } } diff --git a/Battleship/Battleship/DrawningShip.cs b/Battleship/Battleship/DrawningShip.cs index 6a56b76..a2153b7 100644 --- a/Battleship/Battleship/DrawningShip.cs +++ b/Battleship/Battleship/DrawningShip.cs @@ -224,6 +224,14 @@ namespace Battleship.DrawningObjects break; } } + public void SetColor(Color color) + { + if (EntityShip == null) + { + return; + } + EntityShip.BodyColor = color; + } } } diff --git a/Battleship/Battleship/EntityBattleship.cs b/Battleship/Battleship/EntityBattleship.cs index f3cd02c..449953c 100644 --- a/Battleship/Battleship/EntityBattleship.cs +++ b/Battleship/Battleship/EntityBattleship.cs @@ -10,7 +10,7 @@ namespace Battleship.Entities internal class EntityBattleship: EntityShip { - public Color AdditionalColor { get; private set; } + public Color AdditionalColor { get; set; } /// /// Признак (опция) наличия башни /// @@ -39,10 +39,10 @@ namespace Battleship.Entities Tower = tower; Section = section; } - - internal void setAdditionalColor(Color color) + public void setAdditionalColor(Color color) { AdditionalColor = color; } + } } diff --git a/Battleship/Battleship/EntityShip.cs b/Battleship/Battleship/EntityShip.cs index db19207..e46dcc4 100644 --- a/Battleship/Battleship/EntityShip.cs +++ b/Battleship/Battleship/EntityShip.cs @@ -19,7 +19,7 @@ namespace Battleship.Entities /// /// Основной цвет /// - public Color BodyColor { get; private set; } + public Color BodyColor { get; set; } /// /// Дополнительный цвет (для опциональных элементов) ///