delegates
This commit is contained in:
parent
f52c0fc2ca
commit
f3a64bc617
@ -6,17 +6,17 @@ public class DrawningCruiser : DrawningBase
|
||||
{
|
||||
// Инициализация свойств (все параметры класса (сущности))
|
||||
public DrawningCruiser(int speed, double weight, Color bodyColor,
|
||||
Color additionalColor, bool hangars) : base(302, 42)
|
||||
// all additional featchures 'inside' object, so size remains
|
||||
Color additionalColor, bool pad, bool hangars) : base(302, 42)
|
||||
{
|
||||
EntityTransport = new EntityCruiser(speed, weight,
|
||||
bodyColor, additionalColor, hangars);
|
||||
bodyColor, additionalColor, pad, hangars);
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityTransport == null || EntityTransport is not EntityCruiser ship ||
|
||||
!_startPosX.HasValue || !_startPosY.HasValue) // [ !!! ] :O
|
||||
if (EntityTransport == null ||
|
||||
EntityTransport is not EntityCruiser ship ||
|
||||
!_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -31,10 +31,12 @@ public class DrawningCruiser : DrawningBase
|
||||
|
||||
base.DrawTransport(g);
|
||||
|
||||
// вертолетная площадка - default TRUE now
|
||||
// вертолетная площадка - 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);
|
||||
|
||||
}
|
||||
// ангар(ы)
|
||||
if (ship.Hangars)
|
||||
{
|
||||
|
@ -28,7 +28,6 @@ public partial class EditorForm3 : Form
|
||||
{
|
||||
if (shipDelegate == null) shipDelegate = del;
|
||||
else shipDelegate += del;
|
||||
//shipDelegate += del;
|
||||
}
|
||||
|
||||
private void DrawObject()
|
||||
@ -69,9 +68,7 @@ public partial class EditorForm3 : Form
|
||||
case "AdvLabel":
|
||||
Random rn = new Random();
|
||||
_cruiser = new DrawningCruiser((int)SpeedN.Value, (double)WeightN.Value,
|
||||
Color.White, Color.Black,checkBoxHangars.Checked);
|
||||
// ADD helicopter PAD as NOT DEFAULT - checkBoxPads.Checked [!]
|
||||
// Convert.ToBoolean(rn.Next(0, 2)));
|
||||
Color.White, Color.Black, checkBoxPads.Checked, checkBoxHangars.Checked);
|
||||
break;
|
||||
}
|
||||
labelMcolor.BackColor = Color.Empty;
|
||||
@ -79,13 +76,12 @@ public partial class EditorForm3 : Form
|
||||
DrawObject();
|
||||
}
|
||||
|
||||
// TODO Реализовать логику смены цветов: основного и дополнительного (для продвинутого объекта)
|
||||
// Логика смены цветов: основного и дополнительного (для продвинутого объекта)
|
||||
private void BodyColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color))) e.Effect = DragDropEffects.Copy;
|
||||
else e.Effect = DragDropEffects.None;
|
||||
}
|
||||
|
||||
private void BodyColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_cruiser != null)
|
||||
@ -103,7 +99,6 @@ public partial class EditorForm3 : Form
|
||||
else e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
private void AdditionalColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_cruiser.EntityTransport is EntityCruiser _ship)
|
||||
|
@ -14,11 +14,11 @@ public class EntityCruiser : EntityBase
|
||||
public bool Hangars { get; private set; } // ангар
|
||||
|
||||
public EntityCruiser(int speed, double weight, Color mainc,
|
||||
Color additionalColor, bool hangars)
|
||||
Color additionalColor, bool pad, bool hangars)
|
||||
: base(speed, weight, mainc)
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
// HelicopterPads = pads; - default TRUE now for Advanced obj
|
||||
HelicopterPads = pad; // non-default now for editor Form3
|
||||
Hangars = hangars;
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ namespace ProjectCruiser
|
||||
random.Next(100, 300), random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
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)));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user