Sdano
This commit is contained in:
parent
57e4fd46b7
commit
c0b10d25c2
@ -11,7 +11,7 @@ namespace ElectricLocomotive
|
|||||||
public class DrawningElectricLocomotive : DrawningLocomotive
|
public class DrawningElectricLocomotive : DrawningLocomotive
|
||||||
{
|
{
|
||||||
public DrawningElectricLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, bool Horns, int width, int height)
|
public DrawningElectricLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, bool Horns, int width, int height)
|
||||||
: base (speed, weight, bodyColor, additionalColor, width , height)
|
: base (speed, weight, bodyColor, width , height)
|
||||||
{
|
{
|
||||||
if (EntityLocomotive != null)
|
if (EntityLocomotive != null)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ namespace ElectricLocomotive.DrawningObject
|
|||||||
public int GetWidth => _locoWidth;
|
public int GetWidth => _locoWidth;
|
||||||
public int GetHeight => _locoHeight;
|
public int GetHeight => _locoHeight;
|
||||||
|
|
||||||
public DrawningLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, int width, int heigth)
|
public DrawningLocomotive(int speed, double weight, Color bodyColor, int width, int heigth)
|
||||||
{
|
{
|
||||||
if (width < _locoWidth || heigth < _locoHeight)
|
if (width < _locoWidth || heigth < _locoHeight)
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ namespace ElectricLocomotive.DrawningObject
|
|||||||
}
|
}
|
||||||
_pictureWidth = width;
|
_pictureWidth = width;
|
||||||
_pictureHeight = heigth;
|
_pictureHeight = heigth;
|
||||||
EntityLocomotive = new EntityLocomotive(speed, weight, bodyColor, additionalColor);
|
EntityLocomotive = new EntityLocomotive(speed, weight, bodyColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DrawningLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, int width,
|
protected DrawningLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, int width,
|
||||||
@ -53,7 +53,7 @@ namespace ElectricLocomotive.DrawningObject
|
|||||||
_pictureHeight = height;
|
_pictureHeight = height;
|
||||||
_locoWidth = locoWidth;
|
_locoWidth = locoWidth;
|
||||||
_locoHeight = locoHeight;
|
_locoHeight = locoHeight;
|
||||||
EntityLocomotive = new EntityLocomotive(speed, weight, bodyColor, additionalColor);
|
EntityLocomotive = new EntityLocomotive(speed, weight, bodyColor);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Установка позиции
|
/// Установка позиции
|
||||||
@ -124,8 +124,8 @@ namespace ElectricLocomotive.DrawningObject
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Pen pen = new(EntityLocomotive.BodyColor);
|
Pen pen = new(Color.Black);
|
||||||
Brush brush = new SolidBrush(EntityLocomotive.AdditionalColor);
|
Brush brush = new SolidBrush(EntityLocomotive.BodyColor);
|
||||||
///ВЛ60к-1595
|
///ВЛ60к-1595
|
||||||
|
|
||||||
///ходовая
|
///ходовая
|
||||||
|
@ -36,11 +36,10 @@ namespace ElectricLocomotive
|
|||||||
{
|
{
|
||||||
Random random = new();
|
Random random = new();
|
||||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
Color dopColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
|
||||||
ColorDialog dialog = new();
|
ColorDialog dialog = new();
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
color = dialog.Color;
|
color = dialog.Color;
|
||||||
_drawningLocomotive = new DrawningLocomotive(random.Next(100, 300), random.Next(1000, 3000), color, dopColor, pictureBoxElectroLocomotiv.Width, pictureBoxElectroLocomotiv.Height);
|
_drawningLocomotive = new DrawningLocomotive(random.Next(100, 300), random.Next(1000, 3000), color, pictureBoxElectroLocomotiv.Width, pictureBoxElectroLocomotiv.Height);
|
||||||
_drawningLocomotive.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
_drawningLocomotive.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||||
|
|
||||||
Draw();
|
Draw();
|
||||||
@ -51,14 +50,12 @@ namespace ElectricLocomotive
|
|||||||
Random random = new();
|
Random random = new();
|
||||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
Color dopColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
Color dopColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
Color batteryColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
|
||||||
bool Horns = Convert.ToBoolean(random.Next(0, 2));
|
bool Horns = Convert.ToBoolean(random.Next(0, 2));
|
||||||
ColorDialog dialog = new();
|
ColorDialog dialog = new();
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
color = dialog.Color;
|
color = dialog.Color;
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
dopColor = dialog.Color;
|
dopColor = dialog.Color;
|
||||||
|
|
||||||
_drawningLocomotive = new DrawningElectricLocomotive(random.Next(100, 300), random.Next(1000, 3000), color, dopColor, Horns, pictureBoxElectroLocomotiv.Width, pictureBoxElectroLocomotiv.Height);
|
_drawningLocomotive = new DrawningElectricLocomotive(random.Next(100, 300), random.Next(1000, 3000), color, dopColor, Horns, pictureBoxElectroLocomotiv.Width, pictureBoxElectroLocomotiv.Height);
|
||||||
_drawningLocomotive.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
_drawningLocomotive.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||||
Draw();
|
Draw();
|
||||||
|
@ -9,12 +9,15 @@ namespace ElectricLocomotive.Entities
|
|||||||
{
|
{
|
||||||
public class EntityElectroLocomotive : EntityLocomotive
|
public class EntityElectroLocomotive : EntityLocomotive
|
||||||
{
|
{
|
||||||
|
public Color AdditionalColor { get; private set; }
|
||||||
|
|
||||||
public bool Horns { get; private set; }
|
public bool Horns { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Признак (опция) roga
|
/// Признак (опция) roga
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EntityElectroLocomotive(int Speed, double weight, Color bodyColor, Color additionalColor, bool horns) : base(Speed,weight,bodyColor, additionalColor)
|
public EntityElectroLocomotive(int Speed, double weight, Color bodyColor, Color additionalColor, bool horns) : base(Speed,weight,bodyColor)
|
||||||
{
|
{
|
||||||
|
AdditionalColor = additionalColor;
|
||||||
Horns = horns;
|
Horns = horns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,6 @@ namespace ElectricLocomotive.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Color BodyColor { get; private set; }
|
public Color BodyColor { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дополнительный цвет (для опциональных элементов)
|
|
||||||
/// </summary>
|
|
||||||
public Color AdditionalColor { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Признак (опция) наличия обвеса
|
/// Признак (опция) наличия обвеса
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double Step => (double)Speed * 100 / Weight;
|
public double Step => (double)Speed * 100 / Weight;
|
||||||
@ -34,12 +30,11 @@ namespace ElectricLocomotive.Entities
|
|||||||
/// <param name="speed">Скорость</param>
|
/// <param name="speed">Скорость</param>
|
||||||
/// <param name="weight">Вес автомобиля</param>
|
/// <param name="weight">Вес автомобиля</param>
|
||||||
/// <param name="bodyColor">Основной цвет</param>
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
public EntityLocomotive(int speed, double weight, Color bodyColor, Color additionalColor)
|
public EntityLocomotive(int speed, double weight, Color bodyColor)
|
||||||
{
|
{
|
||||||
Speed = speed;
|
Speed = speed;
|
||||||
Weight = weight;
|
Weight = weight;
|
||||||
BodyColor = bodyColor;
|
BodyColor = bodyColor;
|
||||||
AdditionalColor = additionalColor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user