Фиксация
This commit is contained in:
parent
fe5fe24f5a
commit
e51d851a32
@ -8,7 +8,7 @@ namespace WarmlyShip
|
||||
{
|
||||
internal class DrawningMotorShip : DrawningWarmlyShip
|
||||
{
|
||||
public DrawningMotorShip(int speed, float weight, Color bodyColor, Color dopColor, bool tubes, bool cistern) : base(speed, weight, bodyColor, 110, 60)
|
||||
public DrawningMotorShip(int speed, float weight, Color bodyColor, Color dopColor, bool tubes, bool cistern) : base(speed, weight, bodyColor, 150, 75)
|
||||
{
|
||||
warmlyShip = new EntityMotorShip(speed, weight, bodyColor, dopColor, tubes , cistern);
|
||||
}
|
||||
@ -20,14 +20,24 @@ namespace WarmlyShip
|
||||
return;
|
||||
}
|
||||
|
||||
Pen pen = new(Color.Black, 2);
|
||||
Brush dopBrush = new SolidBrush(motorShip.DopColor);
|
||||
if (motorShip.Tubes)
|
||||
{
|
||||
|
||||
g.FillRectangle(dopBrush, _startPosX + _warmlyShipWidth / 5, _startPosY, _warmlyShipWidth / 5, _warmlyShipHeight / 2);
|
||||
g.DrawRectangle(pen, _startPosX + _warmlyShipWidth / 5, _startPosY, _warmlyShipWidth / 5, _warmlyShipHeight / 2);
|
||||
g.FillRectangle(dopBrush, _startPosX + _warmlyShipWidth * 3 / 5, _startPosY, _warmlyShipWidth / 5, _warmlyShipHeight / 2);
|
||||
g.DrawRectangle(pen, _startPosX + _warmlyShipWidth * 3 / 5, _startPosY, _warmlyShipWidth / 5, _warmlyShipHeight / 2);
|
||||
}
|
||||
|
||||
_startPosY += 25;
|
||||
base.DrawTransport(g);
|
||||
_startPosY -= 25;
|
||||
|
||||
if (motorShip.Cistern)
|
||||
{
|
||||
|
||||
g.FillEllipse(dopBrush, _startPosX, _startPosY + 25, 25, 20);
|
||||
g.DrawEllipse(pen, _startPosX, _startPosY + 25, 25, 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ namespace WarmlyShip
|
||||
protected float _startPosY; //Координаты отрисовки по оси y
|
||||
private int? _pictureWidth = null; //Ширина окна
|
||||
private int? _pictureHeight = null; //Высота окна
|
||||
private readonly int _warmlyShipWidth = 125; //Ширина отрисовки корабля
|
||||
private readonly int _warmlyShipHeight = 50; //Высота отрисовки корабля
|
||||
protected readonly int _warmlyShipWidth = 125; //Ширина отрисовки корабля
|
||||
protected readonly int _warmlyShipHeight = 50; //Высота отрисовки корабля
|
||||
|
||||
//Конструктор класса
|
||||
public DrawningWarmlyShip(int speed, float weight, Color bodyColor)
|
||||
@ -73,8 +73,8 @@ namespace WarmlyShip
|
||||
{
|
||||
new Point((int)(_startPosX), (int)(_startPosY + 20)),
|
||||
new Point((int)(_startPosX + _warmlyShipWidth), (int)(_startPosY + 20)),
|
||||
new Point((int)(_startPosX + _warmlyShipWidth - 25), (int)(_startPosY + _warmlyShipHeight)),
|
||||
new Point((int)(_startPosX + 25), (int)(_startPosY + _warmlyShipHeight))
|
||||
new Point((int)(_startPosX + _warmlyShipWidth - 25), (int)(_startPosY + 50)),
|
||||
new Point((int)(_startPosX + 25), (int)(_startPosY +50))
|
||||
});
|
||||
g.FillRectangle(brush, _startPosX + _warmlyShipWidth / 5, _startPosY, _warmlyShipWidth * 3 / 5, 20);
|
||||
g.FillEllipse(new SolidBrush(Color.Aquamarine), _startPosX + _warmlyShipWidth / 5, _startPosY + 25, 20, 20);
|
||||
@ -84,8 +84,8 @@ namespace WarmlyShip
|
||||
{
|
||||
new Point((int)(_startPosX), (int)(_startPosY + 20)),
|
||||
new Point((int)(_startPosX + _warmlyShipWidth), (int)(_startPosY + 20)),
|
||||
new Point((int)(_startPosX + _warmlyShipWidth - 25), (int)(_startPosY + _warmlyShipHeight)),
|
||||
new Point((int)(_startPosX + 25), (int)(_startPosY + _warmlyShipHeight))
|
||||
new Point((int)(_startPosX + _warmlyShipWidth - 25), (int)(_startPosY + 50)),
|
||||
new Point((int)(_startPosX + 25), (int)(_startPosY + 50))
|
||||
});
|
||||
g.DrawRectangle(pen, _startPosX + _warmlyShipWidth / 5, _startPosY, _warmlyShipWidth * 3 / 5, 20);
|
||||
g.DrawEllipse(new(Color.Blue, 2), _startPosX + _warmlyShipWidth / 5, _startPosY + 25, 20, 20);
|
||||
|
@ -20,7 +20,7 @@ namespace WarmlyShip
|
||||
private void SetData()
|
||||
{
|
||||
Random random = new Random();
|
||||
_warmlyShip.SetPosition(random.Next(pictureBox.Width - 150, pictureBox.Width - 125), random.Next(pictureBox.Height - 150, pictureBox.Height - 50), pictureBox.Width, pictureBox.Height);
|
||||
_warmlyShip.SetPosition(random.Next(0, 100), random.Next(0, 100), pictureBox.Width, pictureBox.Height);
|
||||
toolStripStatusSpeed.Text = $"Ñêîðîñòü: {_warmlyShip.warmlyShip?.Speed}";
|
||||
toolStripStatusWeight.Text = $"Âåñ: {_warmlyShip.warmlyShip?.Weight}";
|
||||
toolStripStatusLabelBodyColor.Text = $"Öâåò: {_warmlyShip.warmlyShip?.BodyColor}";
|
||||
@ -67,7 +67,7 @@ namespace WarmlyShip
|
||||
_warmlyShip = new DrawningMotorShip(random.Next(100, 300), random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Convert.ToBoolean(random.Next(0, 1)), Convert.ToBoolean(random.Next(0, 1)));
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||
SetData();
|
||||
Draw();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user