промежуточная фиксация 1.1

This commit is contained in:
Дамир Нугаев 2022-11-22 11:34:09 +04:00
parent c0bbc3a118
commit 5ec3ff18fb
2 changed files with 30 additions and 2 deletions

View File

@ -39,6 +39,34 @@ namespace Bus
public string GetInfo() => _bus?.GetDataForSave();
public static IDrawingObject Create(string data) => new DrawingObjectBus(data.CreateDrawingBus());
public bool Equals(IDrawingObject? other)
{
if (other == null)
{
return false;
}
var otherBus = other as DrawingObjectBus;
if (otherBus == null)
{
return false;
}
var bus = _bus.Bus;
var otherBusBus = otherBus._bus.Bus;
if (bus.Speed != otherBusBus.Speed)
{
return false;
}
if (bus.Weight != otherBusBus.Weight)
{
return false;
}
if (bus.BodyColor != otherBusBus.BodyColor)
{
return false;
}
// TODO доделать проверки в случае продвинутого объекта
return true;
}
}
}

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Bus
{
internal interface IDrawingObject
internal interface IDrawingObject : IEquatable<IDrawingObject>
{
public float Step { get; }
void SetObject(int x, int y, int width, int height);