Петрушин Егор ПИбд-22 Лабораторная работа №3 "Самоходная артиллерийская установка" #8

Closed
Egor_Petrushin wants to merge 7 commits from PIbd-22_Petrushin_E.A._Lab3 into PIbd-22_Petrushin_E.A._Lab2
2 changed files with 18 additions and 6 deletions
Showing only changes of commit bbb8274ca8 - Show all commits

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 прорисовка объекта