Еще немного изменений.

This commit is contained in:
Павел Сорокин 2022-11-03 14:31:20 +04:00
parent 7132f8f322
commit cc7aadb10d
3 changed files with 5 additions and 15 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)