This commit is contained in:
Александр Разживин 2022-12-05 01:22:45 +04:00
parent bd60416bcb
commit 999f216dc3
3 changed files with 21 additions and 21 deletions

View File

@ -26,7 +26,7 @@ namespace Stormtrooper
/// <summary>
/// Объект от класса карты с набором объектов
/// </summary>
private MapWithSetStormtroopersGeneric<DrawningObjectStormtrooper, AbstractMap> _mapCarsCollectionGeneric;
private MapWithSetStormtroopersGeneric<DrawningObjectStormtrooper, AbstractMap> _mapStormtroopersCollectionGeneric;
/// <summary>
/// Конструктор
@ -75,8 +75,8 @@ namespace Stormtrooper
FormStormtrooper form = new();
if (form.ShowDialog() == DialogResult.OK)
{
DrawningObjectStormtrooper car = new(form.SelectedStormtrooper);
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + car != -1)
DrawningObjectStormtrooper stormtrooper = new(form.SelectedStormtrooper);
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + stormtrooper != -1)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();

View File

@ -53,11 +53,11 @@ namespace Stormtrooper
/// Перегрузка оператора сложения
/// </summary>
/// <param name="map"></param>
/// <param name="car"></param>
/// <param name="stormtrooper"></param>
/// <returns></returns>
public static int operator + (MapWithSetStormtroopersGeneric<T, U> map, T car)
public static int operator + (MapWithSetStormtroopersGeneric<T, U> map, T stormtrooper)
{
return map._setStormtroopers.Insert(car);
return map._setStormtroopers.Insert(stormtrooper);
}
/// <summary>
/// Перегрузка оператора вычитания
@ -80,7 +80,7 @@ namespace Stormtrooper
Graphics gr = Graphics.FromImage(bmp);
ShowOnMap();
DrawBackground(gr);
DrawCars(gr);
DrawStormtroopers(gr);
return bmp;
}
/// <summary>
@ -90,9 +90,9 @@ namespace Stormtrooper
public Bitmap ShowOnMap()
{
Shaking();
foreach (var boat in _setStormtroopers.GetStormtroopers())
foreach (var stormtrooper in _setStormtroopers.GetStormtroopers())
{
return _map.CreateMap(_pictureWidth, _pictureHeight, boat);
return _map.CreateMap(_pictureWidth, _pictureHeight, stormtrooper);
}
return new(_pictureWidth, _pictureHeight);
}
@ -121,10 +121,10 @@ namespace Stormtrooper
{
for (; j > i; j--)
{
var boat = _setStormtroopers[j];
if (boat != null)
var stormtrooper = _setStormtroopers[j];
if (stormtrooper != null)
{
_setStormtroopers.Insert(boat, i);
_setStormtroopers.Insert(stormtrooper, i);
_setStormtroopers.Remove(j);
break;
}
@ -159,14 +159,14 @@ namespace Stormtrooper
/// Метод прорисовки объектов
/// </summary>
/// <param name="g"></param>
private void DrawCars(Graphics g)
private void DrawStormtroopers(Graphics g)
{
int x = (_pictureWidth / _placeSizeWidth) * _placeSizeWidth - _placeSizeWidth;
int y = 5;
foreach (var boat in _setStormtroopers.GetStormtroopers())
foreach (var stormtrooper in _setStormtroopers.GetStormtroopers())
{
boat?.SetObject(x, y, _pictureWidth, _pictureHeight);
boat?.DrawningObject(g);
stormtrooper?.SetObject(x, y, _pictureWidth, _pictureHeight);
stormtrooper?.DrawningObject(g);
x -= _placeSizeWidth;
if (x < 0)
{

View File

@ -32,7 +32,7 @@ namespace Stormtrooper
/// <summary>
/// Добавление объекта в набор
/// </summary>
/// <param name="car">Добавляемый автомобиль</param>
/// <param name="stormtrooper">Добавляемый автомобиль</param>
/// <returns></returns>
public int Insert(T stormtrooper)
{
@ -52,7 +52,7 @@ namespace Stormtrooper
/// <summary>
/// Добавление объекта в набор на конкретную позицию
/// </summary>
/// <param name="car">Добавляемый автомобиль</param>
/// <param name="stormtrooper">Добавляемый автомобиль</param>
/// <param name="position">Позиция</param>
/// <returns></returns>
public bool Insert(T stormtrooper, int position)
@ -113,11 +113,11 @@ namespace Stormtrooper
/// <returns></returns>
public IEnumerable<T> GetStormtroopers()
{
foreach (var boat in _places)
foreach (var stormtrooper in _places)
{
if (boat != null)
if (stormtrooper != null)
{
yield return boat;
yield return stormtrooper;
}
else
{