LabWork_06 #12
@ -36,5 +36,9 @@ namespace WarmlyShip
|
||||
{
|
||||
_warmlyShip?.SetPosition(x, y, width, height);
|
||||
}
|
||||
|
||||
public string GetInfo() => _warmlyShip?.GetDataForSave();
|
||||
|
||||
public static IDrawningObject Create(string data) => new DrawningObjectShip(data.CreateDrawningShip());
|
||||
}
|
||||
}
|
||||
|
@ -21,5 +21,11 @@ namespace WarmlyShip
|
||||
Weight = weight <= 0 ? random.Next(1000, 2000) : weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
|
||||
public static EntityWarmlyShip Creator(string data)
|
||||
{
|
||||
string[] strs = data.Split(':');
|
||||
return new EntityWarmlyShip(Convert.ToInt32(strs[0]), Convert.ToInt32(strs[1]), Color.FromName(strs[2]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ namespace WarmlyShip
|
||||
|
||||
private static readonly char _separatorForObject = ':';
|
||||
|
||||
public static DrawingWarmlyShip CreateDrawningCar(this string info)
|
||||
public static DrawingWarmlyShip CreateDrawningShip(this string info)
|
||||
{
|
||||
string[] strs = info.Split(_separatorForObject);
|
||||
if (strs.Length == 3)
|
||||
|
@ -13,5 +13,7 @@ namespace WarmlyShip
|
||||
void MoveObject(Direction direction);
|
||||
void DrawningObject(Graphics g);
|
||||
(float Left, float Right, float Top, float Bottom) GetCurrentPosition();
|
||||
|
||||
string GetInfo();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user