переделывание свойства доп. класса
This commit is contained in:
parent
f6c10b9cf0
commit
515079e770
@ -4,9 +4,8 @@
|
|||||||
{
|
{
|
||||||
private WheelsNumber wheelsNumber;
|
private WheelsNumber wheelsNumber;
|
||||||
|
|
||||||
public int _wheelsNumber
|
public int WheelsNum
|
||||||
{
|
{
|
||||||
get => (int)wheelsNumber;
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < 2 || value > 4)
|
if (value < 2 || value > 4)
|
||||||
@ -22,24 +21,23 @@
|
|||||||
public void DrawWheels(Graphics g, float startPosX, float startPosY, Color wheelsColor)
|
public void DrawWheels(Graphics g, float startPosX, float startPosY, Color wheelsColor)
|
||||||
{
|
{
|
||||||
Pen pen = new(wheelsColor);
|
Pen pen = new(wheelsColor);
|
||||||
switch (_wheelsNumber)
|
switch (wheelsNumber)
|
||||||
{
|
{
|
||||||
case 2:
|
case WheelsNumber.Two:
|
||||||
g.DrawEllipse(pen, startPosX + 20, startPosY + 40, 20, 15);
|
g.DrawEllipse(pen, startPosX + 20, startPosY + 40, 20, 15);
|
||||||
g.DrawEllipse(pen, startPosX + 120, startPosY + 40, 20, 15);
|
g.DrawEllipse(pen, startPosX + 120, startPosY + 40, 20, 15);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case WheelsNumber.Three:
|
||||||
g.DrawEllipse(pen, startPosX + 20, startPosY + 40, 20, 15);
|
g.DrawEllipse(pen, startPosX + 20, startPosY + 40, 20, 15);
|
||||||
g.DrawEllipse(pen, startPosX + 90, startPosY + 40, 20, 15);
|
g.DrawEllipse(pen, startPosX + 90, startPosY + 40, 20, 15);
|
||||||
g.DrawEllipse(pen, startPosX + 120, startPosY + 40, 20, 15);
|
g.DrawEllipse(pen, startPosX + 120, startPosY + 40, 20, 15);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case WheelsNumber.Four:
|
||||||
g.DrawEllipse(pen, startPosX + 20, startPosY + 40, 20, 15);
|
g.DrawEllipse(pen, startPosX + 20, startPosY + 40, 20, 15);
|
||||||
g.DrawEllipse(pen, startPosX + 50, startPosY + 40, 20, 15);
|
g.DrawEllipse(pen, startPosX + 50, startPosY + 40, 20, 15);
|
||||||
g.DrawEllipse(pen, startPosX + 90, startPosY + 40, 20, 15);
|
g.DrawEllipse(pen, startPosX + 90, startPosY + 40, 20, 15);
|
||||||
g.DrawEllipse(pen, startPosX + 120, startPosY + 40, 20, 15);
|
g.DrawEllipse(pen, startPosX + 120, startPosY + 40, 20, 15);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
toolStripStatusLabelSpeed.Text = $"Скорость: {_locomotive.Locomotive.Speed}";
|
toolStripStatusLabelSpeed.Text = $"Скорость: {_locomotive.Locomotive.Speed}";
|
||||||
toolStripStatusLabelWeight.Text = $"Вес: {_locomotive.Locomotive.Weight}";
|
toolStripStatusLabelWeight.Text = $"Вес: {_locomotive.Locomotive.Weight}";
|
||||||
toolStripStatusLabelBodyColor.Text = $"Цвет: {_locomotive.Locomotive.BodyColor.Name}";
|
toolStripStatusLabelBodyColor.Text = $"Цвет: {_locomotive.Locomotive.BodyColor.Name}";
|
||||||
_locomotive.Wheels._wheelsNumber = (int)numericUpDownWheelsNumber.Value;
|
_locomotive.Wheels.WheelsNum = (int)numericUpDownWheelsNumber.Value;
|
||||||
Draw();
|
Draw();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user