Compare commits

..

3 Commits

5 changed files with 484 additions and 177 deletions

View File

@ -28,170 +28,288 @@
/// </summary>
private void InitializeComponent()
{
this.buttonDown1 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.buttonAddMap = new System.Windows.Forms.Button();
this.listBoxMaps = new System.Windows.Forms.ListBox();
this.ButtonDeleteMap = new System.Windows.Forms.Button();
this.textBoxNewMapName = new System.Windows.Forms.TextBox();
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
this.buttonRight = new System.Windows.Forms.Button();
this.buttonLeft = new System.Windows.Forms.Button();
this.buttonUp = new System.Windows.Forms.Button();
this.buttonDown = new System.Windows.Forms.Button();
this.buttonRight1 = new System.Windows.Forms.Button();
this.buttonLeft1 = new System.Windows.Forms.Button();
this.buttonUp1 = new System.Windows.Forms.Button();
this.ButtonShowOnMap = new System.Windows.Forms.Button();
this.ButtonShowStorage = new System.Windows.Forms.Button();
this.ButtonRemoveJet = new System.Windows.Forms.Button();
this.maskedTextBoxPosition = new System.Windows.Forms.TextBox();
this.ButtonAddJet = new System.Windows.Forms.Button();
this.comboBoxCelectorMap1 = new System.Windows.Forms.ComboBox();
this.buttonLeft = new System.Windows.Forms.Button();
this.buttonRight = new System.Windows.Forms.Button();
this.buttonDown = new System.Windows.Forms.Button();
this.buttonUp = new System.Windows.Forms.Button();
this.ButtonRemoveJet = new System.Windows.Forms.Button();
this.pictureBoxJet = new System.Windows.Forms.PictureBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxJet)).BeginInit();
this.SuspendLayout();
//
// buttonDown1
//
this.buttonDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDown1.BackgroundImage = global::AirBomber.Properties.Resources.arrowDown;
this.buttonDown1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonDown1.Location = new System.Drawing.Point(68, 899);
this.buttonDown1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonDown1.Name = "buttonDown1";
this.buttonDown1.Size = new System.Drawing.Size(35, 30);
this.buttonDown1.TabIndex = 7;
this.buttonDown1.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Controls.Add(this.buttonRight);
this.groupBox1.Controls.Add(this.buttonLeft);
this.groupBox1.Controls.Add(this.buttonUp);
this.groupBox1.Controls.Add(this.buttonDown);
this.groupBox1.Controls.Add(this.buttonRight1);
this.groupBox1.Controls.Add(this.buttonLeft1);
this.groupBox1.Controls.Add(this.buttonUp1);
this.groupBox1.Controls.Add(this.buttonDown1);
this.groupBox1.Controls.Add(this.ButtonShowOnMap);
this.groupBox1.Controls.Add(this.ButtonShowStorage);
this.groupBox1.Controls.Add(this.ButtonRemoveJet);
this.groupBox1.Controls.Add(this.maskedTextBoxPosition);
this.groupBox1.Controls.Add(this.ButtonAddJet);
this.groupBox1.Controls.Add(this.comboBoxCelectorMap1);
this.groupBox1.Controls.Add(this.buttonLeft);
this.groupBox1.Controls.Add(this.buttonRight);
this.groupBox1.Controls.Add(this.buttonDown);
this.groupBox1.Controls.Add(this.buttonUp);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Right;
this.groupBox1.Location = new System.Drawing.Point(680, 0);
this.groupBox1.Controls.Add(this.ButtonRemoveJet);
this.groupBox1.Location = new System.Drawing.Point(893, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(200, 524);
this.groupBox1.TabIndex = 0;
this.groupBox1.Size = new System.Drawing.Size(191, 561);
this.groupBox1.TabIndex = 7;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Инструменты";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.buttonAddMap);
this.groupBox2.Controls.Add(this.listBoxMaps);
this.groupBox2.Controls.Add(this.ButtonDeleteMap);
this.groupBox2.Controls.Add(this.textBoxNewMapName);
this.groupBox2.Controls.Add(this.comboBoxSelectorMap);
this.groupBox2.Location = new System.Drawing.Point(12, 22);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(173, 235);
this.groupBox2.TabIndex = 15;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Карты";
//
// buttonAddMap
//
this.buttonAddMap.Location = new System.Drawing.Point(6, 85);
this.buttonAddMap.Name = "buttonAddMap";
this.buttonAddMap.Size = new System.Drawing.Size(161, 23);
this.buttonAddMap.TabIndex = 9;
this.buttonAddMap.Text = "Добавить карту";
this.buttonAddMap.UseVisualStyleBackColor = true;
this.buttonAddMap.Click += new System.EventHandler(this.ButtonAddMap_Click);
//
// listBoxMaps
//
this.listBoxMaps.FormattingEnabled = true;
this.listBoxMaps.ItemHeight = 15;
this.listBoxMaps.Location = new System.Drawing.Point(6, 115);
this.listBoxMaps.Name = "listBoxMaps";
this.listBoxMaps.Size = new System.Drawing.Size(161, 79);
this.listBoxMaps.TabIndex = 8;
this.listBoxMaps.SelectedIndexChanged += new System.EventHandler(this.ListBoxMaps_SelectedIndexChanged);
//
// ButtonDeleteMap
//
this.ButtonDeleteMap.Location = new System.Drawing.Point(6, 200);
this.ButtonDeleteMap.Name = "ButtonDeleteMap";
this.ButtonDeleteMap.Size = new System.Drawing.Size(161, 23);
this.ButtonDeleteMap.TabIndex = 7;
this.ButtonDeleteMap.Text = "Удалить карту";
this.ButtonDeleteMap.UseVisualStyleBackColor = true;
this.ButtonDeleteMap.Click += new System.EventHandler(this.ButtonDeleteMap_Click);
//
// textBoxNewMapName
//
this.textBoxNewMapName.Location = new System.Drawing.Point(6, 51);
this.textBoxNewMapName.Name = "textBoxNewMapName";
this.textBoxNewMapName.Size = new System.Drawing.Size(161, 23);
this.textBoxNewMapName.TabIndex = 6;
//
// comboBoxSelectorMap
//
this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxSelectorMap.FormattingEnabled = true;
this.comboBoxSelectorMap.Location = new System.Drawing.Point(6, 22);
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
this.comboBoxSelectorMap.Size = new System.Drawing.Size(161, 23);
this.comboBoxSelectorMap.TabIndex = 5;
//
// buttonRight
//
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRight.BackgroundImage = global::AirBomber.Properties.Resources.arrowRight;
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonRight.Location = new System.Drawing.Point(116, 509);
this.buttonRight.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonRight.Name = "buttonRight";
this.buttonRight.Size = new System.Drawing.Size(35, 30);
this.buttonRight.TabIndex = 14;
this.buttonRight.UseVisualStyleBackColor = true;
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonLeft
//
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLeft.BackgroundImage = global::AirBomber.Properties.Resources.arrowLeft;
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonLeft.Location = new System.Drawing.Point(34, 509);
this.buttonLeft.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonLeft.Name = "buttonLeft";
this.buttonLeft.Size = new System.Drawing.Size(35, 30);
this.buttonLeft.TabIndex = 13;
this.buttonLeft.UseVisualStyleBackColor = true;
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonUp
//
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUp.BackgroundImage = global::AirBomber.Properties.Resources.arrowUp;
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonUp.Location = new System.Drawing.Point(75, 475);
this.buttonUp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonUp.Name = "buttonUp";
this.buttonUp.Size = new System.Drawing.Size(35, 30);
this.buttonUp.TabIndex = 12;
this.buttonUp.UseVisualStyleBackColor = true;
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonDown
//
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDown.BackgroundImage = global::AirBomber.Properties.Resources.arrowDown;
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonDown.Location = new System.Drawing.Point(75, 509);
this.buttonDown.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonDown.Name = "buttonDown";
this.buttonDown.Size = new System.Drawing.Size(35, 30);
this.buttonDown.TabIndex = 11;
this.buttonDown.UseVisualStyleBackColor = true;
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonRight1
//
this.buttonRight1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRight1.BackgroundImage = global::AirBomber.Properties.Resources.arrowRight;
this.buttonRight1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonRight1.Location = new System.Drawing.Point(109, 899);
this.buttonRight1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonRight1.Name = "buttonRight1";
this.buttonRight1.Size = new System.Drawing.Size(35, 30);
this.buttonRight1.TabIndex = 10;
this.buttonRight1.UseVisualStyleBackColor = true;
//
// buttonLeft1
//
this.buttonLeft1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLeft1.BackgroundImage = global::AirBomber.Properties.Resources.arrowLeft;
this.buttonLeft1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonLeft1.Location = new System.Drawing.Point(27, 899);
this.buttonLeft1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonLeft1.Name = "buttonLeft1";
this.buttonLeft1.Size = new System.Drawing.Size(35, 30);
this.buttonLeft1.TabIndex = 9;
this.buttonLeft1.UseVisualStyleBackColor = true;
//
// buttonUp1
//
this.buttonUp1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUp1.BackgroundImage = global::AirBomber.Properties.Resources.arrowUp;
this.buttonUp1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonUp1.Location = new System.Drawing.Point(68, 865);
this.buttonUp1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonUp1.Name = "buttonUp1";
this.buttonUp1.Size = new System.Drawing.Size(35, 30);
this.buttonUp1.TabIndex = 8;
this.buttonUp1.UseVisualStyleBackColor = true;
//
// ButtonShowOnMap
//
this.ButtonShowOnMap.Location = new System.Drawing.Point(6, 276);
this.ButtonShowOnMap.Location = new System.Drawing.Point(17, 418);
this.ButtonShowOnMap.Name = "ButtonShowOnMap";
this.ButtonShowOnMap.Size = new System.Drawing.Size(182, 23);
this.ButtonShowOnMap.TabIndex = 15;
this.ButtonShowOnMap.Size = new System.Drawing.Size(161, 23);
this.ButtonShowOnMap.TabIndex = 6;
this.ButtonShowOnMap.Text = "Посмотреть карту";
this.ButtonShowOnMap.UseVisualStyleBackColor = true;
this.ButtonShowOnMap.Click += new System.EventHandler(this.ButtonShowOnMap_Click);
//
// ButtonShowStorage
//
this.ButtonShowStorage.Location = new System.Drawing.Point(6, 223);
this.ButtonShowStorage.Location = new System.Drawing.Point(17, 380);
this.ButtonShowStorage.Name = "ButtonShowStorage";
this.ButtonShowStorage.Size = new System.Drawing.Size(182, 23);
this.ButtonShowStorage.TabIndex = 14;
this.ButtonShowStorage.Size = new System.Drawing.Size(161, 23);
this.ButtonShowStorage.TabIndex = 3;
this.ButtonShowStorage.Text = "Посмотреть хранилище";
this.ButtonShowStorage.UseVisualStyleBackColor = true;
this.ButtonShowStorage.Click += new System.EventHandler(this.ButtonShowStorage_Click);
//
// ButtonRemoveJet
//
this.ButtonRemoveJet.Location = new System.Drawing.Point(6, 144);
this.ButtonRemoveJet.Name = "ButtonRemoveJet";
this.ButtonRemoveJet.Size = new System.Drawing.Size(182, 23);
this.ButtonRemoveJet.TabIndex = 13;
this.ButtonRemoveJet.Text = "Удалить самолет";
this.ButtonRemoveJet.UseVisualStyleBackColor = true;
this.ButtonRemoveJet.Click += new System.EventHandler(this.ButtonRemoveJet_Click);
//
// maskedTextBoxPosition
//
this.maskedTextBoxPosition.Location = new System.Drawing.Point(6, 115);
this.maskedTextBoxPosition.Location = new System.Drawing.Point(17, 301);
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
this.maskedTextBoxPosition.Size = new System.Drawing.Size(182, 23);
this.maskedTextBoxPosition.TabIndex = 12;
this.maskedTextBoxPosition.Size = new System.Drawing.Size(161, 23);
this.maskedTextBoxPosition.TabIndex = 4;
//
// ButtonAddJet
//
this.ButtonAddJet.Location = new System.Drawing.Point(6, 68);
this.ButtonAddJet.Location = new System.Drawing.Point(17, 263);
this.ButtonAddJet.Name = "ButtonAddJet";
this.ButtonAddJet.Size = new System.Drawing.Size(182, 23);
this.ButtonAddJet.TabIndex = 11;
this.ButtonAddJet.Size = new System.Drawing.Size(161, 23);
this.ButtonAddJet.TabIndex = 0;
this.ButtonAddJet.Text = "Добавить самолет";
this.ButtonAddJet.UseVisualStyleBackColor = true;
this.ButtonAddJet.Click += new System.EventHandler(this.ButtonAddJet_Click);
//
// comboBoxCelectorMap1
// ButtonRemoveJet
//
this.comboBoxCelectorMap1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxCelectorMap1.FormattingEnabled = true;
this.comboBoxCelectorMap1.Items.AddRange(new object[] {
"Простоя карта",
"Небо"});
this.comboBoxCelectorMap1.Location = new System.Drawing.Point(6, 22);
this.comboBoxCelectorMap1.Name = "comboBoxCelectorMap1";
this.comboBoxCelectorMap1.Size = new System.Drawing.Size(182, 23);
this.comboBoxCelectorMap1.TabIndex = 10;
this.comboBoxCelectorMap1.SelectedIndexChanged += new System.EventHandler(this.comboBoxCelectorMap1_SelectedIndexChanged);
//
// buttonLeft
//
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLeft.BackgroundImage = global::AirBomber.Properties.Resources.arrowLeft;
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.buttonLeft.Location = new System.Drawing.Point(51, 467);
this.buttonLeft.Name = "buttonLeft";
this.buttonLeft.Size = new System.Drawing.Size(35, 30);
this.buttonLeft.TabIndex = 9;
this.buttonLeft.UseVisualStyleBackColor = true;
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonRight
//
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRight.BackgroundImage = global::AirBomber.Properties.Resources.arrowRight;
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.buttonRight.Location = new System.Drawing.Point(133, 467);
this.buttonRight.Name = "buttonRight";
this.buttonRight.Size = new System.Drawing.Size(35, 30);
this.buttonRight.TabIndex = 8;
this.buttonRight.UseVisualStyleBackColor = true;
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonDown
//
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDown.BackgroundImage = global::AirBomber.Properties.Resources.arrowDown;
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.buttonDown.Location = new System.Drawing.Point(92, 467);
this.buttonDown.Name = "buttonDown";
this.buttonDown.Size = new System.Drawing.Size(35, 30);
this.buttonDown.TabIndex = 7;
this.buttonDown.UseVisualStyleBackColor = true;
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonUp
//
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUp.BackgroundImage = global::AirBomber.Properties.Resources.arrowUp;
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.buttonUp.Location = new System.Drawing.Point(92, 431);
this.buttonUp.Name = "buttonUp";
this.buttonUp.Size = new System.Drawing.Size(35, 30);
this.buttonUp.TabIndex = 4;
this.buttonUp.UseVisualStyleBackColor = true;
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
this.ButtonRemoveJet.Location = new System.Drawing.Point(17, 339);
this.ButtonRemoveJet.Name = "ButtonRemoveJet";
this.ButtonRemoveJet.Size = new System.Drawing.Size(161, 23);
this.ButtonRemoveJet.TabIndex = 1;
this.ButtonRemoveJet.Text = "Удалить самолет";
this.ButtonRemoveJet.UseVisualStyleBackColor = true;
this.ButtonRemoveJet.Click += new System.EventHandler(this.ButtonRemoveJet_Click);
//
// pictureBoxJet
//
this.pictureBoxJet.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBoxJet.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBoxJet.Location = new System.Drawing.Point(0, 0);
this.pictureBoxJet.Name = "pictureBoxJet";
this.pictureBoxJet.Size = new System.Drawing.Size(680, 524);
this.pictureBoxJet.TabIndex = 1;
this.pictureBoxJet.Size = new System.Drawing.Size(887, 573);
this.pictureBoxJet.TabIndex = 6;
this.pictureBoxJet.TabStop = false;
//
// FormMapWithSetJets
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(880, 524);
this.Controls.Add(this.pictureBoxJet);
this.ClientSize = new System.Drawing.Size(1096, 573);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.pictureBoxJet);
this.Name = "FormMapWithSetJets";
this.Text = "Карта с набором объектов";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxJet)).EndInit();
this.ResumeLayout(false);
@ -199,17 +317,26 @@
#endregion
private Button buttonDown1;
private GroupBox groupBox1;
private PictureBox pictureBoxJet;
private Button buttonUp;
private Button buttonDown;
private Button buttonRight;
private Button buttonLeft;
private Button buttonRight1;
private Button buttonLeft1;
private Button buttonUp1;
private Button ButtonShowOnMap;
private ComboBox comboBoxSelectorMap;
private Button ButtonShowStorage;
private Button ButtonRemoveJet;
private TextBox maskedTextBoxPosition;
private Button ButtonAddJet;
private ComboBox comboBoxCelectorMap1;
private Button ButtonRemoveJet;
private PictureBox pictureBoxJet;
private Button buttonRight;
private Button buttonLeft;
private Button buttonUp;
private Button buttonDown;
private GroupBox groupBox2;
private Button buttonAddMap;
private ListBox listBoxMaps;
private Button ButtonDeleteMap;
private TextBox textBoxNewMapName;
}
}

