delete ws
This commit is contained in:
parent
fb452c0f70
commit
9a97f4378d
@ -9,13 +9,11 @@ namespace ProjectCatamaran.CollectionGenericObjects;
|
|||||||
public abstract class AbstractCompany
|
public abstract class AbstractCompany
|
||||||
{
|
{
|
||||||
protected readonly int _placeSizeWidth = 90;
|
protected readonly int _placeSizeWidth = 90;
|
||||||
|
|
||||||
protected readonly int _placeSizeHeight = 50;
|
protected readonly int _placeSizeHeight = 50;
|
||||||
protected readonly int _pictureWidth;
|
protected readonly int _pictureWidth;
|
||||||
protected readonly int _pictureHeight;
|
protected readonly int _pictureHeight;
|
||||||
protected ICollectionGenericObjects<DrawningBoat?> _collection = null;
|
protected ICollectionGenericObjects<DrawningBoat?> _collection = null;
|
||||||
private int GetMaxCount => (_pictureWidth / _placeSizeWidth + 1) * (_pictureHeight / _placeSizeHeight / 2) - (_pictureHeight / _placeSizeHeight / 2);
|
private int GetMaxCount => (_pictureWidth / _placeSizeWidth + 1) * (_pictureHeight / _placeSizeHeight / 2) - (_pictureHeight / _placeSizeHeight / 2);
|
||||||
|
|
||||||
public AbstractCompany(int picWidth,int picHeight,ICollectionGenericObjects<DrawningBoat?> collection)
|
public AbstractCompany(int picWidth,int picHeight,ICollectionGenericObjects<DrawningBoat?> collection)
|
||||||
{
|
{
|
||||||
_pictureWidth = picWidth;
|
_pictureWidth = picWidth;
|
||||||
@ -23,23 +21,19 @@ public abstract class AbstractCompany
|
|||||||
_collection = collection;
|
_collection = collection;
|
||||||
_collection.SetMaxCount = GetMaxCount;
|
_collection.SetMaxCount = GetMaxCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int operator +(AbstractCompany company, DrawningBoat boat)
|
public static int operator +(AbstractCompany company, DrawningBoat boat)
|
||||||
{
|
{
|
||||||
return company._collection?.Insert(boat) ?? -1;
|
return company._collection?.Insert(boat) ?? -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DrawningBoat? operator -(AbstractCompany company, int position)
|
public static DrawningBoat? operator -(AbstractCompany company, int position)
|
||||||
{
|
{
|
||||||
return company._collection?.Remove(position);
|
return company._collection?.Remove(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DrawningBoat? GetRandomObject()
|
public DrawningBoat? GetRandomObject()
|
||||||
{
|
{
|
||||||
Random rnd = new Random();
|
Random rnd = new Random();
|
||||||
return _collection?.Get(rnd.Next(GetMaxCount));
|
return _collection?.Get(rnd.Next(GetMaxCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bitmap Show()
|
public Bitmap Show()
|
||||||
{
|
{
|
||||||
Bitmap bitmap = new(_pictureWidth, _pictureHeight);
|
Bitmap bitmap = new(_pictureWidth, _pictureHeight);
|
||||||
|
@ -11,7 +11,6 @@ public class Harbour : AbstractCompany
|
|||||||
public Harbour(int picWidth, int picHeight, ICollectionGenericObjects<DrawningBoat?> collection) : base(picWidth, picHeight, collection)
|
public Harbour(int picWidth, int picHeight, ICollectionGenericObjects<DrawningBoat?> collection) : base(picWidth, picHeight, collection)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void DrawBackground(Graphics g)
|
protected override void DrawBackground(Graphics g)
|
||||||
{
|
{
|
||||||
Pen pen = new Pen(Color.Black,2);
|
Pen pen = new Pen(Color.Black,2);
|
||||||
@ -26,7 +25,6 @@ public class Harbour : AbstractCompany
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SetObjectPosition()
|
protected override void SetObjectPosition()
|
||||||
{
|
{
|
||||||
int curPosX = 0;
|
int curPosX = 0;
|
||||||
@ -49,7 +47,6 @@ public class Harbour : AbstractCompany
|
|||||||
curPosX = 0;
|
curPosX = 0;
|
||||||
curPosY++;
|
curPosY++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T> where T : c
|
|||||||
{
|
{
|
||||||
private T?[] _collection;
|
private T?[] _collection;
|
||||||
public int Count => _collection.Length;
|
public int Count => _collection.Length;
|
||||||
|
|
||||||
public int SetMaxCount
|
public int SetMaxCount
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
@ -21,7 +20,6 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T> where T : c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MassiveGenericObjects()
|
public MassiveGenericObjects()
|
||||||
{
|
{
|
||||||
_collection = Array.Empty<T?>();
|
_collection = Array.Empty<T?>();
|
||||||
@ -50,7 +48,6 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T> where T : c
|
|||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Insert(T obj, int position)
|
public int Insert(T obj, int position)
|
||||||
{
|
{
|
||||||
//todo
|
//todo
|
||||||
@ -83,7 +80,6 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T> where T : c
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T? Remove(int position)
|
public T? Remove(int position)
|
||||||
{
|
{
|
||||||
if (!(position >= 0 && position < _collection.Length) || _collection[position] == null )
|
if (!(position >= 0 && position < _collection.Length) || _collection[position] == null )
|
||||||
|
@ -73,7 +73,6 @@ public class DrawningBoat
|
|||||||
public DrawningBoat(int speed, double weight, Color bodyColor) : this()
|
public DrawningBoat(int speed, double weight, Color bodyColor) : this()
|
||||||
{
|
{
|
||||||
EntityBoat = new EntityBoat(speed, weight, bodyColor);
|
EntityBoat = new EntityBoat(speed, weight, bodyColor);
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
@ -84,7 +83,6 @@ public class DrawningBoat
|
|||||||
{
|
{
|
||||||
_drawningBoatWidth = drawningBoatWidth;
|
_drawningBoatWidth = drawningBoatWidth;
|
||||||
_drawningBoatHeight = drawningBoatHeight;
|
_drawningBoatHeight = drawningBoatHeight;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// установка границ поля
|
/// установка границ поля
|
||||||
|
Loading…
x
Reference in New Issue
Block a user