итоговые корректировки лабы 5
This commit is contained in:
parent
03c0f7a6ff
commit
7451b27628
@ -144,20 +144,6 @@ namespace Sailboat.DrawingObjects
|
|||||||
g.DrawEllipse(pen, _startPosX + 20, _startPosY + 100, 90, 40);
|
g.DrawEllipse(pen, _startPosX + 20, _startPosY + 100, 90, 40);
|
||||||
|
|
||||||
}
|
}
|
||||||
public void SetColor(Color color)
|
|
||||||
{
|
|
||||||
if (EntityBoat == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
EntityBoat.BodyColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight)
|
|
||||||
{
|
|
||||||
_pictureWidth = pictureBoxWidth;
|
|
||||||
_pictureHeight = pictureBoxHeight;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,10 +64,5 @@ namespace Sailboat.DrawingObjects
|
|||||||
g.DrawLine(pen, new Point(_startPosX + 65, _startPosY + 120), new Point(_startPosX + 65, _startPosY));
|
g.DrawLine(pen, new Point(_startPosX + 65, _startPosY + 120), new Point(_startPosX + 65, _startPosY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAddColor(Color color)
|
|
||||||
{
|
|
||||||
((EntitySailboat)EntityBoat).AdditionalColor = color;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,8 @@ namespace Sailboat.Entities
|
|||||||
{
|
{
|
||||||
public int Speed { get; private set; }
|
public int Speed { get; private set; }
|
||||||
public double Weight { get; private set; }
|
public double Weight { get; private set; }
|
||||||
public Color BodyColor { get; set; }
|
public Color BodyColor { get; private set; }
|
||||||
|
public void setBodyColor(Color color) { BodyColor = color; }
|
||||||
public double Step => (double)Speed * 100 / Weight;
|
public double Step => (double)Speed * 100 / Weight;
|
||||||
public EntityBoat(int speed, double weight, Color bodyColor)
|
public EntityBoat(int speed, double weight, Color bodyColor)
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,8 @@ namespace Sailboat.Entities
|
|||||||
{
|
{
|
||||||
public class EntitySailboat : EntityBoat
|
public class EntitySailboat : EntityBoat
|
||||||
{
|
{
|
||||||
public Color AdditionalColor { get; set; }
|
public Color AdditionalColor { get; private set; }
|
||||||
|
public void setAdditionalColor(Color color) { AdditionalColor = color; }
|
||||||
public bool Hull { get; private set; }
|
public bool Hull { get; private set; }
|
||||||
public bool Sail { get; private set; }
|
public bool Sail { get; private set; }
|
||||||
public EntitySailboat(int speed, double weight, Color bodyColor, Color
|
public EntitySailboat(int speed, double weight, Color bodyColor, Color
|
||||||
|
@ -11,6 +11,7 @@ using System.Windows.Forms;
|
|||||||
using Sailboat.DrawingObjects;
|
using Sailboat.DrawingObjects;
|
||||||
using Sailboat.Generics;
|
using Sailboat.Generics;
|
||||||
using Sailboat.MovementStrategy;
|
using Sailboat.MovementStrategy;
|
||||||
|
using Sailboat.Entities;
|
||||||
|
|
||||||
namespace Sailboat
|
namespace Sailboat
|
||||||
{
|
{
|
||||||
@ -100,12 +101,12 @@ namespace Sailboat
|
|||||||
switch (((Label)sender).Name)
|
switch (((Label)sender).Name)
|
||||||
{
|
{
|
||||||
case "labelColor":
|
case "labelColor":
|
||||||
_boat.SetColor((Color)e.Data.GetData(typeof(Color)));
|
_boat.EntityBoat.setBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
break;
|
break;
|
||||||
case "labelAddColor":
|
case "labelAddColor":
|
||||||
if (!(_boat is DrawingSailboat))
|
if (!(_boat is DrawingSailboat))
|
||||||
return;
|
return;
|
||||||
(_boat as DrawingSailboat).SetAddColor((Color)e.Data.GetData(typeof(Color)));
|
(_boat.EntityBoat as EntitySailboat).setAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DrawBoat();
|
DrawBoat();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user