3 лаба сделаная
This commit is contained in:
parent
0e2fe47f20
commit
88bca293e8
@ -13,7 +13,7 @@ namespace WarmlyShip
|
|||||||
private readonly int _pictureWidth;
|
private readonly int _pictureWidth;
|
||||||
private readonly int _pictureHeight;
|
private readonly int _pictureHeight;
|
||||||
private readonly int _placeSizeWidth = 210;
|
private readonly int _placeSizeWidth = 210;
|
||||||
private readonly int _placeSizeHeight = 90;
|
private readonly int _placeSizeHeight = 100;
|
||||||
private readonly SetShipGeneric<T> _setShips;
|
private readonly SetShipGeneric<T> _setShips;
|
||||||
private readonly U _map;
|
private readonly U _map;
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ namespace WarmlyShip
|
|||||||
private void DrawBackground(Graphics g)
|
private void DrawBackground(Graphics g)
|
||||||
{
|
{
|
||||||
Pen pen = new(Color.Black, 3);
|
Pen pen = new(Color.Black, 3);
|
||||||
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
|
for (int i = 0; i < _pictureWidth / _placeSizeWidth; ++i)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j) //линия рамзетки места
|
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j) //линия рамзетки места
|
||||||
{
|
{
|
||||||
@ -110,13 +110,17 @@ namespace WarmlyShip
|
|||||||
|
|
||||||
private void DrawShips(Graphics g)
|
private void DrawShips(Graphics g)
|
||||||
{
|
{
|
||||||
|
int j = 0;
|
||||||
for (int i = 0; i < _setShips.Count; ++i)
|
for (int i = 0; i < _setShips.Count; ++i)
|
||||||
{
|
{
|
||||||
|
if (i >= _pictureHeight / _placeSizeHeight) ++j;
|
||||||
if (_setShips.Get(i) != null )
|
if (_setShips.Get(i) != null )
|
||||||
{
|
{
|
||||||
|
int temp = 0;
|
||||||
|
if (_setShips.Get(i).GetCurrentPosition().Bottom - _setShips.Get(i).GetCurrentPosition().Top < 75) temp = (int)(_setShips.Get(i).GetCurrentPosition().Bottom - _setShips.Get(i).GetCurrentPosition().Top) / 2;
|
||||||
|
_setShips.Get(i).SetObject(j * _placeSizeWidth, i * _placeSizeHeight + temp, _pictureWidth, _pictureHeight);
|
||||||
|
_setShips.Get(i).DrawningObject(g);
|
||||||
}
|
}
|
||||||
_setShips.Get(i)?.DrawningObject(g);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user