Compare commits
No commits in common. "6c56275f1e264e4f5f873b856221ea63172d9f97" and "8b6f9e2177ed3068e99391c90fa90373f6dced6e" have entirely different histories.
6c56275f1e
...
8b6f9e2177
@ -67,10 +67,5 @@ namespace Warship
|
|||||||
g.DrawLine(pen, _startPosX + 10, _startPosY + 30 - 5, _startPosX + 20, _startPosY + 30 - 5);
|
g.DrawLine(pen, _startPosX + 10, _startPosY + 30 - 5, _startPosX + 20, _startPosY + 30 - 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetModifColor(Color modifColor)
|
|
||||||
{
|
|
||||||
((EntityAdvancedWarship)Warship).DopColor = modifColor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,6 @@ namespace Warship
|
|||||||
_warshipHeight = warshipHeight;
|
_warshipHeight = warshipHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetColor(Color color)
|
|
||||||
{
|
|
||||||
Warship.BodyColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void SetPosition(int x, int y, int width, int height)
|
public void SetPosition(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ namespace Warship
|
|||||||
{
|
{
|
||||||
internal class EntityAdvancedWarship : EntityWarship
|
internal class EntityAdvancedWarship : EntityWarship
|
||||||
{
|
{
|
||||||
public Color DopColor { get; set; }
|
public Color DopColor { get; private set; }
|
||||||
public bool Helipad { get; private set; }
|
public bool Helipad { get; private set; }
|
||||||
public bool Antenna { get; private set; }
|
public bool Antenna { get; private set; }
|
||||||
public bool Missile { get; private set; }
|
public bool Missile { get; private set; }
|
||||||
|
@ -10,7 +10,7 @@ namespace Warship
|
|||||||
{
|
{
|
||||||
public int Speed { get; private set; }
|
public int Speed { get; private set; }
|
||||||
public float Weight { get; private set; }
|
public float Weight { get; private set; }
|
||||||
public Color BodyColor { get; set; }
|
public Color BodyColor { get; private set; }
|
||||||
public int Step => (int)(Speed * 2000 / Weight);
|
public int Step => (int)(Speed * 2000 / Weight);
|
||||||
|
|
||||||
public EntityWarship(int speed, float weight, Color bodyColor)
|
public EntityWarship(int speed, float weight, Color bodyColor)
|
||||||
|
@ -50,26 +50,24 @@ namespace Warship
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonAddWarship_Click(object sender, EventArgs e)
|
private void ButtonAddWarship_Click(object sender, EventArgs e)
|
||||||
{
|
|
||||||
var formWarshipConfig = new FormWarshipConfig();
|
|
||||||
formWarshipConfig.AddEvent(AddWarshipOnMap);
|
|
||||||
formWarshipConfig.Show();
|
|
||||||
}
|
|
||||||
private void AddWarshipOnMap(DrawingWarship drawingWarship)
|
|
||||||
{
|
{
|
||||||
if (listBoxMaps.SelectedIndex == -1)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DrawingObjectWarship warship = new(drawingWarship);
|
FormWarship form = new();
|
||||||
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + warship != -1)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
DrawingObjectWarship warship = new(form.SelectedWarship);
|
||||||
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + warship != -1)
|
||||||
}
|
{
|
||||||
else
|
MessageBox.Show("Объект добавлен");
|
||||||
{
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
383
Warship/Warship/FormWarshipConfig.Designer.cs
generated
383
Warship/Warship/FormWarshipConfig.Designer.cs
generated
@ -1,383 +0,0 @@
|
|||||||
namespace Warship
|
|
||||||
{
|
|
||||||
partial class FormWarshipConfig
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// FormWarshipConfig
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(1271, 418);
|
|
||||||
this.Name = "FormWarshipConfig";
|
|
||||||
this.Text = "Создание объекта";
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.GroupBoxConfig = new System.Windows.Forms.GroupBox();
|
|
||||||
this.LabelAdvancedWarship = new System.Windows.Forms.Label();
|
|
||||||
this.LabelBasicWarship = new System.Windows.Forms.Label();
|
|
||||||
this.GroupBoxColors = new System.Windows.Forms.GroupBox();
|
|
||||||
this.PanelSilver = new System.Windows.Forms.Panel();
|
|
||||||
this.PanelRed = new System.Windows.Forms.Panel();
|
|
||||||
this.PanelBlue = new System.Windows.Forms.Panel();
|
|
||||||
this.PanelCyan = new System.Windows.Forms.Panel();
|
|
||||||
this.PanelLime = new System.Windows.Forms.Panel();
|
|
||||||
this.PanelFuchsia = new System.Windows.Forms.Panel();
|
|
||||||
this.PanelYellow = new System.Windows.Forms.Panel();
|
|
||||||
this.PanelOrange = new System.Windows.Forms.Panel();
|
|
||||||
this.CheckBoxMissile = new System.Windows.Forms.CheckBox();
|
|
||||||
this.CheckBoxAntenna = new System.Windows.Forms.CheckBox();
|
|
||||||
this.CheckBoxHelipad = new System.Windows.Forms.CheckBox();
|
|
||||||
this.NumericUpDownWeight = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.NumericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.LabelWeight = new System.Windows.Forms.Label();
|
|
||||||
this.LabelSpeed = new System.Windows.Forms.Label();
|
|
||||||
this.PictureBoxWarship = new System.Windows.Forms.PictureBox();
|
|
||||||
this.PanelWarship = new System.Windows.Forms.Panel();
|
|
||||||
this.LabelModifColor = new System.Windows.Forms.Label();
|
|
||||||
this.LabelBodyColor = new System.Windows.Forms.Label();
|
|
||||||
this.ButtomAdd = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.GroupBoxConfig.SuspendLayout();
|
|
||||||
this.GroupBoxColors.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.NumericUpDownWeight)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.NumericUpDownSpeed)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.PictureBoxWarship)).BeginInit();
|
|
||||||
this.PanelWarship.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// GroupBoxConfig
|
|
||||||
//
|
|
||||||
this.GroupBoxConfig.Controls.Add(this.LabelAdvancedWarship);
|
|
||||||
this.GroupBoxConfig.Controls.Add(this.LabelBasicWarship);
|
|
||||||
this.GroupBoxConfig.Controls.Add(this.GroupBoxColors);
|
|
||||||
this.GroupBoxConfig.Controls.Add(this.CheckBoxMissile);
|
|
||||||
this.GroupBoxConfig.Controls.Add(this.CheckBoxAntenna);
|
|
||||||
this.GroupBoxConfig.Controls.Add(this.CheckBoxHelipad);
|
|
||||||
this.GroupBoxConfig.Controls.Add(this.NumericUpDownWeight);
|
|
||||||
this.GroupBoxConfig.Controls.Add(this.NumericUpDownSpeed);
|
|
||||||
this.GroupBoxConfig.Controls.Add(this.LabelWeight);
|
|
||||||
this.GroupBoxConfig.Controls.Add(this.LabelSpeed);
|
|
||||||
this.GroupBoxConfig.Location = new System.Drawing.Point(12, 12);
|
|
||||||
this.GroupBoxConfig.Name = "GroupBoxConfig";
|
|
||||||
this.GroupBoxConfig.Size = new System.Drawing.Size(596, 241);
|
|
||||||
this.GroupBoxConfig.TabIndex = 0;
|
|
||||||
this.GroupBoxConfig.TabStop = false;
|
|
||||||
this.GroupBoxConfig.Text = "Параметры: ";
|
|
||||||
//
|
|
||||||
// LabelAdvancedWarship
|
|
||||||
//
|
|
||||||
this.LabelAdvancedWarship.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.LabelAdvancedWarship.Location = new System.Drawing.Point(452, 183);
|
|
||||||
this.LabelAdvancedWarship.Name = "LabelAdvancedWarship";
|
|
||||||
this.LabelAdvancedWarship.Size = new System.Drawing.Size(123, 41);
|
|
||||||
this.LabelAdvancedWarship.TabIndex = 9;
|
|
||||||
this.LabelAdvancedWarship.Text = "Продвинутый корабль";
|
|
||||||
this.LabelAdvancedWarship.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
this.LabelAdvancedWarship.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelWarship_MouseDown);
|
|
||||||
//
|
|
||||||
// LabelBasicWarship
|
|
||||||
//
|
|
||||||
this.LabelBasicWarship.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.LabelBasicWarship.Location = new System.Drawing.Point(321, 183);
|
|
||||||
this.LabelBasicWarship.Name = "LabelBasicWarship";
|
|
||||||
this.LabelBasicWarship.Size = new System.Drawing.Size(125, 41);
|
|
||||||
this.LabelBasicWarship.TabIndex = 8;
|
|
||||||
this.LabelBasicWarship.Text = "Обычный корабль";
|
|
||||||
this.LabelBasicWarship.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
this.LabelBasicWarship.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelWarship_MouseDown);
|
|
||||||
//
|
|
||||||
// GroupBoxColors
|
|
||||||
//
|
|
||||||
this.GroupBoxColors.Controls.Add(this.PanelSilver);
|
|
||||||
this.GroupBoxColors.Controls.Add(this.PanelRed);
|
|
||||||
this.GroupBoxColors.Controls.Add(this.PanelBlue);
|
|
||||||
this.GroupBoxColors.Controls.Add(this.PanelCyan);
|
|
||||||
this.GroupBoxColors.Controls.Add(this.PanelLime);
|
|
||||||
this.GroupBoxColors.Controls.Add(this.PanelFuchsia);
|
|
||||||
this.GroupBoxColors.Controls.Add(this.PanelYellow);
|
|
||||||
this.GroupBoxColors.Controls.Add(this.PanelOrange);
|
|
||||||
this.GroupBoxColors.Location = new System.Drawing.Point(321, 24);
|
|
||||||
this.GroupBoxColors.Name = "GroupBoxColors";
|
|
||||||
this.GroupBoxColors.Size = new System.Drawing.Size(254, 144);
|
|
||||||
this.GroupBoxColors.TabIndex = 7;
|
|
||||||
this.GroupBoxColors.TabStop = false;
|
|
||||||
this.GroupBoxColors.Text = "Цвета: ";
|
|
||||||
//
|
|
||||||
// PanelSilver
|
|
||||||
//
|
|
||||||
this.PanelSilver.BackColor = System.Drawing.Color.Silver;
|
|
||||||
this.PanelSilver.Location = new System.Drawing.Point(191, 78);
|
|
||||||
this.PanelSilver.Name = "PanelSilver";
|
|
||||||
this.PanelSilver.Size = new System.Drawing.Size(44, 45);
|
|
||||||
this.PanelSilver.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// PanelRed
|
|
||||||
//
|
|
||||||
this.PanelRed.BackColor = System.Drawing.Color.Red;
|
|
||||||
this.PanelRed.Location = new System.Drawing.Point(136, 78);
|
|
||||||
this.PanelRed.Name = "PanelRed";
|
|
||||||
this.PanelRed.Size = new System.Drawing.Size(46, 45);
|
|
||||||
this.PanelRed.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// PanelBlue
|
|
||||||
//
|
|
||||||
this.PanelBlue.BackColor = System.Drawing.Color.Blue;
|
|
||||||
this.PanelBlue.Location = new System.Drawing.Point(79, 78);
|
|
||||||
this.PanelBlue.Name = "PanelBlue";
|
|
||||||
this.PanelBlue.Size = new System.Drawing.Size(46, 45);
|
|
||||||
this.PanelBlue.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// PanelCyan
|
|
||||||
//
|
|
||||||
this.PanelCyan.BackColor = System.Drawing.Color.Cyan;
|
|
||||||
this.PanelCyan.Location = new System.Drawing.Point(20, 78);
|
|
||||||
this.PanelCyan.Name = "PanelCyan";
|
|
||||||
this.PanelCyan.Size = new System.Drawing.Size(48, 45);
|
|
||||||
this.PanelCyan.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// PanelLime
|
|
||||||
//
|
|
||||||
this.PanelLime.BackColor = System.Drawing.Color.Lime;
|
|
||||||
this.PanelLime.Location = new System.Drawing.Point(191, 24);
|
|
||||||
this.PanelLime.Name = "PanelLime";
|
|
||||||
this.PanelLime.Size = new System.Drawing.Size(44, 45);
|
|
||||||
this.PanelLime.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// PanelFuchsia
|
|
||||||
//
|
|
||||||
this.PanelFuchsia.BackColor = System.Drawing.Color.Fuchsia;
|
|
||||||
this.PanelFuchsia.Location = new System.Drawing.Point(136, 24);
|
|
||||||
this.PanelFuchsia.Name = "PanelFuchsia";
|
|
||||||
this.PanelFuchsia.Size = new System.Drawing.Size(46, 45);
|
|
||||||
this.PanelFuchsia.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// PanelYellow
|
|
||||||
//
|
|
||||||
this.PanelYellow.BackColor = System.Drawing.Color.Yellow;
|
|
||||||
this.PanelYellow.Location = new System.Drawing.Point(79, 24);
|
|
||||||
this.PanelYellow.Name = "PanelYellow";
|
|
||||||
this.PanelYellow.Size = new System.Drawing.Size(46, 45);
|
|
||||||
this.PanelYellow.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// PanelOrange
|
|
||||||
//
|
|
||||||
this.PanelOrange.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
|
|
||||||
this.PanelOrange.Location = new System.Drawing.Point(20, 24);
|
|
||||||
this.PanelOrange.Name = "PanelOrange";
|
|
||||||
this.PanelOrange.Size = new System.Drawing.Size(48, 45);
|
|
||||||
this.PanelOrange.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// CheckBoxMissile
|
|
||||||
//
|
|
||||||
this.CheckBoxMissile.AutoSize = true;
|
|
||||||
this.CheckBoxMissile.Location = new System.Drawing.Point(42, 205);
|
|
||||||
this.CheckBoxMissile.Name = "CheckBoxMissile";
|
|
||||||
this.CheckBoxMissile.Size = new System.Drawing.Size(200, 19);
|
|
||||||
this.CheckBoxMissile.TabIndex = 6;
|
|
||||||
this.CheckBoxMissile.Text = "Признак наличия боевых ракет";
|
|
||||||
this.CheckBoxMissile.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// CheckBoxAntenna
|
|
||||||
//
|
|
||||||
this.CheckBoxAntenna.AutoSize = true;
|
|
||||||
this.CheckBoxAntenna.Location = new System.Drawing.Point(42, 168);
|
|
||||||
this.CheckBoxAntenna.Name = "CheckBoxAntenna";
|
|
||||||
this.CheckBoxAntenna.Size = new System.Drawing.Size(173, 19);
|
|
||||||
this.CheckBoxAntenna.TabIndex = 5;
|
|
||||||
this.CheckBoxAntenna.Text = "Признак наличия антенны";
|
|
||||||
this.CheckBoxAntenna.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// CheckBoxHelipad
|
|
||||||
//
|
|
||||||
this.CheckBoxHelipad.AutoSize = true;
|
|
||||||
this.CheckBoxHelipad.Location = new System.Drawing.Point(42, 129);
|
|
||||||
this.CheckBoxHelipad.Name = "CheckBoxHelipad";
|
|
||||||
this.CheckBoxHelipad.Size = new System.Drawing.Size(256, 19);
|
|
||||||
this.CheckBoxHelipad.TabIndex = 4;
|
|
||||||
this.CheckBoxHelipad.Text = "Признак наличия вертолетной площадки";
|
|
||||||
this.CheckBoxHelipad.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// NumericUpDownWeight
|
|
||||||
//
|
|
||||||
this.NumericUpDownWeight.Location = new System.Drawing.Point(113, 78);
|
|
||||||
this.NumericUpDownWeight.Name = "NumericUpDownWeight";
|
|
||||||
this.NumericUpDownWeight.Size = new System.Drawing.Size(120, 23);
|
|
||||||
this.NumericUpDownWeight.TabIndex = 3;
|
|
||||||
this.NumericUpDownWeight.Value = new decimal(new int[] {
|
|
||||||
100,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
|
||||||
// NumericUpDownSpeed
|
|
||||||
//
|
|
||||||
this.NumericUpDownSpeed.Location = new System.Drawing.Point(113, 41);
|
|
||||||
this.NumericUpDownSpeed.Name = "NumericUpDownSpeed";
|
|
||||||
this.NumericUpDownSpeed.Size = new System.Drawing.Size(120, 23);
|
|
||||||
this.NumericUpDownSpeed.TabIndex = 2;
|
|
||||||
this.NumericUpDownSpeed.Value = new decimal(new int[] {
|
|
||||||
100,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
|
||||||
// LabelWeight
|
|
||||||
//
|
|
||||||
this.LabelWeight.AutoSize = true;
|
|
||||||
this.LabelWeight.Location = new System.Drawing.Point(42, 80);
|
|
||||||
this.LabelWeight.Name = "LabelWeight";
|
|
||||||
this.LabelWeight.Size = new System.Drawing.Size(32, 15);
|
|
||||||
this.LabelWeight.TabIndex = 1;
|
|
||||||
this.LabelWeight.Text = "Вес: ";
|
|
||||||
//
|
|
||||||
// LabelSpeed
|
|
||||||
//
|
|
||||||
this.LabelSpeed.AutoSize = true;
|
|
||||||
this.LabelSpeed.Location = new System.Drawing.Point(42, 43);
|
|
||||||
this.LabelSpeed.Name = "LabelSpeed";
|
|
||||||
this.LabelSpeed.Size = new System.Drawing.Size(65, 15);
|
|
||||||
this.LabelSpeed.TabIndex = 0;
|
|
||||||
this.LabelSpeed.Text = "Скорость: ";
|
|
||||||
//
|
|
||||||
// PictureBoxWarship
|
|
||||||
//
|
|
||||||
this.PictureBoxWarship.Location = new System.Drawing.Point(29, 53);
|
|
||||||
this.PictureBoxWarship.Name = "PictureBoxWarship";
|
|
||||||
this.PictureBoxWarship.Size = new System.Drawing.Size(240, 136);
|
|
||||||
this.PictureBoxWarship.TabIndex = 1;
|
|
||||||
this.PictureBoxWarship.TabStop = false;
|
|
||||||
//
|
|
||||||
// PanelWarship
|
|
||||||
//
|
|
||||||
this.PanelWarship.AllowDrop = true;
|
|
||||||
this.PanelWarship.Controls.Add(this.LabelModifColor);
|
|
||||||
this.PanelWarship.Controls.Add(this.LabelBodyColor);
|
|
||||||
this.PanelWarship.Controls.Add(this.PictureBoxWarship);
|
|
||||||
this.PanelWarship.Location = new System.Drawing.Point(621, 20);
|
|
||||||
this.PanelWarship.Name = "PanelWarship";
|
|
||||||
this.PanelWarship.Size = new System.Drawing.Size(298, 197);
|
|
||||||
this.PanelWarship.TabIndex = 2;
|
|
||||||
this.PanelWarship.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelWarship_DragDrop);
|
|
||||||
this.PanelWarship.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelWarship_DragEnter);
|
|
||||||
//
|
|
||||||
// LabelModifColor
|
|
||||||
//
|
|
||||||
this.LabelModifColor.AllowDrop = true;
|
|
||||||
this.LabelModifColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.LabelModifColor.Location = new System.Drawing.Point(153, 8);
|
|
||||||
this.LabelModifColor.Name = "LabelModifColor";
|
|
||||||
this.LabelModifColor.Size = new System.Drawing.Size(116, 38);
|
|
||||||
this.LabelModifColor.TabIndex = 3;
|
|
||||||
this.LabelModifColor.Text = "Цвет модификаций корабля";
|
|
||||||
this.LabelModifColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
this.LabelModifColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelModifColor_DragDrop);
|
|
||||||
this.LabelModifColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelModifColor_DragEnter);
|
|
||||||
//
|
|
||||||
// LabelBodyColor
|
|
||||||
//
|
|
||||||
this.LabelBodyColor.AllowDrop = true;
|
|
||||||
this.LabelBodyColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.LabelBodyColor.Location = new System.Drawing.Point(29, 8);
|
|
||||||
this.LabelBodyColor.Name = "LabelBodyColor";
|
|
||||||
this.LabelBodyColor.Size = new System.Drawing.Size(118, 38);
|
|
||||||
this.LabelBodyColor.TabIndex = 2;
|
|
||||||
this.LabelBodyColor.Text = "Цвет корпуса корабля";
|
|
||||||
this.LabelBodyColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
this.LabelBodyColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelBodyColor_DragDrop);
|
|
||||||
this.LabelBodyColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelBodyColor_DragEnter);
|
|
||||||
//
|
|
||||||
// ButtomAdd
|
|
||||||
//
|
|
||||||
this.ButtomAdd.Location = new System.Drawing.Point(685, 227);
|
|
||||||
this.ButtomAdd.Name = "ButtomAdd";
|
|
||||||
this.ButtomAdd.Size = new System.Drawing.Size(83, 27);
|
|
||||||
this.ButtomAdd.TabIndex = 3;
|
|
||||||
this.ButtomAdd.Text = "Добавить";
|
|
||||||
this.ButtomAdd.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtomAdd.Click += new System.EventHandler(this.ButtomAdd_Click);
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
this.ButtonCancel.Location = new System.Drawing.Point(783, 227);
|
|
||||||
this.ButtonCancel.Name = "ButtonCancel";
|
|
||||||
this.ButtonCancel.Size = new System.Drawing.Size(79, 27);
|
|
||||||
this.ButtonCancel.TabIndex = 4;
|
|
||||||
this.ButtonCancel.Text = "Отмена";
|
|
||||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// FormWarshipConfig
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(935, 266);
|
|
||||||
this.Controls.Add(this.ButtonCancel);
|
|
||||||
this.Controls.Add(this.ButtomAdd);
|
|
||||||
this.Controls.Add(this.PanelWarship);
|
|
||||||
this.Controls.Add(this.GroupBoxConfig);
|
|
||||||
this.Name = "FormWarshipConfig";
|
|
||||||
this.Text = "Создание корабля";
|
|
||||||
this.GroupBoxConfig.ResumeLayout(false);
|
|
||||||
this.GroupBoxConfig.PerformLayout();
|
|
||||||
this.GroupBoxColors.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.NumericUpDownWeight)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.NumericUpDownSpeed)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.PictureBoxWarship)).EndInit();
|
|
||||||
this.PanelWarship.ResumeLayout(false);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
private GroupBox GroupBoxConfig;
|
|
||||||
private Label LabelAdvancedWarship;
|
|
||||||
private Label LabelBasicWarship;
|
|
||||||
private GroupBox GroupBoxColors;
|
|
||||||
private Panel PanelSilver;
|
|
||||||
private Panel PanelRed;
|
|
||||||
private Panel PanelBlue;
|
|
||||||
private Panel PanelCyan;
|
|
||||||
private Panel PanelLime;
|
|
||||||
private Panel PanelFuchsia;
|
|
||||||
private Panel PanelYellow;
|
|
||||||
private Panel PanelOrange;
|
|
||||||
private CheckBox CheckBoxMissile;
|
|
||||||
private CheckBox CheckBoxAntenna;
|
|
||||||
private CheckBox CheckBoxHelipad;
|
|
||||||
private NumericUpDown NumericUpDownWeight;
|
|
||||||
private NumericUpDown NumericUpDownSpeed;
|
|
||||||
private Label LabelWeight;
|
|
||||||
private Label LabelSpeed;
|
|
||||||
private PictureBox PictureBoxWarship;
|
|
||||||
private Panel PanelWarship;
|
|
||||||
private Label LabelModifColor;
|
|
||||||
private Label LabelBodyColor;
|
|
||||||
private Button ButtomAdd;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,138 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace Warship
|
|
||||||
{
|
|
||||||
public partial class FormWarshipConfig : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
DrawingWarship _warship = null;
|
|
||||||
private event Action<DrawingWarship> EventAddWarship;
|
|
||||||
public FormWarshipConfig()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
PanelBlue.MouseDown += PanelColor_MouseDown;
|
|
||||||
PanelCyan.MouseDown += PanelColor_MouseDown;
|
|
||||||
PanelFuchsia.MouseDown += PanelColor_MouseDown;
|
|
||||||
PanelLime.MouseDown += PanelColor_MouseDown;
|
|
||||||
PanelOrange.MouseDown += PanelColor_MouseDown;
|
|
||||||
PanelRed.MouseDown += PanelColor_MouseDown;
|
|
||||||
PanelSilver.MouseDown += PanelColor_MouseDown;
|
|
||||||
PanelYellow.MouseDown += PanelColor_MouseDown;
|
|
||||||
ButtonCancel.Click += (sender, e) => Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawWarship()
|
|
||||||
{
|
|
||||||
Bitmap bmp = new(PictureBoxWarship.Width, PictureBoxWarship.Height);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
_warship?.SetPosition(5, 5, PictureBoxWarship.Width, PictureBoxWarship.Height);
|
|
||||||
_warship?.DrawTransport(gr);
|
|
||||||
PictureBoxWarship.Image = bmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddEvent(Action<DrawingWarship> ev)
|
|
||||||
{
|
|
||||||
if (EventAddWarship == null)
|
|
||||||
{
|
|
||||||
EventAddWarship = ev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EventAddWarship += ev;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LabelWarship_MouseDown(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
(sender as Label).DoDragDrop((sender as Label).Name, DragDropEffects.Move | DragDropEffects.Copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PanelWarship_DragEnter(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Data.GetDataPresent(DataFormats.Text))
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.Copy;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PanelWarship_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
switch (e.Data.GetData(DataFormats.Text).ToString())
|
|
||||||
{
|
|
||||||
case "LabelBasicWarship":
|
|
||||||
_warship = new DrawingWarship((int)NumericUpDownSpeed.Value, (int)NumericUpDownWeight.Value, Color.White);
|
|
||||||
break;
|
|
||||||
case "LabelAdvancedWarship":
|
|
||||||
_warship = new DrawingAdvancedWarship((int)NumericUpDownSpeed.Value, (int)NumericUpDownWeight.Value, Color.White, Color.Black, CheckBoxHelipad.Checked, CheckBoxAntenna.Checked, CheckBoxMissile.Checked);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
DrawWarship();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
(sender as Control).DoDragDrop((sender as Control).BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LabelBodyColor_DragEnter(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Data.GetDataPresent(typeof(Color)))
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.Copy;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void LabelModifColor_DragEnter(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (_warship is DrawingAdvancedWarship)
|
|
||||||
{
|
|
||||||
if (e.Data.GetDataPresent(typeof(Color)))
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.Copy;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LabelBodyColor_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
Color BodyColor = (Color)e.Data.GetData(typeof(Color));
|
|
||||||
_warship.SetColor(BodyColor);
|
|
||||||
DrawWarship();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LabelModifColor_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
Color ModifColor = (Color)e.Data.GetData(typeof(Color));
|
|
||||||
if (_warship is DrawingAdvancedWarship AdvancedWarship)
|
|
||||||
{
|
|
||||||
AdvancedWarship.SetModifColor(ModifColor);
|
|
||||||
DrawWarship();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtomAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
EventAddWarship?.Invoke(_warship);
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
Loading…
Reference in New Issue
Block a user