Changing return type of Insert and Remove

This commit is contained in:
1yuee 2022-10-03 16:14:34 +04:00
parent 8efe9be84a
commit 4dab796efa

View File

@ -32,13 +32,13 @@ namespace AirFighter
_map = map; _map = map;
} }
public static bool operator +(MapWithSetAircraftsGeneric<T, U> map, T aircraft) public static int operator +(MapWithSetAircraftsGeneric<T, U> map, T aircraft)
{ {
return map._setAircrafts.Insert(aircraft); return map._setAircrafts.Insert(aircraft);
} }
public static bool operator -(MapWithSetAircraftsGeneric<T, U> map, int position) public static T operator -(MapWithSetAircraftsGeneric<T, U> map, int position)
{ {
return map._setAircrafts.Remove(position); return map._setAircrafts.Remove(position);
} }
@ -75,8 +75,6 @@ namespace AirFighter
return new(_pictureWidth, _pictureHeight); return new(_pictureWidth, _pictureHeight);
} }
private void Shaking() private void Shaking()
{ {
int j = _setAircrafts.Count - 1; int j = _setAircrafts.Count - 1;
@ -111,22 +109,12 @@ namespace AirFighter
for (int j = 0; j < _pictureHeight / _placeSizeHeight; j++) for (int j = 0; j < _pictureHeight / _placeSizeHeight; j++)
{ {
g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 135, g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 135, _pictureWidth - 80, j * _placeSizeHeight + 135);
_pictureWidth - 80, j * _placeSizeHeight + 135);
g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 60, i * _placeSizeWidth + _placeSizeWidth /2 + 20, j * _placeSizeHeight + 45); g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 60, i * _placeSizeWidth + _placeSizeWidth /2 + 20, j * _placeSizeHeight + 45);
g.DrawLine(pen, i * _placeSizeWidth + _placeSizeWidth / 2 + 20, j * _placeSizeHeight + 45, i * _placeSizeWidth + _placeSizeWidth + 20 , j * _placeSizeHeight + 60); g.DrawLine(pen, i * _placeSizeWidth + _placeSizeWidth / 2 + 20, j * _placeSizeHeight + 45, i * _placeSizeWidth + _placeSizeWidth + 20 , j * _placeSizeHeight + 60);
g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 135, i * _placeSizeWidth + 20, j * _placeSizeHeight + 60); g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 135, i * _placeSizeWidth + 20, j * _placeSizeHeight + 60);
} }
} }
} }
@ -134,21 +122,25 @@ namespace AirFighter
private void DrawAircrafts(Graphics g) private void DrawAircrafts(Graphics g)
{ {
int curX = _pictureWidth / _placeSizeWidth - 1;
//int curX = _pictureWidth / _placeSizeWidth; int curY = _pictureHeight / _placeSizeHeight - 1;
//int curY = _pictureHeight / _placeSizeHeight;
for (int i = 0; i < _setAircrafts.Count; i++) for (int i = 0; i < _setAircrafts.Count; i++)
{ {
//_setAircrafts.Get(i)?.SetObject(curX , curY , 100, 100); _setAircrafts.Get(i)?.SetObject(curX * _placeSizeWidth + 30, curY * _placeSizeHeight + 40, _pictureWidth, _pictureHeight);
_setAircrafts.Get(i)?.DrawingObject(g); _setAircrafts.Get(i)?.DrawingObject(g);
//if (curX < 0) if (curX <= 0)
//{ {
// curX = _pictureWidth / _placeSizeWidth; curX = _pictureWidth / _placeSizeWidth - 1;
// curY--; curY--;
//} }
else
{
curX--;
}
} }
} }