Добавление интерфейса
This commit is contained in:
parent
5ac86cbb43
commit
477c7c1500
35
Airbus/Airbus/DrawningObjectPlane.cs
Normal file
35
Airbus/Airbus/DrawningObjectPlane.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Airbus
|
||||
{
|
||||
internal class DrawningObjectPlane : IDrawningObject
|
||||
{
|
||||
private DrawningPlane _plane = null;
|
||||
public DrawningObjectPlane(DrawningPlane plane)
|
||||
{
|
||||
_plane = plane;
|
||||
}
|
||||
public float Step => _plane?.Plane?.Step ?? 0;
|
||||
public (float Left, float Top, float Right, float Bottom)
|
||||
GetCurrentPosition()
|
||||
{
|
||||
return _plane?.GetCurrentPosition() ?? default;
|
||||
}
|
||||
public void MoveObject(Direction direction)
|
||||
{
|
||||
_plane?.MoveTransport(direction);
|
||||
}
|
||||
public void SetObject(int x, int y, int width, int height)
|
||||
{
|
||||
_plane.SetPosition(x, y, width, height);
|
||||
}
|
||||
public void DrawningObject(Graphics g)
|
||||
{
|
||||
_plane.DrawTransport(g);
|
||||
}
|
||||
}
|
||||
}
|
@ -180,5 +180,10 @@ namespace Airbus
|
||||
_startPosY = _pictureHeight.Value - _PlaneHeight;
|
||||
}
|
||||
}
|
||||
|
||||
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
|
||||
{
|
||||
return (_startPosX, _startPosY, _startPosX + _PlaneWidth, _startPosY + _PlaneHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
40
Airbus/Airbus/IDrawningObject.cs
Normal file
40
Airbus/Airbus/IDrawningObject.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Airbus
|
||||
{
|
||||
internal interface IDrawningObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Шаг перемещения объекта
|
||||
/// </summary>
|
||||
public float Step { get; }
|
||||
/// <summary>
|
||||
/// Установка позиции объекта
|
||||
/// </summary>
|
||||
/// <param name="x">Координата X</param>
|
||||
/// <param name="y">Координата Y</param>
|
||||
/// <param name="width">Ширина полотна</param>
|
||||
/// <param name="height">Высота полотна</param>
|
||||
void SetObject(int x, int y, int width, int height);
|
||||
/// <summary>
|
||||
/// Изменение направления пермещения объекта
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
void MoveObject(Direction direction);
|
||||
/// <summary>
|
||||
/// Отрисовка объекта
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
void DrawningObject(Graphics g);
|
||||
/// <summary>
|
||||
/// Получение текущей позиции объекта
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
(float Left, float Top, float Right, float Bottom)
|
||||
GetCurrentPosition();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user