PIbd-14_Pruidze_I.K_Simple_.../ProjectCruiser/DrawningSamples/DrawningCruiser.cs

47 lines
1.8 KiB
C#
Raw Permalink Normal View History

2024-06-12 19:21:59 +04:00
using System.Drawing.Drawing2D;
using ProjectCruiser.Entities;
namespace ProjectCruiser.DrawningSamples;
public class DrawningCruiser : DrawningBase
{
// Инициализация свойств (все параметры класса (сущности))
public DrawningCruiser(int speed, double weight, Color bodyColor,
2024-06-13 10:57:01 +04:00
Color additionalColor, bool hangars) : base(302, 42)
2024-06-12 19:21:59 +04:00
// all additional featchures 'inside' object, so size remains
{
EntityTransport = new EntityCruiser(speed, weight,
2024-06-13 10:57:01 +04:00
bodyColor, additionalColor, hangars);
2024-06-12 19:21:59 +04:00
}
public override void DrawTransport(Graphics g)
{
if (EntityTransport == null || EntityTransport is not EntityCruiser ship ||
!_startPosX.HasValue || !_startPosY.HasValue) // [ !!! ] :O
{
return;
}
Pen pen = new(Color.Black, 2);
Brush PadBrush = new HatchBrush(HatchStyle.DottedDiamond, Color.LightGray, Color.Black);
Brush additionalBrush = new SolidBrush(ship.AdditionalColor);
//границы cruiser <...>
// &
// салон на верхней палубе :
base.DrawTransport(g);
2024-06-13 10:57:01 +04:00
// вертолетная площадка - default TRUE now
g.DrawEllipse(pen, _startPosX.Value + 170, _startPosY.Value + 11, 20, 20);
g.FillEllipse(PadBrush, _startPosX.Value + 170, _startPosY.Value + 11, 20, 20);
2024-06-12 19:21:59 +04:00
2024-06-13 10:57:01 +04:00
// ангар(ы)
if (ship.Hangars)
2024-06-12 19:21:59 +04:00
{
2024-06-13 10:57:01 +04:00
g.FillRectangle(additionalBrush, _startPosX.Value + 80, _startPosY.Value + 10, 10, 20);
g.FillRectangle(additionalBrush, _startPosX.Value + 70, _startPosY.Value + 12, 8, 12);
2024-06-12 19:21:59 +04:00
}
2024-06-13 10:57:01 +04:00
else g.FillRectangle(additionalBrush, _startPosX.Value + 250, _startPosY.Value + 20, 14, 7);
2024-06-12 19:21:59 +04:00
}
}