LabWork_06 #12

Closed
maxnes3 wants to merge 10 commits from LabWork_06 into LabWork_05
4 changed files with 13 additions and 1 deletions
Showing only changes of commit ce21b5e68f - Show all commits

View File

@ -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());
}
}

View File

@ -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]));
}
}
}

View File

@ -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)

View File

@ -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();
}
}