Финальные изменения.

This commit is contained in:
devil_1nc 2022-11-22 13:43:16 +04:00
parent 95a71bd44b
commit 3d89eca38e
3 changed files with 82 additions and 72 deletions

View File

@ -29,7 +29,6 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.groupBoxTools = new System.Windows.Forms.GroupBox(); this.groupBoxTools = new System.Windows.Forms.GroupBox();
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
this.maskedTextBoxPosition = new System.Windows.Forms.TextBox(); this.maskedTextBoxPosition = new System.Windows.Forms.TextBox();
this.buttonAddPlane = new System.Windows.Forms.Button(); this.buttonAddPlane = new System.Windows.Forms.Button();
this.buttonRemovePlane = new System.Windows.Forms.Button(); this.buttonRemovePlane = new System.Windows.Forms.Button();
@ -39,15 +38,16 @@
this.buttonDown = new System.Windows.Forms.Button(); this.buttonDown = new System.Windows.Forms.Button();
this.buttonRight = new System.Windows.Forms.Button(); this.buttonRight = new System.Windows.Forms.Button();
this.buttonUp = new System.Windows.Forms.Button(); this.buttonUp = new System.Windows.Forms.Button();
this.pictureBox = new System.Windows.Forms.PictureBox();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBoxNewMapName = new System.Windows.Forms.TextBox();
this.buttonDeleteMap = new System.Windows.Forms.Button();
this.buttonAddMap = new System.Windows.Forms.Button();
this.listBoxMaps = new System.Windows.Forms.ListBox(); this.listBoxMaps = new System.Windows.Forms.ListBox();
this.buttonAddMap = new System.Windows.Forms.Button();
this.buttonDeleteMap = new System.Windows.Forms.Button();
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
this.textBoxNewMapName = new System.Windows.Forms.TextBox();
this.pictureBox = new System.Windows.Forms.PictureBox();
this.groupBoxTools.SuspendLayout(); this.groupBoxTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBoxTools // groupBoxTools
@ -70,21 +70,6 @@
this.groupBoxTools.TabStop = false; this.groupBoxTools.TabStop = false;
this.groupBoxTools.Text = "Инструменты"; this.groupBoxTools.Text = "Инструменты";
// //
// comboBoxSelectorMap
//
this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxSelectorMap.FormattingEnabled = true;
this.comboBoxSelectorMap.Items.AddRange(new object[] {
"Простая карта",
"Пустыня",
"Космос"});
this.comboBoxSelectorMap.Location = new System.Drawing.Point(15, 50);
this.comboBoxSelectorMap.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
this.comboBoxSelectorMap.Size = new System.Drawing.Size(167, 23);
this.comboBoxSelectorMap.TabIndex = 9;
this.comboBoxSelectorMap.Click += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged);
//
// maskedTextBoxPosition // maskedTextBoxPosition
// //
this.maskedTextBoxPosition.Location = new System.Drawing.Point(21, 290); this.maskedTextBoxPosition.Location = new System.Drawing.Point(21, 290);
@ -176,15 +161,6 @@
this.buttonUp.UseVisualStyleBackColor = true; this.buttonUp.UseVisualStyleBackColor = true;
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click); this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
// //
// pictureBox
//
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox.Location = new System.Drawing.Point(0, 0);
this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(627, 534);
this.pictureBox.TabIndex = 1;
this.pictureBox.TabStop = false;
//
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.listBoxMaps); this.groupBox1.Controls.Add(this.listBoxMaps);
@ -199,21 +175,15 @@
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Карты"; this.groupBox1.Text = "Карты";
// //
// textBoxNewMapName // listBoxMaps
// //
this.textBoxNewMapName.Location = new System.Drawing.Point(15, 22); this.listBoxMaps.FormattingEnabled = true;
this.textBoxNewMapName.Name = "textBoxNewMapName"; this.listBoxMaps.ItemHeight = 15;
this.textBoxNewMapName.Size = new System.Drawing.Size(167, 23); this.listBoxMaps.Location = new System.Drawing.Point(15, 107);
this.textBoxNewMapName.TabIndex = 11; this.listBoxMaps.Name = "listBoxMaps";
// this.listBoxMaps.Size = new System.Drawing.Size(167, 79);
// buttonDeleteMap this.listBoxMaps.TabIndex = 14;
// this.listBoxMaps.SelectedIndexChanged += new System.EventHandler(this.ListBoxMaps_SelectedIndexChanged);
this.buttonDeleteMap.Location = new System.Drawing.Point(15, 191);
this.buttonDeleteMap.Name = "buttonDeleteMap";
this.buttonDeleteMap.Size = new System.Drawing.Size(167, 23);
this.buttonDeleteMap.TabIndex = 12;
this.buttonDeleteMap.Text = "Удалить карту";
this.buttonDeleteMap.UseVisualStyleBackColor = true;
// //
// buttonAddMap // buttonAddMap
// //
@ -223,15 +193,47 @@
this.buttonAddMap.TabIndex = 13; this.buttonAddMap.TabIndex = 13;
this.buttonAddMap.Text = "Добавить карту"; this.buttonAddMap.Text = "Добавить карту";
this.buttonAddMap.UseVisualStyleBackColor = true; this.buttonAddMap.UseVisualStyleBackColor = true;
this.buttonAddMap.Click += new System.EventHandler(this.ButtonAddMap_Click_1);
// //
// listBoxMaps // buttonDeleteMap
// //
this.listBoxMaps.FormattingEnabled = true; this.buttonDeleteMap.Location = new System.Drawing.Point(15, 191);
this.listBoxMaps.ItemHeight = 15; this.buttonDeleteMap.Name = "buttonDeleteMap";
this.listBoxMaps.Location = new System.Drawing.Point(15, 107); this.buttonDeleteMap.Size = new System.Drawing.Size(167, 23);
this.listBoxMaps.Name = "listBoxMaps"; this.buttonDeleteMap.TabIndex = 12;
this.listBoxMaps.Size = new System.Drawing.Size(167, 79); this.buttonDeleteMap.Text = "Удалить карту";
this.listBoxMaps.TabIndex = 14; this.buttonDeleteMap.UseVisualStyleBackColor = true;
this.buttonDeleteMap.Click += new System.EventHandler(this.buttonDeleteMap_Click);
//
// comboBoxSelectorMap
//
this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxSelectorMap.FormattingEnabled = true;
this.comboBoxSelectorMap.Items.AddRange(new object[] {
"Простая карта",
"Пустыня",
"Космос"});
this.comboBoxSelectorMap.Location = new System.Drawing.Point(15, 50);
this.comboBoxSelectorMap.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
this.comboBoxSelectorMap.Size = new System.Drawing.Size(167, 23);
this.comboBoxSelectorMap.TabIndex = 9;
//
// textBoxNewMapName
//
this.textBoxNewMapName.Location = new System.Drawing.Point(15, 22);
this.textBoxNewMapName.Name = "textBoxNewMapName";
this.textBoxNewMapName.Size = new System.Drawing.Size(167, 23);
this.textBoxNewMapName.TabIndex = 11;
//
// pictureBox
//
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox.Location = new System.Drawing.Point(0, 0);
this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(627, 534);
this.pictureBox.TabIndex = 1;
this.pictureBox.TabStop = false;
// //
// FormMapWithSetPlanes // FormMapWithSetPlanes
// //
@ -244,9 +246,9 @@
this.Text = "FormMapWithSetPlanes"; this.Text = "FormMapWithSetPlanes";
this.groupBoxTools.ResumeLayout(false); this.groupBoxTools.ResumeLayout(false);
this.groupBoxTools.PerformLayout(); this.groupBoxTools.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }

