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