база + доп отрисовка
This commit is contained in:
parent
903f8f6e46
commit
065dd3cc40
@ -6,6 +6,10 @@
|
||||
|
||||
public int WheelsNum
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)wheelsNumber;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 2 || value > 4)
|
||||
|
@ -6,6 +6,10 @@
|
||||
|
||||
public int WheelsNum
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)wheelsNumber;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 2 || value > 4)
|
||||
|
@ -6,6 +6,10 @@
|
||||
|
||||
public int WheelsNum
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)wheelsNumber;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 2 || value > 4)
|
||||
|
@ -17,7 +17,7 @@
|
||||
public static string GetDataForSave(this DrawningLocomotive drawningLocomotive)
|
||||
{
|
||||
var locomotive = drawningLocomotive.Locomotive;
|
||||
var str = $"{locomotive.Speed}{_separatorForObject}{locomotive.Weight}{_separatorForObject}{locomotive.BodyColor.Name}";
|
||||
var str = $"{locomotive.Speed}{_separatorForObject}{locomotive.Weight}{_separatorForObject}{locomotive.BodyColor.Name}{_separatorForObject}{drawningLocomotive.AdditionalElements.WheelsNum}{_separatorForObject}{drawningLocomotive.AdditionalElements.GetType().Name}";
|
||||
if (locomotive is not EntityWarmlyLocomotive warmlyLocomotive)
|
||||
{
|
||||
return str;
|
||||
@ -32,19 +32,33 @@
|
||||
public static DrawningLocomotive CreateDrawningLocomotive(this string info)
|
||||
{
|
||||
string[] strs = info.Split(_separatorForObject);
|
||||
if (strs.Length == 3)
|
||||
DrawningLocomotive recreatedLocomotive = null;
|
||||
if (strs.Length == 5)
|
||||
{
|
||||
return new DrawningLocomotive(Convert.ToInt32(strs[0]), Convert.ToInt32(strs[1]), Color.FromName(strs[2]));
|
||||
recreatedLocomotive = new DrawningLocomotive(Convert.ToInt32(strs[0]), Convert.ToInt32(strs[1]), Color.FromName(strs[2]));
|
||||
}
|
||||
if (strs.Length == 6)
|
||||
if (strs.Length == 8)
|
||||
{
|
||||
return new DrawningWarmlyLocomotive
|
||||
recreatedLocomotive = new DrawningWarmlyLocomotive
|
||||
(
|
||||
Convert.ToInt32(strs[0]), Convert.ToInt32(strs[1]), Color.FromName(strs[2]), 160, 85,
|
||||
Color.FromName(strs[3]), Convert.ToBoolean(strs[4]), Convert.ToBoolean(strs[5])
|
||||
Color.FromName(strs[5]), Convert.ToBoolean(strs[6]), Convert.ToBoolean(strs[7])
|
||||
);
|
||||
}
|
||||
return null;
|
||||
switch (strs[4])
|
||||
{
|
||||
case "DrawningWheels":
|
||||
recreatedLocomotive.AdditionalElements = new DrawningWheels();
|
||||
break;
|
||||
case "DrawningRectOrnament":
|
||||
recreatedLocomotive.AdditionalElements = new DrawningRectOrnament();
|
||||
break;
|
||||
case "DrawningEllipseOrnament":
|
||||
recreatedLocomotive.AdditionalElements = new DrawningEllipseOrnament();
|
||||
break;
|
||||
}
|
||||
recreatedLocomotive.AdditionalElements.WheelsNum = Convert.ToInt32(strs[3]);
|
||||
return recreatedLocomotive;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
/// <summary>
|
||||
/// Свойство получения количества колёс
|
||||
/// </summary>
|
||||
public int WheelsNum { set; }
|
||||
public int WheelsNum { get; set; }
|
||||
/// <summary>
|
||||
/// Отрисовка колёс
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user