Youdakova D.R. PIbd-21 LabWork07 #7

Closed
Daniya_Youdakova wants to merge 6 commits from LabWork07 into LabWork06
3 changed files with 3 additions and 10 deletions
Showing only changes of commit 75e3a5d823 - Show all commits

View File

@ -52,6 +52,7 @@ namespace AircraftCarrier
{
_startPosX = x;
_startPosY = y;
_pictureWidth = width;
_pictureHeigth = height;
}
@ -126,17 +127,16 @@ namespace AircraftCarrier
{
_startPosX = _pictureWidth.Value - _aircraftcarrierWidth;
}
if (_startPosY + _aircraftcarrierHeight > _pictureHeigth)
{
_startPosY = _pictureHeigth.Value - _aircraftcarrierHeight;
}
}
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return (_startPosX, _startPosY, _startPosX + _aircraftcarrierWidth, _startPosY + _aircraftcarrierHeight);
}
public void ReturnColor(Color returnColor)
{
if (AircraftCarrier is not EntityModernAircraftCarrier modernAircraftCarrier)

View File

@ -30,8 +30,7 @@ namespace AircraftCarrier
{
_aircraftcarrier.DrawTransport(g);
}
public string GetInfo() => _aircraftcarrier?.AircraftCarrier.ToString();
public string GetInfo() => _aircraftcarrier?.GetDataForSave();
public static IDrawningObject Create(string data) => new DrawningObjectAircraftCarrier(data.CreateDrawningAircraftCarrier());
}
}

View File

@ -8,7 +8,6 @@ namespace AircraftCarrier
{
public class EntityAircraftCarrier
{
private static readonly char _separatorForObject = ':';
public int Speed { get; private set; }
public float Weight { get; private set; }
public Color BodyColor { get; set; }
@ -20,10 +19,5 @@ namespace AircraftCarrier
Weight = weight <= 0 ? rnd.Next(40, 70) : weight;
BodyColor = bodyColor;
}
public override string ToString()
{
var str = $"{Speed}{_separatorForObject}{Weight}{_separatorForObject}{BodyColor.Name}";
return str;
}
}
}