Внесены некоторые изменения
This commit is contained in:
parent
5309551aa3
commit
f8259e6949
@ -24,6 +24,7 @@ namespace Airbus
|
||||
{
|
||||
Plane = new EntityAirbus(speed, weight, bodyColor, dopColor, bodyKit, wing, sportLine);
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (Plane is not EntityAirbus Airbus)
|
||||
@ -75,8 +76,11 @@ namespace Airbus
|
||||
g.FillEllipse(WindowBrush, _startPosX + 110, _startPosY + 40, 9, 9);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public DrawningAirbus SetDopColor(int? speed = null, float? weight = null, Color? bodyColor = null, Color? dopColor = null, bool? bodyKit = null, bool? wing = null, bool? sportLine = null)
|
||||
{
|
||||
var b = (EntityAirbus)Plane;
|
||||
return new DrawningAirbus(speed ?? b.Speed, weight ?? b.Weight, bodyColor ?? b.BodyColor, dopColor ?? b.DopColor,bodyKit ?? b.BodyKit, wing ?? b.Wing, sportLine ?? b.SportLine);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -185,5 +185,10 @@ namespace Airbus
|
||||
{
|
||||
return (_startPosX, _startPosY, _startPosX + _PlaneWidth, _startPosY + _PlaneHeight);
|
||||
}
|
||||
|
||||
public DrawningPlane SetBaseColor(int? speed = null, float? weight = null, Color? bodyColor = null)
|
||||
{
|
||||
return new DrawningPlane(speed ?? Plane.Speed, weight ?? Plane.Weight, bodyColor ?? Plane.BodyColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -113,9 +113,27 @@ namespace Airbus
|
||||
private void buttonAddPlane_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
var formPlaneConfig = new FormPlaneConfig();
|
||||
formPlaneConfig.AddEvent(new PlaneDelegate(AddPlane));
|
||||
// TODO
|
||||
formPlaneConfig.Show();
|
||||
}
|
||||
|
||||
private void AddPlane(DrawningPlane plane)
|
||||
{
|
||||
if (listBoxMaps.SelectedIndex == -1)
|
||||
{
|
||||
MessageBox.Show("Перед добавлением объекта необходимо создать карту");
|
||||
}
|
||||
else if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObjectPlane(plane) != -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Удаление объекта
|
||||
/// </summary>
|
||||
|
32
Airbus/Airbus/FormPlaneConfig.Designer.cs
generated
32
Airbus/Airbus/FormPlaneConfig.Designer.cs
generated
@ -52,7 +52,7 @@
|
||||
this.labelBaseColor = new System.Windows.Forms.Label();
|
||||
this.labelDopColor = new System.Windows.Forms.Label();
|
||||
this.buttonOk = new System.Windows.Forms.Button();
|
||||
this.buttonNo = new System.Windows.Forms.Button();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.groupBoxConfig.SuspendLayout();
|
||||
this.groupBoxColor.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
||||
@ -126,6 +126,7 @@
|
||||
this.panelBlack.Name = "panelBlack";
|
||||
this.panelBlack.Size = new System.Drawing.Size(40, 40);
|
||||
this.panelBlack.TabIndex = 1;
|
||||
this.panelBlack.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// panelPink
|
||||
//
|
||||
@ -134,6 +135,7 @@
|
||||
this.panelPink.Name = "panelPink";
|
||||
this.panelPink.Size = new System.Drawing.Size(40, 40);
|
||||
this.panelPink.TabIndex = 1;
|
||||
this.panelPink.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// panelGol
|
||||
//
|
||||
@ -142,6 +144,7 @@
|
||||
this.panelGol.Name = "panelGol";
|
||||
this.panelGol.Size = new System.Drawing.Size(40, 40);
|
||||
this.panelGol.TabIndex = 1;
|
||||
this.panelGol.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// panelBlue
|
||||
//
|
||||
@ -150,6 +153,7 @@
|
||||
this.panelBlue.Name = "panelBlue";
|
||||
this.panelBlue.Size = new System.Drawing.Size(40, 40);
|
||||
this.panelBlue.TabIndex = 2;
|
||||
this.panelBlue.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// panelOrange
|
||||
//
|
||||
@ -158,6 +162,7 @@
|
||||
this.panelOrange.Name = "panelOrange";
|
||||
this.panelOrange.Size = new System.Drawing.Size(40, 40);
|
||||
this.panelOrange.TabIndex = 1;
|
||||
this.panelOrange.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// panelYellow
|
||||
//
|
||||
@ -166,6 +171,7 @@
|
||||
this.panelYellow.Name = "panelYellow";
|
||||
this.panelYellow.Size = new System.Drawing.Size(40, 40);
|
||||
this.panelYellow.TabIndex = 1;
|
||||
this.panelYellow.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
@ -174,6 +180,7 @@
|
||||
this.panelGreen.Name = "panelGreen";
|
||||
this.panelGreen.Size = new System.Drawing.Size(40, 40);
|
||||
this.panelGreen.TabIndex = 1;
|
||||
this.panelGreen.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// panelRed
|
||||
//
|
||||
@ -182,6 +189,7 @@
|
||||
this.panelRed.Name = "panelRed";
|
||||
this.panelRed.Size = new System.Drawing.Size(40, 40);
|
||||
this.panelRed.TabIndex = 0;
|
||||
this.panelRed.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// checkBoxSportLine
|
||||
//
|
||||
@ -276,6 +284,8 @@
|
||||
this.labelBaseColor.TabIndex = 9;
|
||||
this.labelBaseColor.Text = "Цвет";
|
||||
this.labelBaseColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.labelBaseColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelBaseColor_DragDrop);
|
||||
this.labelBaseColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelBaseColor_DragEnter);
|
||||
//
|
||||
// labelDopColor
|
||||
//
|
||||
@ -287,6 +297,8 @@
|
||||
this.labelDopColor.TabIndex = 8;
|
||||
this.labelDopColor.Text = "Доп. цвет";
|
||||
this.labelDopColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.labelDopColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelDopColor_DragDrop);
|
||||
this.labelDopColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelBaseColor_DragEnter);
|
||||
//
|
||||
// buttonOk
|
||||
//
|
||||
@ -298,21 +310,21 @@
|
||||
this.buttonOk.UseVisualStyleBackColor = true;
|
||||
this.buttonOk.Click += new System.EventHandler(this.buttonOk_Click);
|
||||
//
|
||||
// buttonNo
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonNo.Location = new System.Drawing.Point(639, 168);
|
||||
this.buttonNo.Name = "buttonNo";
|
||||
this.buttonNo.Size = new System.Drawing.Size(96, 23);
|
||||
this.buttonNo.TabIndex = 3;
|
||||
this.buttonNo.Text = "Отмена";
|
||||
this.buttonNo.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Location = new System.Drawing.Point(639, 168);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(96, 23);
|
||||
this.buttonCancel.TabIndex = 3;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormPlaneConfig
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(764, 193);
|
||||
this.Controls.Add(this.buttonNo);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonOk);
|
||||
this.Controls.Add(this.panelObject);
|
||||
this.Controls.Add(this.groupBoxConfig);
|
||||
@ -354,7 +366,7 @@
|
||||
private Panel panelObject;
|
||||
private Label labelDopColor;
|
||||
private Button buttonOk;
|
||||
private Button buttonNo;
|
||||
private Button buttonCancel;
|
||||
private Label labelBaseColor;
|
||||
}
|
||||
}
|
@ -35,6 +35,7 @@ namespace Airbus
|
||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||
// TODO buttonCancel.Click with lambda
|
||||
buttonCancel.Click += (s, e) => Close();
|
||||
}
|
||||
/// <summary>
|
||||
/// Отрисовать машину
|
||||
@ -141,6 +142,17 @@ namespace Airbus
|
||||
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
// TODO Call method from object _car and set color
|
||||
var color = (Color)e.Data.GetData(typeof(Color));
|
||||
if (_plane is DrawningAirbus)
|
||||
{
|
||||
_plane = ((DrawningAirbus)_plane).SetBaseColor(bodyColor: color);
|
||||
}
|
||||
|
||||
else if (_plane is DrawningAirbus)
|
||||
{
|
||||
_plane = _plane.SetBaseColor(bodyColor: color);
|
||||
}
|
||||
DrawPlane();
|
||||
}
|
||||
/// <summary>
|
||||
/// Принимаем дополнительный цвет
|
||||
@ -149,7 +161,12 @@ namespace Airbus
|
||||
/// <param name="e"></param>
|
||||
private void LabelDopColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
// TODO Call method from object _car if _car is DrawningSportCar and set dop color
|
||||
var color = (Color)e.Data.GetData(typeof(Color));
|
||||
if (_plane is DrawningAirbus)
|
||||
{
|
||||
_plane = ((DrawningAirbus)_plane).SetDopColor(dopColor: color);
|
||||
}
|
||||
DrawPlane();
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление машины
|
||||
|
Loading…
Reference in New Issue
Block a user