LabWork02 PIbd-21 Zacharchenko #2
@ -117,5 +117,9 @@ namespace DoubleDeckerBus
|
||||
_startPosY = _pictureHeight.Value - _busHeight;
|
||||
}
|
||||
}
|
||||
|
||||
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition() {
|
||||
return (_startPosX, _startPosX + _busWidth, _startPosY, _startPosY + _busHeight)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
40
DoubleDeckerBus/DoubleDeckerBus/DrawingObjectBus.cs
Normal file
40
DoubleDeckerBus/DoubleDeckerBus/DrawingObjectBus.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DoubleDeckerBus
|
||||
{
|
||||
internal class DrawingObjectBus : IDrawingObject
|
||||
{
|
||||
private DrawingBus _bus = null;
|
||||
|
||||
public DrawingObjectBus(DrawingBus bus)
|
||||
{
|
||||
_bus = bus;
|
||||
}
|
||||
|
||||
public float Step => _bus?.Bus?.Step ?? 0;
|
||||
|
||||
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)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
22
DoubleDeckerBus/DoubleDeckerBus/IDrawingObject.cs
Normal file
22
DoubleDeckerBus/DoubleDeckerBus/IDrawingObject.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DoubleDeckerBus
|
||||
{
|
||||
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