Sorokin_P.V. Lab Work 5 #5

Merged
eegov merged 6 commits from LabWork05 into LabWork04 2022-11-07 10:10:56 +04:00
3 changed files with 5 additions and 15 deletions
Showing only changes of commit cc7aadb10d - Show all commits

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)