Сделаны ТODO
This commit is contained in:
parent
25b16cfdf9
commit
5de55d7ef9
@ -179,7 +179,7 @@ namespace ProjectMachine
|
|||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SetBaseColor(Color color)
|
public virtual void SetBaseColor(Color color)
|
||||||
{
|
{
|
||||||
Machine = new EntityMachine(Machine.Speed, Machine.Weight, color);
|
Machine = new EntityMachine(Machine.Speed, Machine.Weight, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ namespace ProjectMachine
|
|||||||
dopColor = dialogDop.Color;
|
dopColor = dialogDop.Color;
|
||||||
}
|
}
|
||||||
_machine = new DrawningTank(rnd.Next(100, 300), rnd.Next(1000, 2000), color, dopColor,
|
_machine = new DrawningTank(rnd.Next(100, 300), rnd.Next(1000, 2000), color, dopColor,
|
||||||
Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
|
Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
|
||||||
SetData();
|
SetData();
|
||||||
Draw();
|
Draw();
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ namespace ProjectMachine
|
|||||||
private void ButtonCreateModif_Click(object sender, EventArgs e)
|
private void ButtonCreateModif_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random rnd = new();
|
Random rnd = new();
|
||||||
var machine = new DrawningTank(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
|
var machine = new DrawningTank(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
|
||||||
SetData(machine);
|
SetData(machine);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -115,9 +115,25 @@ namespace ProjectMachine
|
|||||||
private void ButtonAddTank_Click(object sender, EventArgs e)
|
private void ButtonAddTank_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var formTankConfig = new FormTankConfig();
|
var formTankConfig = new FormTankConfig();
|
||||||
// TODO Call method AddEvent from formCarConfig
|
formTankConfig.AddEvent(new(AddTank));
|
||||||
formTankConfig.Show();
|
formTankConfig.Show();
|
||||||
}
|
}
|
||||||
|
private void AddTank(DrawningMachine tank)
|
||||||
|
{
|
||||||
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Перед добавлением объекта необходимо создать карту");
|
||||||
|
}
|
||||||
|
else if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObject(tank) != -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект добавлен");
|
||||||
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Удаление объекта
|
/// Удаление объекта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.groupBoxConfig = new System.Windows.Forms.GroupBox();
|
this.groupBoxConfig = new System.Windows.Forms.GroupBox();
|
||||||
this.checkBoxBodyKit = new System.Windows.Forms.CheckBox();
|
|
||||||
this.labelModifiedObject = new System.Windows.Forms.Label();
|
this.labelModifiedObject = new System.Windows.Forms.Label();
|
||||||
this.labelSimpleObject = new System.Windows.Forms.Label();
|
this.labelSimpleObject = new System.Windows.Forms.Label();
|
||||||
this.groupBoxColors = new System.Windows.Forms.GroupBox();
|
this.groupBoxColors = new System.Windows.Forms.GroupBox();
|
||||||
@ -63,7 +62,6 @@
|
|||||||
//
|
//
|
||||||
// groupBoxConfig
|
// groupBoxConfig
|
||||||
//
|
//
|
||||||
this.groupBoxConfig.Controls.Add(this.checkBoxBodyKit);
|
|
||||||
this.groupBoxConfig.Controls.Add(this.labelModifiedObject);
|
this.groupBoxConfig.Controls.Add(this.labelModifiedObject);
|
||||||
this.groupBoxConfig.Controls.Add(this.labelSimpleObject);
|
this.groupBoxConfig.Controls.Add(this.labelSimpleObject);
|
||||||
this.groupBoxConfig.Controls.Add(this.groupBoxColors);
|
this.groupBoxConfig.Controls.Add(this.groupBoxColors);
|
||||||
@ -80,17 +78,6 @@
|
|||||||
this.groupBoxConfig.TabStop = false;
|
this.groupBoxConfig.TabStop = false;
|
||||||
this.groupBoxConfig.Text = "Параметры";
|
this.groupBoxConfig.Text = "Параметры";
|
||||||
//
|
//
|
||||||
// checkBoxBodyKit
|
|
||||||
//
|
|
||||||
this.checkBoxBodyKit.AutoSize = true;
|
|
||||||
this.checkBoxBodyKit.Location = new System.Drawing.Point(6, 136);
|
|
||||||
this.checkBoxBodyKit.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
|
||||||
this.checkBoxBodyKit.Name = "checkBoxBodyKit";
|
|
||||||
this.checkBoxBodyKit.Size = new System.Drawing.Size(207, 24);
|
|
||||||
this.checkBoxBodyKit.TabIndex = 18;
|
|
||||||
this.checkBoxBodyKit.Text = "Признак наличия обвеса";
|
|
||||||
this.checkBoxBodyKit.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// labelModifiedObject
|
// labelModifiedObject
|
||||||
//
|
//
|
||||||
this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
@ -207,7 +194,7 @@
|
|||||||
// checkBoxGun
|
// checkBoxGun
|
||||||
//
|
//
|
||||||
this.checkBoxGun.AutoSize = true;
|
this.checkBoxGun.AutoSize = true;
|
||||||
this.checkBoxGun.Location = new System.Drawing.Point(6, 223);
|
this.checkBoxGun.Location = new System.Drawing.Point(10, 172);
|
||||||
this.checkBoxGun.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.checkBoxGun.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.checkBoxGun.Name = "checkBoxGun";
|
this.checkBoxGun.Name = "checkBoxGun";
|
||||||
this.checkBoxGun.Size = new System.Drawing.Size(299, 24);
|
this.checkBoxGun.Size = new System.Drawing.Size(299, 24);
|
||||||
@ -218,7 +205,7 @@
|
|||||||
// checkBoxTurret
|
// checkBoxTurret
|
||||||
//
|
//
|
||||||
this.checkBoxTurret.AutoSize = true;
|
this.checkBoxTurret.AutoSize = true;
|
||||||
this.checkBoxTurret.Location = new System.Drawing.Point(6, 181);
|
this.checkBoxTurret.Location = new System.Drawing.Point(10, 124);
|
||||||
this.checkBoxTurret.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.checkBoxTurret.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.checkBoxTurret.Name = "checkBoxTurret";
|
this.checkBoxTurret.Name = "checkBoxTurret";
|
||||||
this.checkBoxTurret.Size = new System.Drawing.Size(281, 24);
|
this.checkBoxTurret.Size = new System.Drawing.Size(281, 24);
|
||||||
@ -382,6 +369,5 @@
|
|||||||
private PictureBox pictureBoxObject;
|
private PictureBox pictureBoxObject;
|
||||||
private Button buttonOk;
|
private Button buttonOk;
|
||||||
private Button buttonCancel;
|
private Button buttonCancel;
|
||||||
private CheckBox checkBoxBodyKit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,7 +19,7 @@ namespace ProjectMachine
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Событие
|
/// Событие
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private event TankDelegate EventAddTank;
|
private event Action<DrawningMachine> EventAddTank;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -51,11 +51,11 @@ namespace ProjectMachine
|
|||||||
/// Добавление события
|
/// Добавление события
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ev"></param>
|
/// <param name="ev"></param>
|
||||||
public void AddEvent(TankDelegate ev)
|
public void AddEvent(Action<DrawningMachine> ev)
|
||||||
{
|
{
|
||||||
if (EventAddTank == null)
|
if (EventAddTank == null)
|
||||||
{
|
{
|
||||||
EventAddTank = new TankDelegate(ev);
|
EventAddTank = new (ev);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -138,7 +138,11 @@ namespace ProjectMachine
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
|
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (_tank != null)
|
||||||
|
{
|
||||||
|
_tank.SetBaseColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
|
DrawTank();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Принимаем дополнительный цвет
|
/// Принимаем дополнительный цвет
|
||||||
|
Loading…
Reference in New Issue
Block a user