лаб-7
This commit is contained in:
parent
973ec5d31c
commit
75e3a5d823
@ -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)
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user