добавление интерфейса
This commit is contained in:
parent
c5b3864190
commit
b9ca34ea50
@ -128,5 +128,9 @@ namespace Locomative
|
||||
_startPosY = _pictureHeight.Value - _locoHeight;
|
||||
}
|
||||
}
|
||||
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
|
||||
{
|
||||
return (_startPosX, _startPosY, _startPosX + _locoWidth, _startPosY + _locoHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
42
Locomative/Locomative/DrawningObjectLoco.cs
Normal file
42
Locomative/Locomative/DrawningObjectLoco.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Locomative
|
||||
{
|
||||
internal class DrawningObjectLoco : IDrawningObject
|
||||
{
|
||||
private DrawningLocomative _loco = null;
|
||||
public DrawningObjectLoco(DrawningLocomative loco)
|
||||
{
|
||||
_loco = loco;
|
||||
}
|
||||
public float Step => _loco?.Locomative?.Step ?? 0;
|
||||
|
||||
public void DrawningObject(Graphics g)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
|
||||
{
|
||||
return _loco?.GetCurrentPosition() ?? default;
|
||||
}
|
||||
|
||||
public void MoveObject(Direction direction)
|
||||
{
|
||||
_loco.MoveTransport(direction);
|
||||
}
|
||||
|
||||
public void SetObject(int x, int y, int width, int height)
|
||||
{
|
||||
_loco.SetPosition(x, y, width, height);
|
||||
}
|
||||
void IDrawningObject.DrawningObject(Graphics g)
|
||||
{
|
||||
//сделать
|
||||
}
|
||||
}
|
||||
}
|
17
Locomative/Locomative/IDrawningObject.cs
Normal file
17
Locomative/Locomative/IDrawningObject.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Locomative
|
||||
{
|
||||
internal interface IDrawningObject
|
||||
{
|
||||
public float Step { get; }
|
||||
void SetObject(int x, int y, int width, int height);
|
||||
void MoveObject(Direction direction);
|
||||
void DrawningObject(Graphics g);
|
||||
(float Left, float Right, float Top, float Bottom) GetCurrentPosition();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user