Исправление ошибок

This commit is contained in:
GokaPek 2023-10-11 11:08:05 +04:00
parent e875215a6f
commit bbb8274ca8
2 changed files with 18 additions and 6 deletions

View File

@ -1,5 +1,4 @@
using SelfPropelledArtilleryUnit.Generics;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;

View File

@ -56,14 +56,14 @@ namespace SelfPropelledArtilleryUnit.Generics
/// <param name="collect"></param>
/// <param name="obj"></param>
/// <returns></returns>
public static SPAUGenericCollection<T, U> operator +(SPAUGenericCollection<T, U> collect, T? obj)
public static bool operator +(SPAUGenericCollection<T, U> collect, T? obj)
{
if (obj == null)
{
return collect;
return false;
}
collect._collection.Insert(obj);
return collect;
collect?._collection.Insert(obj);
return true;
}
/// <summary>
/// Перегрузка оператора вычитания
@ -127,8 +127,21 @@ namespace SelfPropelledArtilleryUnit.Generics
/// <param name="g"></param>
private void DrawObjects(Graphics g)
{
int j = 0;
int stringCount = 0;
DrawningSPAU current;
for (int i = 0; i < _collection.Count; i++)
{
current = _collection.Get(i);
current?.SetPosition(stringCount * 200, 250 - j * 50);
stringCount++;
if (stringCount >= 3)
{
j++;
stringCount = 0;
}
current?.DrawTransport(g);
// TODO получение объекта
// TODO установка позиции
// TODO прорисовка объекта