Pibd-13_Garifullin_F.M_LabWork03 #12
@ -56,9 +56,9 @@ public abstract class AbstractCompany
|
||||
/// <param name="company">Компания</param>
|
||||
/// <param name="car">Добавляемый объект</param>
|
||||
/// <returns></returns>
|
||||
public static int operator +(AbstractCompany company, DrawningTank car)
|
||||
public static int operator +(AbstractCompany company, DrawningTank tank)
|
||||
{
|
||||
return company?._collection.Insert(car)??-1;
|
||||
return company?._collection.Insert(tank)??-1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,16 +1,10 @@
|
||||
|
||||
|
||||
|
||||
using ProjectTank.Drawning;
|
||||
using ProjectTank.Drawning;
|
||||
|
||||
namespace ProjectTank.CollectionGenericObjects
|
||||
{
|
||||
public class TankSharingServise : AbstractCompany
|
||||
public class TankBase : AbstractCompany
|
||||
{
|
||||
private int maxCountX;
|
||||
private int maxCountY;
|
||||
private int offsetX = 30;
|
||||
public TankSharingServise(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTank> collection) : base(picWidth, picHeight,collection)
|
||||
public TankBase(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTank> collection) : base(picWidth, picHeight, collection)
|
||||
{
|
||||
|
||||
}
|
||||
@ -42,7 +36,7 @@ namespace ProjectTank.CollectionGenericObjects
|
||||
if (_collection?.Get(i) != null)
|
||||
{
|
||||
_collection.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
||||
_collection.Get(i)?.SetPosition(_placeSizeWidth * TankWidth + 20, TankHeight * _placeSizeHeight+5);
|
||||
_collection.Get(i)?.SetPosition(_placeSizeWidth * TankWidth + 20, TankHeight * _placeSizeHeight + 5);
|
||||
}
|
||||
|
||||
if (TankWidth < width - 1)
|
||||
@ -52,7 +46,7 @@ namespace ProjectTank.CollectionGenericObjects
|
||||
TankWidth = 0;
|
||||
TankHeight++;
|
||||
}
|
||||
if (TankHeight > height)
|
||||
if (TankHeight > height -1)
|
||||
{
|
||||
return;
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
using ProjectTank.Drawning;
|
||||
using ProjectTank.Entities;
|
||||
using ProjectTank.MovementStrategy;
|
||||
|
||||
namespace ProjectTank
|
||||
|
@ -31,7 +31,7 @@ namespace ProjectTank
|
||||
switch (comboBoxSelectorCompany.Text)
|
||||
{
|
||||
case "Хранилище":
|
||||
_company = new TankSharingServise(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningTank>());
|
||||
_company = new TankBase(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningTank>());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -123,7 +123,7 @@ namespace ProjectTank
|
||||
if (_company == null) return;
|
||||
|
||||
DrawningTank? tank = null;
|
||||
int coutner = 100;
|
||||
int coutner = 1;
|
||||
|
||||
while (tank == null)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user