View File

@ -13,41 +13,102 @@ namespace AirBomber
{
public partial class FormMapWithSetJets : Form
{
/// <summary>
/// Словарь для выпадающего списка
/// </summary>
private readonly Dictionary<string, AbstractMap> _mapsDict = new()
{
{ "Простая карта", new SimpleMap() },
{ "Небо", new SkyMap() }
};
/// <summary>
/// Объект от коллекции карт
/// </summary>
private readonly MapsCollection _mapsCollection;
/// <summary>
/// Объект от класса карты с набором объектов
/// </summary>
private MapWithSetJetsGeneric<DrawningObjectJet, AbstractMap> _mapJetsCollectionGeneric;
/// <summary>
/// Конструктор
/// </summary>
public FormMapWithSetJets()
{
InitializeComponent();
_mapsCollection = new MapsCollection(pictureBoxJet.Width, pictureBoxJet.Height);
comboBoxSelectorMap.Items.Clear();
foreach (var elem in _mapsDict)
{
comboBoxSelectorMap.Items.Add(elem.Key);
}
}
/// <summary>
/// Заполнение listBoxMaps
/// </summary>
private void ReloadMaps()
{
int index = listBoxMaps.SelectedIndex;
listBoxMaps.Items.Clear();
for (int i = 0; i < _mapsCollection.Keys.Count; i++)
{
listBoxMaps.Items.Add(_mapsCollection.Keys[i]);
}
if (listBoxMaps.Items.Count > 0 && (index == -1 || index >= listBoxMaps.Items.Count))
{
listBoxMaps.SelectedIndex = 0;
}
else if (listBoxMaps.Items.Count > 0 && index > -1 && index < listBoxMaps.Items.Count)
{
listBoxMaps.SelectedIndex = index;
}
}
/// <summary>
/// Добавление карты
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonAddMap_Click(object sender, EventArgs e)
{
if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text))
{
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (!_mapsDict.ContainsKey(comboBoxSelectorMap.Text))
{
MessageBox.Show("Нет такой карты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_mapsCollection.AddMap(textBoxNewMapName.Text, _mapsDict[comboBoxSelectorMap.Text]);
ReloadMaps();
}
/// <summary>
/// Выбор карты
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void comboBoxCelectorMap1_SelectedIndexChanged(object sender, EventArgs e)
private void ListBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
{
AbstractMap map = null;
switch (comboBoxCelectorMap1.Text)
{
case "Простая карта":
map = new SimpleMap();
break;
case "Небо":
map = new SkyMap();
break;
pictureBoxJet.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
}
if (map != null)
/// <summary>
/// Удаление карты
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonDeleteMap_Click(object sender, EventArgs e)
{
_mapJetsCollectionGeneric = new MapWithSetJetsGeneric<DrawningObjectJet, AbstractMap>(pictureBoxJet.Width, pictureBoxJet.Height, map);
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
else
if (MessageBox.Show($"Удалить карту {listBoxMaps.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
_mapJetsCollectionGeneric = null;
_mapsCollection.DelMap(listBoxMaps.SelectedItem?.ToString() ?? string.Empty);
ReloadMaps();
}
}
/// <summary>
@ -57,7 +118,7 @@ namespace AirBomber
/// <param name="e"></param>
private void ButtonAddJet_Click(object sender, EventArgs e)
{
if (_mapJetsCollectionGeneric == null)
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
@ -69,11 +130,11 @@ namespace AirBomber
MessageBox.Show("Сначала создайте объект");
return;
}
DrawningObjectJet bus = new(form.SelectedJet);
if (_mapJetsCollectionGeneric + bus != -1)
DrawningObjectJet jet = new(form.SelectedJet);
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + jet != -1)
{
MessageBox.Show("Объект добавлен");
pictureBoxJet.Image = _mapJetsCollectionGeneric.ShowSet();
pictureBoxJet.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
}
else
{
@ -88,6 +149,12 @@ namespace AirBomber
/// <param name="e"></param>
private void ButtonRemoveJet_Click(object sender, EventArgs e)
{
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))
{
return;
@ -97,10 +164,10 @@ namespace AirBomber
return;
}
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
if (_mapJetsCollectionGeneric - pos != null)
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos != null)
{
MessageBox.Show("Объект удален");
pictureBoxJet.Image = _mapJetsCollectionGeneric.ShowSet();
pictureBoxJet.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
}
else
{
@ -114,11 +181,11 @@ namespace AirBomber
/// <param name="e"></param>
private void ButtonShowStorage_Click(object sender, EventArgs e)
{
if (_mapJetsCollectionGeneric == null)
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
pictureBoxJet.Image = _mapJetsCollectionGeneric.ShowSet();
pictureBoxJet.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
}
/// <summary>
/// Вывод карты
@ -127,15 +194,20 @@ namespace AirBomber
/// <param name="e"></param>
private void ButtonShowOnMap_Click(object sender, EventArgs e)
{
if (_mapJetsCollectionGeneric == null)
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
pictureBoxJet.Image = _mapJetsCollectionGeneric.ShowOnMap();
pictureBoxJet.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowOnMap();
}
/// <summary>
/// Перемещение
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonMove_Click(object sender, EventArgs e)
{
if (_mapJetsCollectionGeneric == null)
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
@ -157,7 +229,7 @@ namespace AirBomber
dir = Direction.Right;
break;
}
pictureBoxJet.Image = _mapJetsCollectionGeneric.MoveObject(dir);
pictureBoxJet.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].MoveObject(dir);
}
}
}

