Сделано
This commit is contained in:
parent
29a63c996b
commit
f965d572bd
119
Ship/Ship/FormMapWithSetShips.Designer.cs
generated
119
Ship/Ship/FormMapWithSetShips.Designer.cs
generated
@ -29,6 +29,12 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.groupBoxTools = new System.Windows.Forms.GroupBox();
|
this.groupBoxTools = new System.Windows.Forms.GroupBox();
|
||||||
|
this.groupBoxMaps = new System.Windows.Forms.GroupBox();
|
||||||
|
this.buttonDeleteMap = new System.Windows.Forms.Button();
|
||||||
|
this.listBoxMaps = new System.Windows.Forms.ListBox();
|
||||||
|
this.buttonAddMap = 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.buttonRight = new System.Windows.Forms.Button();
|
||||||
this.buttonDown = new System.Windows.Forms.Button();
|
this.buttonDown = new System.Windows.Forms.Button();
|
||||||
this.buttonLeft = new System.Windows.Forms.Button();
|
this.buttonLeft = new System.Windows.Forms.Button();
|
||||||
@ -38,14 +44,15 @@
|
|||||||
this.buttonRemoveShip = new System.Windows.Forms.Button();
|
this.buttonRemoveShip = new System.Windows.Forms.Button();
|
||||||
this.maskedTextBoxPosition = new System.Windows.Forms.MaskedTextBox();
|
this.maskedTextBoxPosition = new System.Windows.Forms.MaskedTextBox();
|
||||||
this.buttonAddShip = new System.Windows.Forms.Button();
|
this.buttonAddShip = new System.Windows.Forms.Button();
|
||||||
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
|
|
||||||
this.pictureBox = new System.Windows.Forms.PictureBox();
|
this.pictureBox = new System.Windows.Forms.PictureBox();
|
||||||
this.groupBoxTools.SuspendLayout();
|
this.groupBoxTools.SuspendLayout();
|
||||||
|
this.groupBoxMaps.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupBoxTools
|
// groupBoxTools
|
||||||
//
|
//
|
||||||
|
this.groupBoxTools.Controls.Add(this.groupBoxMaps);
|
||||||
this.groupBoxTools.Controls.Add(this.buttonRight);
|
this.groupBoxTools.Controls.Add(this.buttonRight);
|
||||||
this.groupBoxTools.Controls.Add(this.buttonDown);
|
this.groupBoxTools.Controls.Add(this.buttonDown);
|
||||||
this.groupBoxTools.Controls.Add(this.buttonLeft);
|
this.groupBoxTools.Controls.Add(this.buttonLeft);
|
||||||
@ -55,21 +62,83 @@
|
|||||||
this.groupBoxTools.Controls.Add(this.buttonRemoveShip);
|
this.groupBoxTools.Controls.Add(this.buttonRemoveShip);
|
||||||
this.groupBoxTools.Controls.Add(this.maskedTextBoxPosition);
|
this.groupBoxTools.Controls.Add(this.maskedTextBoxPosition);
|
||||||
this.groupBoxTools.Controls.Add(this.buttonAddShip);
|
this.groupBoxTools.Controls.Add(this.buttonAddShip);
|
||||||
this.groupBoxTools.Controls.Add(this.comboBoxSelectorMap);
|
|
||||||
this.groupBoxTools.Dock = System.Windows.Forms.DockStyle.Right;
|
this.groupBoxTools.Dock = System.Windows.Forms.DockStyle.Right;
|
||||||
this.groupBoxTools.Location = new System.Drawing.Point(600, 0);
|
this.groupBoxTools.Location = new System.Drawing.Point(767, 0);
|
||||||
this.groupBoxTools.Name = "groupBoxTools";
|
this.groupBoxTools.Name = "groupBoxTools";
|
||||||
this.groupBoxTools.Size = new System.Drawing.Size(200, 450);
|
this.groupBoxTools.Size = new System.Drawing.Size(200, 619);
|
||||||
this.groupBoxTools.TabIndex = 0;
|
this.groupBoxTools.TabIndex = 0;
|
||||||
this.groupBoxTools.TabStop = false;
|
this.groupBoxTools.TabStop = false;
|
||||||
this.groupBoxTools.Text = "Инструменты";
|
this.groupBoxTools.Text = "Инструменты";
|
||||||
//
|
//
|
||||||
|
// groupBoxMaps
|
||||||
|
//
|
||||||
|
this.groupBoxMaps.Controls.Add(this.buttonDeleteMap);
|
||||||
|
this.groupBoxMaps.Controls.Add(this.listBoxMaps);
|
||||||
|
this.groupBoxMaps.Controls.Add(this.buttonAddMap);
|
||||||
|
this.groupBoxMaps.Controls.Add(this.textBoxNewMapName);
|
||||||
|
this.groupBoxMaps.Controls.Add(this.comboBoxSelectorMap);
|
||||||
|
this.groupBoxMaps.Location = new System.Drawing.Point(6, 22);
|
||||||
|
this.groupBoxMaps.Name = "groupBoxMaps";
|
||||||
|
this.groupBoxMaps.Size = new System.Drawing.Size(182, 289);
|
||||||
|
this.groupBoxMaps.TabIndex = 11;
|
||||||
|
this.groupBoxMaps.TabStop = false;
|
||||||
|
this.groupBoxMaps.Text = "Карты";
|
||||||
|
//
|
||||||
|
// buttonDeleteMap
|
||||||
|
//
|
||||||
|
this.buttonDeleteMap.Location = new System.Drawing.Point(13, 235);
|
||||||
|
this.buttonDeleteMap.Name = "buttonDeleteMap";
|
||||||
|
this.buttonDeleteMap.Size = new System.Drawing.Size(162, 34);
|
||||||
|
this.buttonDeleteMap.TabIndex = 4;
|
||||||
|
this.buttonDeleteMap.Text = "Удалить карту";
|
||||||
|
this.buttonDeleteMap.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonDeleteMap.Click += new System.EventHandler(this.ButtonDeleteMap_Click);
|
||||||
|
//
|
||||||
|
// listBoxMaps
|
||||||
|
//
|
||||||
|
this.listBoxMaps.FormattingEnabled = true;
|
||||||
|
this.listBoxMaps.ItemHeight = 15;
|
||||||
|
this.listBoxMaps.Location = new System.Drawing.Point(13, 120);
|
||||||
|
this.listBoxMaps.Name = "listBoxMaps";
|
||||||
|
this.listBoxMaps.Size = new System.Drawing.Size(163, 109);
|
||||||
|
this.listBoxMaps.TabIndex = 3;
|
||||||
|
this.listBoxMaps.SelectedIndexChanged += new System.EventHandler(this.ListBoxMaps_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// buttonAddMap
|
||||||
|
//
|
||||||
|
this.buttonAddMap.Location = new System.Drawing.Point(14, 80);
|
||||||
|
this.buttonAddMap.Name = "buttonAddMap";
|
||||||
|
this.buttonAddMap.Size = new System.Drawing.Size(162, 34);
|
||||||
|
this.buttonAddMap.TabIndex = 2;
|
||||||
|
this.buttonAddMap.Text = "Добавить карту";
|
||||||
|
this.buttonAddMap.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAddMap.Click += new System.EventHandler(this.ButtonAddMap_Click);
|
||||||
|
//
|
||||||
|
// textBoxNewMapName
|
||||||
|
//
|
||||||
|
this.textBoxNewMapName.Location = new System.Drawing.Point(13, 22);
|
||||||
|
this.textBoxNewMapName.Name = "textBoxNewMapName";
|
||||||
|
this.textBoxNewMapName.Size = new System.Drawing.Size(163, 23);
|
||||||
|
this.textBoxNewMapName.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// 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(13, 51);
|
||||||
|
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
|
||||||
|
this.comboBoxSelectorMap.Size = new System.Drawing.Size(169, 23);
|
||||||
|
this.comboBoxSelectorMap.TabIndex = 0;
|
||||||
|
//
|
||||||
// buttonRight
|
// buttonRight
|
||||||
//
|
//
|
||||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonRight.BackgroundImage = global::Ship.Properties.Resources.arrowRight;
|
this.buttonRight.BackgroundImage = global::Ship.Properties.Resources.arrowRight;
|
||||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonRight.Location = new System.Drawing.Point(124, 408);
|
this.buttonRight.Location = new System.Drawing.Point(124, 577);
|
||||||
this.buttonRight.Name = "buttonRight";
|
this.buttonRight.Name = "buttonRight";
|
||||||
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
||||||
this.buttonRight.TabIndex = 10;
|
this.buttonRight.TabIndex = 10;
|
||||||
@ -81,7 +150,7 @@
|
|||||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonDown.BackgroundImage = global::Ship.Properties.Resources.arrowDown;
|
this.buttonDown.BackgroundImage = global::Ship.Properties.Resources.arrowDown;
|
||||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonDown.Location = new System.Drawing.Point(88, 408);
|
this.buttonDown.Location = new System.Drawing.Point(88, 577);
|
||||||
this.buttonDown.Name = "buttonDown";
|
this.buttonDown.Name = "buttonDown";
|
||||||
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
||||||
this.buttonDown.TabIndex = 9;
|
this.buttonDown.TabIndex = 9;
|
||||||
@ -93,7 +162,7 @@
|
|||||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonLeft.BackgroundImage = global::Ship.Properties.Resources.arrowLeft;
|
this.buttonLeft.BackgroundImage = global::Ship.Properties.Resources.arrowLeft;
|
||||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonLeft.Location = new System.Drawing.Point(52, 408);
|
this.buttonLeft.Location = new System.Drawing.Point(52, 577);
|
||||||
this.buttonLeft.Name = "buttonLeft";
|
this.buttonLeft.Name = "buttonLeft";
|
||||||
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
||||||
this.buttonLeft.TabIndex = 8;
|
this.buttonLeft.TabIndex = 8;
|
||||||
@ -105,7 +174,7 @@
|
|||||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonUp.BackgroundImage = global::Ship.Properties.Resources.arrowUp;
|
this.buttonUp.BackgroundImage = global::Ship.Properties.Resources.arrowUp;
|
||||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonUp.Location = new System.Drawing.Point(88, 372);
|
this.buttonUp.Location = new System.Drawing.Point(88, 541);
|
||||||
this.buttonUp.Name = "buttonUp";
|
this.buttonUp.Name = "buttonUp";
|
||||||
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
||||||
this.buttonUp.TabIndex = 7;
|
this.buttonUp.TabIndex = 7;
|
||||||
@ -114,7 +183,7 @@
|
|||||||
//
|
//
|
||||||
// buttonShowOnMap
|
// buttonShowOnMap
|
||||||
//
|
//
|
||||||
this.buttonShowOnMap.Location = new System.Drawing.Point(19, 315);
|
this.buttonShowOnMap.Location = new System.Drawing.Point(19, 498);
|
||||||
this.buttonShowOnMap.Name = "buttonShowOnMap";
|
this.buttonShowOnMap.Name = "buttonShowOnMap";
|
||||||
this.buttonShowOnMap.Size = new System.Drawing.Size(169, 37);
|
this.buttonShowOnMap.Size = new System.Drawing.Size(169, 37);
|
||||||
this.buttonShowOnMap.TabIndex = 5;
|
this.buttonShowOnMap.TabIndex = 5;
|
||||||
@ -124,7 +193,7 @@
|
|||||||
//
|
//
|
||||||
// buttonShowStorage
|
// buttonShowStorage
|
||||||
//
|
//
|
||||||
this.buttonShowStorage.Location = new System.Drawing.Point(19, 240);
|
this.buttonShowStorage.Location = new System.Drawing.Point(19, 455);
|
||||||
this.buttonShowStorage.Name = "buttonShowStorage";
|
this.buttonShowStorage.Name = "buttonShowStorage";
|
||||||
this.buttonShowStorage.Size = new System.Drawing.Size(169, 37);
|
this.buttonShowStorage.Size = new System.Drawing.Size(169, 37);
|
||||||
this.buttonShowStorage.TabIndex = 4;
|
this.buttonShowStorage.TabIndex = 4;
|
||||||
@ -134,7 +203,7 @@
|
|||||||
//
|
//
|
||||||
// buttonRemoveShip
|
// buttonRemoveShip
|
||||||
//
|
//
|
||||||
this.buttonRemoveShip.Location = new System.Drawing.Point(19, 166);
|
this.buttonRemoveShip.Location = new System.Drawing.Point(19, 412);
|
||||||
this.buttonRemoveShip.Name = "buttonRemoveShip";
|
this.buttonRemoveShip.Name = "buttonRemoveShip";
|
||||||
this.buttonRemoveShip.Size = new System.Drawing.Size(169, 37);
|
this.buttonRemoveShip.Size = new System.Drawing.Size(169, 37);
|
||||||
this.buttonRemoveShip.TabIndex = 3;
|
this.buttonRemoveShip.TabIndex = 3;
|
||||||
@ -144,7 +213,7 @@
|
|||||||
//
|
//
|
||||||
// maskedTextBoxPosition
|
// maskedTextBoxPosition
|
||||||
//
|
//
|
||||||
this.maskedTextBoxPosition.Location = new System.Drawing.Point(19, 137);
|
this.maskedTextBoxPosition.Location = new System.Drawing.Point(19, 383);
|
||||||
this.maskedTextBoxPosition.Mask = "00";
|
this.maskedTextBoxPosition.Mask = "00";
|
||||||
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||||
this.maskedTextBoxPosition.Size = new System.Drawing.Size(169, 23);
|
this.maskedTextBoxPosition.Size = new System.Drawing.Size(169, 23);
|
||||||
@ -152,7 +221,7 @@
|
|||||||
//
|
//
|
||||||
// buttonAddShip
|
// buttonAddShip
|
||||||
//
|
//
|
||||||
this.buttonAddShip.Location = new System.Drawing.Point(19, 94);
|
this.buttonAddShip.Location = new System.Drawing.Point(19, 340);
|
||||||
this.buttonAddShip.Name = "buttonAddShip";
|
this.buttonAddShip.Name = "buttonAddShip";
|
||||||
this.buttonAddShip.Size = new System.Drawing.Size(169, 37);
|
this.buttonAddShip.Size = new System.Drawing.Size(169, 37);
|
||||||
this.buttonAddShip.TabIndex = 1;
|
this.buttonAddShip.TabIndex = 1;
|
||||||
@ -160,25 +229,12 @@
|
|||||||
this.buttonAddShip.UseVisualStyleBackColor = true;
|
this.buttonAddShip.UseVisualStyleBackColor = true;
|
||||||
this.buttonAddShip.Click += new System.EventHandler(this.ButtonAddShip_Click);
|
this.buttonAddShip.Click += new System.EventHandler(this.ButtonAddShip_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(19, 22);
|
|
||||||
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
|
|
||||||
this.comboBoxSelectorMap.Size = new System.Drawing.Size(169, 23);
|
|
||||||
this.comboBoxSelectorMap.TabIndex = 0;
|
|
||||||
this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged);
|
|
||||||
//
|
|
||||||
// pictureBox
|
// pictureBox
|
||||||
//
|
//
|
||||||
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.pictureBox.Location = new System.Drawing.Point(0, 0);
|
this.pictureBox.Location = new System.Drawing.Point(0, 0);
|
||||||
this.pictureBox.Name = "pictureBox";
|
this.pictureBox.Name = "pictureBox";
|
||||||
this.pictureBox.Size = new System.Drawing.Size(600, 450);
|
this.pictureBox.Size = new System.Drawing.Size(767, 619);
|
||||||
this.pictureBox.TabIndex = 1;
|
this.pictureBox.TabIndex = 1;
|
||||||
this.pictureBox.TabStop = false;
|
this.pictureBox.TabStop = false;
|
||||||
//
|
//
|
||||||
@ -186,7 +242,7 @@
|
|||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
this.ClientSize = new System.Drawing.Size(967, 619);
|
||||||
this.Controls.Add(this.pictureBox);
|
this.Controls.Add(this.pictureBox);
|
||||||
this.Controls.Add(this.groupBoxTools);
|
this.Controls.Add(this.groupBoxTools);
|
||||||
this.Name = "FormMapWithSetShips";
|
this.Name = "FormMapWithSetShips";
|
||||||
@ -194,6 +250,8 @@
|
|||||||
this.Load += new System.EventHandler(this.FormMapWithSetShips_Load);
|
this.Load += new System.EventHandler(this.FormMapWithSetShips_Load);
|
||||||
this.groupBoxTools.ResumeLayout(false);
|
this.groupBoxTools.ResumeLayout(false);
|
||||||
this.groupBoxTools.PerformLayout();
|
this.groupBoxTools.PerformLayout();
|
||||||
|
this.groupBoxMaps.ResumeLayout(false);
|
||||||
|
this.groupBoxMaps.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
@ -213,5 +271,10 @@
|
|||||||
private Button buttonDown;
|
private Button buttonDown;
|
||||||
private Button buttonLeft;
|
private Button buttonLeft;
|
||||||
private Button buttonUp;
|
private Button buttonUp;
|
||||||
|
private GroupBox groupBoxMaps;
|
||||||
|
private Button buttonDeleteMap;
|
||||||
|
private ListBox listBoxMaps;
|
||||||
|
private Button buttonAddMap;
|
||||||
|
private TextBox textBoxNewMapName;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,6 +13,19 @@ namespace Ship
|
|||||||
{
|
{
|
||||||
public partial class FormMapWithSetShips : Form
|
public partial class FormMapWithSetShips : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Словарь для выпадающего списка
|
||||||
|
/// </summary>
|
||||||
|
private readonly Dictionary<string, AbstractMap> _mapsDict = new()
|
||||||
|
{
|
||||||
|
{ "Простая карта", new SimpleMap() },
|
||||||
|
{ "Водная карта", new WaterMap() }
|
||||||
|
};
|
||||||
|
/// <summary>
|
||||||
|
/// Объект от коллекции карт
|
||||||
|
/// </summary>
|
||||||
|
private readonly MapsCollection _mapsCollection;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Объект от класса карты с набором объектов
|
/// Объект от класса карты с набором объектов
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -23,6 +36,55 @@ namespace Ship
|
|||||||
public FormMapWithSetShips()
|
public FormMapWithSetShips()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_mapsCollection = new MapsCollection(pictureBox.Width, pictureBox.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>
|
||||||
/// Выбор карты
|
/// Выбор карты
|
||||||
@ -31,24 +93,28 @@ namespace Ship
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
|
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AbstractMap map = null;
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
switch (comboBoxSelectorMap.Text)
|
|
||||||
{
|
|
||||||
case "Простая карта":
|
|
||||||
map = new SimpleMap();
|
|
||||||
break;
|
|
||||||
case "Водная карта":
|
|
||||||
map = new WaterMap();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (map != null)
|
private void ListBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_mapShipsCollectionGeneric = new
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
MapWithSetShipsGeneric<DrawingObject, AbstractMap>(pictureBox.Width, pictureBox.Height, map);
|
|
||||||
}
|
}
|
||||||
else
|
/// <summary>
|
||||||
|
/// Удаление карты
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonDeleteMap_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_mapShipsCollectionGeneric = null;
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MessageBox.Show($"Удалить карту {listBoxMaps.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
_mapsCollection.DelMap(listBoxMaps.SelectedItem?.ToString() ??
|
||||||
|
string.Empty);
|
||||||
|
ReloadMaps();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -58,7 +124,7 @@ namespace Ship
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonAddShip_Click(object sender, EventArgs e)
|
private void ButtonAddShip_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_mapShipsCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -66,10 +132,10 @@ namespace Ship
|
|||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
DrawingObject car = new(form.SelectedShip);
|
DrawingObject car = new(form.SelectedShip);
|
||||||
if (_mapShipsCollectionGeneric + car != -1)
|
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + car != -1)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBox.Image = _mapShipsCollectionGeneric.ShowSet();
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -84,6 +150,10 @@ namespace Ship
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonRemoveShip_Click(object sender, EventArgs e)
|
private void ButtonRemoveShip_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))
|
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -94,10 +164,10 @@ namespace Ship
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||||
if (_mapShipsCollectionGeneric - pos != null)
|
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos != null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект удален");
|
MessageBox.Show("Объект удален");
|
||||||
pictureBox.Image = _mapShipsCollectionGeneric.ShowSet();
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -111,11 +181,11 @@ namespace Ship
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonShowStorage_Click(object sender, EventArgs e)
|
private void ButtonShowStorage_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_mapShipsCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pictureBox.Image = _mapShipsCollectionGeneric.ShowSet();
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Вывод карты
|
/// Вывод карты
|
||||||
@ -124,11 +194,11 @@ namespace Ship
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonShowOnMap_Click(object sender, EventArgs e)
|
private void ButtonShowOnMap_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_mapShipsCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pictureBox.Image = _mapShipsCollectionGeneric.ShowOnMap();
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowOnMap();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Перемещение
|
/// Перемещение
|
||||||
@ -137,7 +207,7 @@ namespace Ship
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonMove_Click(object sender, EventArgs e)
|
private void ButtonMove_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_mapShipsCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -159,7 +229,7 @@ namespace Ship
|
|||||||
dir = Direction.Right;
|
dir = Direction.Right;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pictureBox.Image = _mapShipsCollectionGeneric.MoveObject(dir);
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].MoveObject(dir);
|
||||||
}
|
}
|
||||||
private void FormMapWithSetShips_Load(object sender, EventArgs e)
|
private void FormMapWithSetShips_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user