правки.

This commit is contained in:
Андрей Байгулов 2023-10-15 23:24:11 +04:00
parent 144100d479
commit dea236e608
4 changed files with 2 additions and 23 deletions

View File

@ -25,12 +25,6 @@ namespace ProjectElectricLocomotive.DrawingObjects
public int GetPosY => _startPosY; public int GetPosY => _startPosY;
public int GetWidth => _locomWidth; public int GetWidth => _locomWidth;
public int GetHeight => _locomHeight; public int GetHeight => _locomHeight;
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес</param>
/// <param name="bodyColor">Цвет кузова</param>
/// <param name="width">Ширина картинки</param>
/// <param name="heigth">Высота картинки</param>
public DrawingLocomotive(int speed, double weight, Color bodyColor, int width, int heigth) public DrawingLocomotive(int speed, double weight, Color bodyColor, int width, int heigth)
{ {
if (width < _locomWidth || heigth < _locomHeight) if (width < _locomWidth || heigth < _locomHeight)
@ -41,13 +35,6 @@ namespace ProjectElectricLocomotive.DrawingObjects
_pictureHeight = heigth; _pictureHeight = heigth;
EntityLocomotive = new EntityLocomotive(speed, weight, bodyColor); EntityLocomotive = new EntityLocomotive(speed, weight, bodyColor);
} }
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес</param>
/// <param name="bodyColor">Цвет кузова</param>
/// <param name="width">Ширина картинки</param>
/// <param name="height">Высота картинки</param>
/// <param name="locomWidth">Ширина картинки</param>
/// <param name="locomHeight">Высота картинки</param>
protected DrawingLocomotive(int speed, double weight, Color bodyColor, int width, protected DrawingLocomotive(int speed, double weight, Color bodyColor, int width,
int height, int locomWidth, int locomHeight) int height, int locomWidth, int locomHeight)
{ {
@ -61,8 +48,6 @@ namespace ProjectElectricLocomotive.DrawingObjects
_locomHeight = locomHeight; _locomHeight = locomHeight;
EntityLocomotive = new EntityLocomotive(speed, weight, bodyColor); EntityLocomotive = new EntityLocomotive(speed, weight, bodyColor);
} }
/// <param name="x">Координата X</param>
/// <param name="y">Координата Y</param>
public void SetPosition(int x, int y) public void SetPosition(int x, int y)
{ {
if (x < 0 || x + _locomWidth > _pictureWidth) if (x < 0 || x + _locomWidth > _pictureWidth)
@ -76,7 +61,6 @@ namespace ProjectElectricLocomotive.DrawingObjects
_startPosX = x; _startPosX = x;
_startPosY = y; _startPosY = y;
} }
/// <param name="direction">Направление</param>
public void MoveTransport(Direction direction) public void MoveTransport(Direction direction)
{ {
if (EntityLocomotive == null) if (EntityLocomotive == null)
@ -111,7 +95,6 @@ namespace ProjectElectricLocomotive.DrawingObjects
break; break;
} }
} }
/// <param name="g"></param>
public virtual void DrawTransport(Graphics g) public virtual void DrawTransport(Graphics g)
{ {
{ {
@ -181,9 +164,6 @@ namespace ProjectElectricLocomotive.DrawingObjects
Direction.Down => _startPosY + EntityLocomotive.Step < _pictureHeight, Direction.Down => _startPosY + EntityLocomotive.Step < _pictureHeight,
}; };
} }
/// <summary>
/// Получение объекта IMoveableObject из объекта DrawningCar
/// </summary>
public IMoveableObject GetMoveableObject => new public IMoveableObject GetMoveableObject => new
DrawingObjectLocomotive(this); DrawingObjectLocomotive(this);
} }

View File

@ -133,7 +133,6 @@ namespace ElectricLocomotive
} }
private void ElectricLocomotive_Load(object sender, EventArgs e) private void ElectricLocomotive_Load(object sender, EventArgs e)
{ {
} }
private void ButtonSelectLocomotive_Click(object sender, EventArgs e) private void ButtonSelectLocomotive_Click(object sender, EventArgs e)
{ {

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework> <TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>

View File

@ -27,7 +27,7 @@ namespace ProjectElectricLocomotive.Generics
{ {
if (_places[i] != null) Full++; if (_places[i] != null) Full++;
} }
if (Full == Count - position - 1) if (Full == Count - position - 1)
return -1; return -1;
if (position < Count && position >= 0) if (position < Count && position >= 0)
{ {