Доделал
This commit is contained in:
parent
5cad6bd9b6
commit
d09f6953dd
@ -2,19 +2,52 @@
|
|||||||
|
|
||||||
namespace ProjectContainerShip.CollectionGenericObjects;
|
namespace ProjectContainerShip.CollectionGenericObjects;
|
||||||
|
|
||||||
public class ShipSharingService : AbstractCompany
|
public class ShipPortService : AbstractCompany
|
||||||
{
|
{
|
||||||
public ShipSharingService(int pictureWidth, int pictureHeight, ICollectionGenericObjects<DrawningShip> collection) : base(pictureWidth, pictureHeight, collection)
|
public ShipPortService(int picWidth, int picHeight, ICollectionGenericObjects<DrawningShip> collection) : base(picWidth, picHeight, collection)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void DrawBackgound(Graphics g)
|
protected override void DrawBackgound(Graphics g)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
// Пристань
|
||||||
|
int width = _pictureWidth / _placeSizeWidth;
|
||||||
|
int height = _pictureHeight / _placeSizeHeight;
|
||||||
|
Pen pen = new(Color.Black, 3);
|
||||||
|
for (int i = 0; i < width; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < height + 1; ++j)
|
||||||
|
{
|
||||||
|
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth - 5, j * _placeSizeHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SetObjectsPosition()
|
protected override void SetObjectsPosition()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
int width = _pictureWidth / _placeSizeWidth;
|
||||||
|
int height = _pictureHeight / _placeSizeHeight;
|
||||||
|
|
||||||
|
int curWidth = width - 1;
|
||||||
|
int curHeight = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
||||||
|
{
|
||||||
|
if (_collection.Get(i) != null)
|
||||||
|
{
|
||||||
|
_collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
|
||||||
|
_collection.Get(i).SetPosition(_placeSizeWidth * curWidth + 55, curHeight * _placeSizeHeight + 20);
|
||||||
|
}
|
||||||
|
if (curWidth > 0)
|
||||||
|
curWidth--;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curWidth = width - 1;
|
||||||
|
curHeight++;
|
||||||
|
}
|
||||||
|
if (curHeight > height)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public partial class FormShipCollection : Form
|
|||||||
switch (comboBoxSelectorCompany.Text)
|
switch (comboBoxSelectorCompany.Text)
|
||||||
{
|
{
|
||||||
case "Хранилище":
|
case "Хранилище":
|
||||||
_company = new ShipSharingService(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningShip>());
|
_company = new ShipPortService(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningShip>());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,9 +54,9 @@ public partial class FormShipCollection : Form
|
|||||||
drawningShip = new DrawningShip(random.Next(100, 300), random.Next(1000, 3000), GetColor(random));
|
drawningShip = new DrawningShip(random.Next(100, 300), random.Next(1000, 3000), GetColor(random));
|
||||||
break;
|
break;
|
||||||
case nameof(DrawningContainerShip):
|
case nameof(DrawningContainerShip):
|
||||||
|
// TODO вызов диалогового окна для выбора цвета (made)
|
||||||
drawningShip = new DrawningContainerShip(random.Next(100, 300), random.Next(1000, 3000),
|
drawningShip = new DrawningContainerShip(random.Next(100, 300), random.Next(1000, 3000),
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
GetColor(random), GetColor(random),
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
|
||||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user