Добавление интерфейса
This commit is contained in:
parent
1b9308c712
commit
efab0dd09a
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -135,5 +135,10 @@ namespace Bus
|
||||
_startPosY = _pictureHeight.Value - _busHeight;
|
||||
}
|
||||
}
|
||||
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
|
||||
{
|
||||
return (_startPosX, _startPosY, _startPosX + _busWidth, _startPosY + _busHeight);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
39
Bus/Bus/DrawingObjectBus.cs
Normal file
39
Bus/Bus/DrawingObjectBus.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bus
|
||||
{
|
||||
internal class DrawingObjectBus : IDrawingObject
|
||||
{
|
||||
private DrawingBus _bus = null;
|
||||
public float Step => _bus?.Bus?.Step ?? 0;
|
||||
|
||||
public DrawingObjectBus(DrawingBus bus)
|
||||
{
|
||||
_bus = bus;
|
||||
}
|
||||
|
||||
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
|
||||
{
|
||||
return _bus?.GetCurrentPosition() ?? default;
|
||||
}
|
||||
|
||||
public void MoveObject(Direction direction)
|
||||
{
|
||||
_bus?.MoveTransport(direction);
|
||||
}
|
||||
|
||||
public void SetObject(int x, int y, int width, int height)
|
||||
{
|
||||
_bus.SetPosition(x, y, width, height);
|
||||
}
|
||||
|
||||
void IDrawingObject.DrawingObject(Graphics g)
|
||||
{
|
||||
_bus.DrawTransport(g);
|
||||
}
|
||||
}
|
||||
}
|
17
Bus/Bus/IDrawingObject.cs
Normal file
17
Bus/Bus/IDrawingObject.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Bus
|
||||
{
|
||||
internal interface IDrawingObject
|
||||
{
|
||||
public float Step { get; }
|
||||
void SetObject(int x, int y, int width, int height);
|
||||
void MoveObject(Direction direction);
|
||||
void DrawingObject(Graphics g);
|
||||
(float Left, float Right, float Top, float Bottom) GetCurrentPosition();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user