From cc7aadb10dbb56622d7976ede17be62ce079d502 Mon Sep 17 00:00:00 2001 From: Pavel_Sorokin Date: Thu, 3 Nov 2022 14:31:20 +0400 Subject: [PATCH] =?UTF-8?q?=D0=95=D1=89=D0=B5=20=D0=BD=D0=B5=D0=BC=D0=BD?= =?UTF-8?q?=D0=BE=D0=B3=D0=BE=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Liner/Liner/DrawingLiner.cs | 9 +-------- Liner/Liner/DrawingShip.cs | 5 +---- Liner/Liner/FormShipConfig.cs | 6 +++--- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/Liner/Liner/DrawingLiner.cs b/Liner/Liner/DrawingLiner.cs index 28d4270..9ae0a3f 100644 --- a/Liner/Liner/DrawingLiner.cs +++ b/Liner/Liner/DrawingLiner.cs @@ -13,14 +13,7 @@ namespace Liner { Ship = new EntityLiner(speed, weight, bodyColor, dopColor, dopDeck, pool); } - public void SetDopColor(Color color) - { - if (Ship is not EntityLiner liner) - { - return; - } - liner.DopColor = color; - } + public override void DrawTransport(Graphics g) { if (Ship is not EntityLiner liner) diff --git a/Liner/Liner/DrawingShip.cs b/Liner/Liner/DrawingShip.cs index 156fc36..427c1ac 100644 --- a/Liner/Liner/DrawingShip.cs +++ b/Liner/Liner/DrawingShip.cs @@ -25,10 +25,7 @@ namespace Liner _ShipWidth = shipWidth; _ShipHeight = shipHeight; } - public void SetColor(Color color) - { - Ship.BodyColor = color; - } + public void SetPosition(int x, int y, int width, int height) { if (width <= _ShipWidth + x || height <= _ShipHeight + y || x<0 || y<0) diff --git a/Liner/Liner/FormShipConfig.cs b/Liner/Liner/FormShipConfig.cs index 169e877..64b7914 100644 --- a/Liner/Liner/FormShipConfig.cs +++ b/Liner/Liner/FormShipConfig.cs @@ -97,16 +97,16 @@ namespace Liner { return; } - _ship.SetColor((Color)e.Data.GetData(typeof(Color))); + _ship.Ship.BodyColor=(Color)e.Data.GetData(typeof(Color)); DrawShip(); } private void LabelDopColor_DragDrop(object sender, DragEventArgs e) { - if (_ship == null || _ship is not DrawningLiner liner) + if (_ship == null || _ship.Ship is not EntityLiner liner) { return; } - liner.SetDopColor((Color)e.Data.GetData(typeof(Color))); + liner.DopColor=(Color)e.Data.GetData(typeof(Color)); DrawShip(); } private void ButtonAdd_Click(object sender, EventArgs e)