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

47 lines
1.6 KiB
C#
Raw 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
{
// Инициализация свойств (все параметры класса (сущности))
2024-06-15 13:28:42 +04:00
public DrawningCruiser(EntityCruiser ship) : base((EntityBase)ship)
2024-06-12 19:21:59 +04:00
{
2024-06-15 13:28:42 +04:00
EntityTransport = ship;
2024-06-12 19:21:59 +04:00
}
public override void DrawTransport(Graphics g)
{
2024-06-15 10:03:23 +04:00
if (EntityTransport == null ||
EntityTransport is not EntityCruiser ship ||
!_startPosX.HasValue || !_startPosY.HasValue)
2024-06-12 19:21:59 +04:00
{
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-15 10:03:23 +04:00
// вертолетная площадка - non-default
if (ship.HelicopterPads)
{
g.DrawEllipse(pen, _startPosX.Value + 170, _startPosY.Value + 11, 20, 20);
g.FillEllipse(PadBrush, _startPosX.Value + 170, _startPosY.Value + 11, 20, 20);
}
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
}
}