View File

@ -94,14 +94,10 @@ namespace AirBomber
public Bitmap ShowOnMap()
{
Shaking();
for (int i = 0; i < _setJets.Count; i++)
{
var car = _setJets.Get(i);
if (car != null)
foreach (var car in _setJets.GetJets())
{
return _map.CreateMap(_pictureWidth, _pictureHeight, car);
}
}
return new(_pictureWidth, _pictureHeight);
}
/// <summary>
@ -125,11 +121,11 @@ namespace AirBomber
int j = _setJets.Count - 1;
for (int i = 0; i < _setJets.Count; i++)
{
if (_setJets.Get(i) == null)
if (_setJets[i] == null)
{
for (; j > i; j--)
{
var car = _setJets.Get(j);
var car = _setJets[j];
if (car != null)
{
_setJets.Insert(car, i);
@ -189,8 +185,8 @@ namespace AirBomber
{
// установка позиции
//_setJets.Get(i)?.SetObject(ccol * _placeSizeWidth, crow * _placeSizeHeight, _pictureWidth, _pictureHeight);
_setJets.Get(i)?.SetObject(rows - i % cols * _placeSizeWidth, i / cols * _placeSizeHeight + 3, _pictureWidth, _pictureHeight);
_setJets.Get(i)?.DrawningObject(g);
_setJets[i]?.SetObject(rows - i % cols * _placeSizeWidth, i / cols * _placeSizeHeight + 3, _pictureWidth, _pictureHeight);
_setJets[i]?.DrawningObject(g);
//(сначала передвигаемся влево)
ccol++;
if (ccol >= cols)

View File

@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AirBomber
{
/// <summary>
/// Класс для хранения коллекции карт
/// </summary>
internal class MapsCollection
{
/// <summary>
/// Словарь (хранилище) с картами
/// </summary>
readonly Dictionary<string, MapWithSetJetsGeneric<DrawningObjectJet, AbstractMap>> _mapStorages;
/// <summary>
/// Возвращение списка названий карт
/// </summary>
public List<string> Keys => _mapStorages.Keys.ToList();
/// <summary>
/// Ширина окна отрисовки
/// </summary>
private readonly int _pictureWidth;
/// <summary>
/// Высота окна отрисовки
/// </summary>
private readonly int _pictureHeight;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="pictureWidth"></param>
/// <param name="pictureHeight"></param>
public MapsCollection(int pictureWidth, int pictureHeight)
{
_mapStorages = new Dictionary<string, MapWithSetJetsGeneric<DrawningObjectJet, AbstractMap>>();
_pictureWidth = pictureWidth;
_pictureHeight = pictureHeight;
}
/// <summary>
/// Добавление карты
/// </summary>
/// <param name="name">Название карты</param>
/// <param name="map">Карта</param>
public void AddMap(string name, AbstractMap map)
{
MapWithSetJetsGeneric<DrawningObjectJet, AbstractMap> mapJetsCollectionGeneric;
// Если карта или её имя не задано - выходим
if (map == null || string.IsNullOrEmpty(name)) return;
// Если совершается попытка добавить карту с уже существующим именем, то выходим
if (_mapStorages.ContainsKey(name)) return;
mapJetsCollectionGeneric = new MapWithSetJetsGeneric<DrawningObjectJet, AbstractMap>(_pictureWidth, _pictureHeight, map);
_mapStorages.Add(name, mapJetsCollectionGeneric);
}
/// <summary>
/// Удаление карты
/// </summary>
/// <param name="name">Название карты</param>
public void DelMap(string name)
{
// Если имя удаляемой карты не задано - выходим
if (string.IsNullOrEmpty(name)) return;
_mapStorages.Remove(name);
}
/// <summary>
/// Доступ к ангару
/// </summary>
/// <param name="ind"></param>
/// <returns></returns>
public MapWithSetJetsGeneric<DrawningObjectJet, AbstractMap> this[string ind]
{
get
{
if (string.IsNullOrEmpty(ind)) return null;
return _mapStorages[ind];
}
}
}
}

View File

@ -9,23 +9,26 @@ namespace AirBomber
internal class SetJetGeneric<T> where T : class
{
/// <summary>
/// Массив объектов, которые храним (самолетов)
/// Список объектов, которые храним (самолетов)
/// </summary>
private readonly T[] _places;
private readonly List<T> _places;
/// <summary>
/// Количество объектов в массиве
/// Количество объектов в списке
/// </summary>
public int Count => _places.Length;
private int JetPlaces = 0;
public int Count => _places.Count;
/// <summary>
/// Ограничение максимального количества самолетов в списке
/// </summary>
private readonly int _maxCount;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="count">Количество самолетов</param>
public SetJetGeneric(int count)
{
_places = new T[count];
_maxCount = count;
_places = new List<T>();
}
/// <summary>
@ -34,29 +37,20 @@ namespace AirBomber
/// <param name="jet">Добавляемый самолет</param>
/// <param name="position">Позиция</param>
/// <returns></returns>
public int Insert(T jet)
{
return Insert(jet, 0);
}
//public int Insert(T jet)
//{
// return Insert(jet, 0);
//}
public int Insert(T jet, int position = 0)
{
if (position < 0 || position >= _places.Length || JetPlaces == _places.Length)
if (position < 0 || position >= _maxCount || _maxCount <= _places.Count)
{
return -1;
}
JetPlaces++;
while (_places[position] != null)
{
for (int i = _places.Length - 1; i > 0; --i)
{
if (_places[i] == null && _places[i - 1] != null)
{
_places[i] = _places[i - 1];
_places[i - 1] = null;
}
}
}
_places[position] = jet;
_places.Insert(position, jet);
_places.Remove(null);
return position;
}
/// <summary>
@ -66,9 +60,13 @@ namespace AirBomber
/// <returns></returns>
public T Remove(int position)
{
if (position < 0 || position >= _places.Length) return null;
if (position < 0 || position >= _maxCount) return null;
T savedJet = _places[position];
_places[position] = null;
return savedJet;
}
@ -77,11 +75,40 @@ namespace AirBomber
/// </summary>
/// <param name="position">Позиция получаемого самолета</param>
/// <returns></returns>
public T Get(int position)
public T this[int position]
{
get
{
// проверка позиции
if (position < 0 || position >= _places.Length) return null;
if (position < 0 || position >= _maxCount) return null;
return _places[position];
}
set
{
// проверка позиции
if (position < 0 || position >= _maxCount)
{
_places[position] = value;
}
}
}
/// <summary>
/// Проход по набору до первого пустого
/// </summary>
/// <returns></returns>
public IEnumerable<T> GetJets()
{
foreach (var jet in _places)
{
if (jet != null)
{
yield return jet;
}
else
{
yield break;
}
}
}
}
}