View File

@ -26,13 +26,13 @@ namespace Airbus
public FormMapWithSetPlanes() public FormMapWithSetPlanes()
{ {
InitializeComponent();
_mapsCollection = new MapsCollection(pictureBox.Width, pictureBox.Height); _mapsCollection = new MapsCollection(pictureBox.Width, pictureBox.Height);
comboBoxSelectorMap.Items.Clear(); comboBoxSelectorMap.Items.Clear();
foreach (var element in _mapsDict) foreach (var element in _mapsDict)
{ {
comboBoxSelectorMap.Items.Add(element.Key); comboBoxSelectorMap.Items.Add(element.Key);
} }
InitializeComponent();
} }
//заполнение ListBoxMaps //заполнение ListBoxMaps
@ -40,8 +40,12 @@ namespace Airbus
{ {
int index = listBoxMaps.SelectedIndex; int index = listBoxMaps.SelectedIndex;
listBoxMaps.Items.Clear();
for (int i = 0; i < _mapsCollection.Keys.Count; i++) for (int i = 0; i < _mapsCollection.Keys.Count; i++)
{
listBoxMaps.Items.Add(_mapsCollection.Keys[i]); listBoxMaps.Items.Add(_mapsCollection.Keys[i]);
}
if (listBoxMaps.Items.Count > 0 && (index == -1 || index >= listBoxMaps.Items.Count)) if (listBoxMaps.Items.Count > 0 && (index == -1 || index >= listBoxMaps.Items.Count))
{ {
@ -50,7 +54,6 @@ namespace Airbus
else if (listBoxMaps.Items.Count > 0 && index > -1 && index < listBoxMaps.Items.Count) else if (listBoxMaps.Items.Count > 0 && index > -1 && index < listBoxMaps.Items.Count)
{ {
listBoxMaps.SelectedIndex = index; listBoxMaps.SelectedIndex = index;
} }
} }
//добавление карты //добавление карты

View File

@ -131,29 +131,31 @@ namespace Airbus
//линия разметки места //линия разметки места
for (int j = 2; j < _pictureHeight / _placeSizeHeight + 1; ++j) for (int j = 2; j < _pictureHeight / _placeSizeHeight + 1; ++j)
{ {
g.DrawLine(pen, i * _placeSizeWidth - 20, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2 + 5, j * _placeSizeHeight); g.DrawLine(pen, i * _placeSizeWidth +5, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2 + 5, j * _placeSizeHeight);
g.DrawLine(pen, i * _placeSizeWidth +400, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2 + 5, j * _placeSizeHeight);
} }
g.DrawLine(pen, i * _placeSizeWidth - 20, _placeSizeHeight * 2, i * _placeSizeWidth - 20, (_pictureHeight / _placeSizeHeight) * _placeSizeHeight); g.DrawLine(pen, i * _placeSizeWidth +200, _placeSizeHeight *2, i * _placeSizeWidth +200, (_pictureHeight / _placeSizeHeight) * _placeSizeHeight+100);
g.DrawLine(pen, i * _placeSizeWidth +5, _placeSizeHeight *2, i * _placeSizeWidth+5, (_pictureHeight / _placeSizeHeight) * _placeSizeHeight+100);
} }
//отрисовка разметки взлётной полосы //отрисовка разметки взлётной полосы
g.FillRectangle(marcupBrush, _placeSizeWidth * 3 + 10, 0, 185, _pictureHeight); g.FillRectangle(marcupBrush, _placeSizeWidth * 2 + 30, 0, 185, _pictureHeight);
g.FillRectangle(asphaltBrush, _placeSizeWidth * 3 + 15, 0, 175, _pictureHeight); g.FillRectangle(asphaltBrush, _placeSizeWidth * 2 + 35, 0, 175, _pictureHeight);
g.DrawLine(marcupPen, _placeSizeWidth * 3 + 190, 0, _placeSizeWidth * 3 + 190, _pictureHeight); g.DrawLine(marcupPen, _placeSizeWidth * 2 + 210, 0, _placeSizeWidth * 2 + 210, _pictureHeight);
g.DrawLine(marcupPen, _placeSizeWidth * 3 + 15, 0, _placeSizeWidth * 3 + 15, _pictureHeight); g.DrawLine(marcupPen, _placeSizeWidth * 2 + 35, 0, _placeSizeWidth * 2 + 35, _pictureHeight);
g.DrawLine(marcupPen, _placeSizeWidth * 3 + 195, 0, _placeSizeWidth * 3 + 195, _pictureHeight); g.DrawLine(marcupPen, _placeSizeWidth * 2 + 215, 0, _placeSizeWidth * 2 + 215, _pictureHeight);
g.DrawLine(marcupPen, _placeSizeWidth * 3 + 10, 0, _placeSizeWidth * 3 + 10, _pictureHeight); g.DrawLine(marcupPen, _placeSizeWidth * 2 + 30, 0, _placeSizeWidth * 2 + 30, _pictureHeight);
for (int i = 0; i < _pictureHeight / _placeSizeHeight; ++i) for (int i = 0; i < _pictureHeight / _placeSizeHeight; ++i)
{ {
g.DrawLine(marcupPen, _placeSizeWidth * 3 + 105, 20 + i * _placeSizeHeight, _placeSizeWidth * 3 + 105, (i + 1) * _placeSizeHeight - 20); g.DrawLine(marcupPen, _placeSizeWidth * 2 + 125, 20 + i * _placeSizeHeight, _placeSizeWidth * 2 + 125, (i + 1) * _placeSizeHeight - 20);
} }
for (int i = 0; i < _pictureHeight / 20; i++) for (int i = 0; i < _pictureHeight / 20; i++)
{ {
g.DrawLine(signalFirePen, _placeSizeWidth * 3 - 5, 20 + i * _placeSizeHeight / 2, _placeSizeWidth * 3 - 5, (i + 1) * _placeSizeHeight / 2 - 20); g.DrawLine(signalFirePen, _placeSizeWidth * 2 + 15, 20 + i * _placeSizeHeight / 2, _placeSizeWidth * 2 + 15, (i + 1) * _placeSizeHeight / 2 - 20);
g.DrawLine(signalFirePen, _placeSizeWidth * 4, 20 + i * _placeSizeHeight / 2, _placeSizeWidth * 4, (i + 1) * _placeSizeHeight / 2 - 20); g.DrawLine(signalFirePen, _placeSizeWidth * 3+20, 20 + i * _placeSizeHeight / 2, _placeSizeWidth * 3+20, (i + 1) * _placeSizeHeight / 2 - 20);
} }
//отрисовка сочков //отрисовка сочков
@ -182,20 +184,23 @@ namespace Airbus
int width = _pictureWidth / _placeSizeWidth; int width = _pictureWidth / _placeSizeWidth;
int height = _pictureHeight / _placeSizeHeight; int height = _pictureHeight / _placeSizeHeight;
int currentWidth = 2; int position = 0;
int currentHeight = 7; int currentWidth = 1;
int currentHeight = 5;
foreach (var plane in _setPlanes.GetAirbus()) foreach (var plane in _setPlanes.GetAirbus())
{ {
plane.SetObject(currentWidth * _placeSizeWidth + 20, currentHeight * _placeSizeHeight + 20, _pictureWidth, _pictureHeight); plane.SetObject(currentWidth * _placeSizeWidth + 20, currentHeight * _placeSizeHeight + 20, _pictureWidth, _pictureHeight);
plane.DrawningObject(g); plane.DrawningObject(g);
if (currentWidth!= 0) if (position % 2 == 0)
{ {
position++;
currentWidth--; currentWidth--;
} }
else else
{ {
currentWidth = 2; position = 0;
currentWidth = 1;
currentHeight--; currentHeight--;
} }
} }