Третья лабораторная работа. Мелкие правки + фикс направления.
This commit is contained in:
parent
e9bddc6a0b
commit
91aeb23ae0
@ -58,8 +58,8 @@ namespace AirBomber
|
|||||||
FormAirBomber form = new();
|
FormAirBomber form = new();
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
DrawingObjectAirBomber car = new(form.SelectedAirBomber);
|
DrawingObjectAirBomber airBomber = new(form.SelectedAirBomber);
|
||||||
if (_mapAirBombersCollectionGeneric + car != -1)
|
if (_mapAirBombersCollectionGeneric + airBomber != -1)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBox.Image = _mapAirBombersCollectionGeneric.ShowSet();
|
pictureBox.Image = _mapAirBombersCollectionGeneric.ShowSet();
|
||||||
|
@ -165,7 +165,7 @@ namespace AirBomber
|
|||||||
int numOfObjectsInRow = _pictureWidth / _placeSizeWidth;
|
int numOfObjectsInRow = _pictureWidth / _placeSizeWidth;
|
||||||
for (int i = 0; i < _setAirBombers.Count; i++)
|
for (int i = 0; i < _setAirBombers.Count; i++)
|
||||||
{
|
{
|
||||||
_setAirBombers.Get(i)?.SetObject((i % numOfObjectsInRow) * _placeSizeWidth, (i / numOfObjectsInRow) * _placeSizeHeight, _pictureWidth, _pictureHeight);
|
_setAirBombers.Get(i)?.SetObject((numOfObjectsInRow - (i % numOfObjectsInRow) - 1) * _placeSizeWidth, (i / numOfObjectsInRow) * _placeSizeHeight, _pictureWidth, _pictureHeight);
|
||||||
_setAirBombers.Get(i)?.DrawingObject(g);
|
_setAirBombers.Get(i)?.DrawingObject(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,26 +32,7 @@ namespace AirBomber
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int Insert(T airBomber)
|
public int Insert(T airBomber)
|
||||||
{
|
{
|
||||||
if (_places[0] != null) {
|
return Insert(airBomber, 0);
|
||||||
int indexNull = -1;
|
|
||||||
for (int i = 0; i < _places.Length; i++)
|
|
||||||
{
|
|
||||||
if (_places[i] == null)
|
|
||||||
{
|
|
||||||
indexNull = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (indexNull == -1) return -1;
|
|
||||||
for (int i = indexNull; i > 0; i--)
|
|
||||||
{
|
|
||||||
T tmp = _places[i];
|
|
||||||
_places[i] = _places[i - 1];
|
|
||||||
_places[i - 1] = tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_places[0] = airBomber;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавление объекта в набор на конкретную позицию
|
/// Добавление объекта в набор на конкретную позицию
|
||||||
@ -77,7 +58,7 @@ namespace AirBomber
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (indexNull == -1) return -1;
|
if (indexNull == -1) return -1;
|
||||||
for (int i = indexNull; i > position; i++)
|
for (int i = indexNull; i > position; i--)
|
||||||
{
|
{
|
||||||
T tmp = _places[i];
|
T tmp = _places[i];
|
||||||
_places[i] = _places[i - 1];
|
_places[i] = _places[i - 1];
|
||||||
|
Loading…
Reference in New Issue
Block a user