Этап 3. Форма
This commit is contained in:
parent
60d8898b17
commit
68db88d4c4
@ -29,56 +29,136 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.groupBoxMaps = new System.Windows.Forms.GroupBox();
|
||||||
|
this.listBoxMaps = new System.Windows.Forms.ListBox();
|
||||||
|
this.buttonDeleteMap = new System.Windows.Forms.Button();
|
||||||
|
this.buttonAddMap = new System.Windows.Forms.Button();
|
||||||
|
this.textBoxNewMapName = new System.Windows.Forms.TextBox();
|
||||||
|
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
|
||||||
this.buttonDown = new System.Windows.Forms.Button();
|
this.buttonDown = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonAddShip = new System.Windows.Forms.Button();
|
||||||
this.buttonUp = new System.Windows.Forms.Button();
|
this.buttonUp = new System.Windows.Forms.Button();
|
||||||
this.buttonRight = new System.Windows.Forms.Button();
|
this.buttonRight = new System.Windows.Forms.Button();
|
||||||
this.buttonLeft = new System.Windows.Forms.Button();
|
this.buttonLeft = new System.Windows.Forms.Button();
|
||||||
this.ButtonShowStorage = new System.Windows.Forms.Button();
|
this.ButtonShowStorage = new System.Windows.Forms.Button();
|
||||||
this.ButtonShowOnMap = new System.Windows.Forms.Button();
|
this.ButtonShowOnMap = new System.Windows.Forms.Button();
|
||||||
this.maskedTextBoxPosition = new System.Windows.Forms.MaskedTextBox();
|
this.maskedTextBoxPosition = new System.Windows.Forms.MaskedTextBox();
|
||||||
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
|
|
||||||
this.ButtonRemoveShip = new System.Windows.Forms.Button();
|
this.ButtonRemoveShip = new System.Windows.Forms.Button();
|
||||||
this.ButtonAddShip = new System.Windows.Forms.Button();
|
|
||||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
|
this.groupBoxMaps.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
|
this.groupBox1.Controls.Add(this.groupBoxMaps);
|
||||||
this.groupBox1.Controls.Add(this.buttonDown);
|
this.groupBox1.Controls.Add(this.buttonDown);
|
||||||
|
this.groupBox1.Controls.Add(this.ButtonAddShip);
|
||||||
this.groupBox1.Controls.Add(this.buttonUp);
|
this.groupBox1.Controls.Add(this.buttonUp);
|
||||||
this.groupBox1.Controls.Add(this.buttonRight);
|
this.groupBox1.Controls.Add(this.buttonRight);
|
||||||
this.groupBox1.Controls.Add(this.buttonLeft);
|
this.groupBox1.Controls.Add(this.buttonLeft);
|
||||||
this.groupBox1.Controls.Add(this.ButtonShowStorage);
|
this.groupBox1.Controls.Add(this.ButtonShowStorage);
|
||||||
this.groupBox1.Controls.Add(this.ButtonShowOnMap);
|
this.groupBox1.Controls.Add(this.ButtonShowOnMap);
|
||||||
this.groupBox1.Controls.Add(this.maskedTextBoxPosition);
|
this.groupBox1.Controls.Add(this.maskedTextBoxPosition);
|
||||||
this.groupBox1.Controls.Add(this.comboBoxSelectorMap);
|
|
||||||
this.groupBox1.Controls.Add(this.ButtonRemoveShip);
|
this.groupBox1.Controls.Add(this.ButtonRemoveShip);
|
||||||
this.groupBox1.Controls.Add(this.ButtonAddShip);
|
|
||||||
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Right;
|
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||||
this.groupBox1.Location = new System.Drawing.Point(600, 0);
|
this.groupBox1.Location = new System.Drawing.Point(593, 0);
|
||||||
this.groupBox1.Name = "groupBox1";
|
this.groupBox1.Name = "groupBox1";
|
||||||
this.groupBox1.Size = new System.Drawing.Size(200, 450);
|
this.groupBox1.Size = new System.Drawing.Size(200, 582);
|
||||||
this.groupBox1.TabIndex = 1;
|
this.groupBox1.TabIndex = 1;
|
||||||
this.groupBox1.TabStop = false;
|
this.groupBox1.TabStop = false;
|
||||||
|
this.groupBox1.Text = "Инструменты";
|
||||||
|
//
|
||||||
|
// groupBoxMaps
|
||||||
|
//
|
||||||
|
this.groupBoxMaps.Controls.Add(this.listBoxMaps);
|
||||||
|
this.groupBoxMaps.Controls.Add(this.buttonDeleteMap);
|
||||||
|
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(188, 209);
|
||||||
|
this.groupBoxMaps.TabIndex = 12;
|
||||||
|
this.groupBoxMaps.TabStop = false;
|
||||||
|
this.groupBoxMaps.Text = "Карты";
|
||||||
|
//
|
||||||
|
// listBoxMaps
|
||||||
|
//
|
||||||
|
this.listBoxMaps.FormattingEnabled = true;
|
||||||
|
this.listBoxMaps.ItemHeight = 15;
|
||||||
|
this.listBoxMaps.Location = new System.Drawing.Point(6, 109);
|
||||||
|
this.listBoxMaps.Name = "listBoxMaps";
|
||||||
|
this.listBoxMaps.Size = new System.Drawing.Size(176, 64);
|
||||||
|
this.listBoxMaps.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// buttonDeleteMap
|
||||||
|
//
|
||||||
|
this.buttonDeleteMap.Location = new System.Drawing.Point(6, 180);
|
||||||
|
this.buttonDeleteMap.Name = "buttonDeleteMap";
|
||||||
|
this.buttonDeleteMap.Size = new System.Drawing.Size(176, 23);
|
||||||
|
this.buttonDeleteMap.TabIndex = 6;
|
||||||
|
this.buttonDeleteMap.Text = "Удалить карту";
|
||||||
|
this.buttonDeleteMap.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonDeleteMap.Click += new System.EventHandler(this.ButtonDeleteMap_Click);
|
||||||
|
//
|
||||||
|
// buttonAddMap
|
||||||
|
//
|
||||||
|
this.buttonAddMap.Location = new System.Drawing.Point(6, 80);
|
||||||
|
this.buttonAddMap.Name = "buttonAddMap";
|
||||||
|
this.buttonAddMap.Size = new System.Drawing.Size(176, 23);
|
||||||
|
this.buttonAddMap.TabIndex = 5;
|
||||||
|
this.buttonAddMap.Text = "Добавить карту";
|
||||||
|
this.buttonAddMap.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAddMap.Click += new System.EventHandler(this.ButtonAddMap_Click);
|
||||||
|
//
|
||||||
|
// textBoxNewMapName
|
||||||
|
//
|
||||||
|
this.textBoxNewMapName.Location = new System.Drawing.Point(6, 22);
|
||||||
|
this.textBoxNewMapName.Name = "textBoxNewMapName";
|
||||||
|
this.textBoxNewMapName.Size = new System.Drawing.Size(176, 23);
|
||||||
|
this.textBoxNewMapName.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// comboBoxSelectorMap
|
||||||
|
//
|
||||||
|
this.comboBoxSelectorMap.FormattingEnabled = true;
|
||||||
|
this.comboBoxSelectorMap.Items.AddRange(new object[] {
|
||||||
|
"Простая карта",
|
||||||
|
"Море"});
|
||||||
|
this.comboBoxSelectorMap.Location = new System.Drawing.Point(6, 51);
|
||||||
|
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
|
||||||
|
this.comboBoxSelectorMap.Size = new System.Drawing.Size(176, 23);
|
||||||
|
this.comboBoxSelectorMap.TabIndex = 4;
|
||||||
//
|
//
|
||||||
// buttonDown
|
// buttonDown
|
||||||
//
|
//
|
||||||
|
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonDown.BackgroundImage = global::WarmlyShip.Properties.Resources.Down;
|
this.buttonDown.BackgroundImage = global::WarmlyShip.Properties.Resources.Down;
|
||||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonDown.Location = new System.Drawing.Point(96, 388);
|
this.buttonDown.Location = new System.Drawing.Point(96, 536);
|
||||||
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 = 11;
|
this.buttonDown.TabIndex = 11;
|
||||||
this.buttonDown.UseVisualStyleBackColor = true;
|
this.buttonDown.UseVisualStyleBackColor = true;
|
||||||
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
|
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||||
//
|
//
|
||||||
|
// ButtonAddShip
|
||||||
|
//
|
||||||
|
this.ButtonAddShip.Location = new System.Drawing.Point(12, 298);
|
||||||
|
this.ButtonAddShip.Name = "ButtonAddShip";
|
||||||
|
this.ButtonAddShip.Size = new System.Drawing.Size(176, 25);
|
||||||
|
this.ButtonAddShip.TabIndex = 2;
|
||||||
|
this.ButtonAddShip.Text = "Добавить корабль";
|
||||||
|
this.ButtonAddShip.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonAddShip.Click += new System.EventHandler(this.ButtonAddShip_Click);
|
||||||
|
//
|
||||||
// buttonUp
|
// buttonUp
|
||||||
//
|
//
|
||||||
|
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonUp.BackgroundImage = global::WarmlyShip.Properties.Resources.Up;
|
this.buttonUp.BackgroundImage = global::WarmlyShip.Properties.Resources.Up;
|
||||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonUp.Location = new System.Drawing.Point(96, 352);
|
this.buttonUp.Location = new System.Drawing.Point(96, 500);
|
||||||
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 = 10;
|
this.buttonUp.TabIndex = 10;
|
||||||
@ -87,9 +167,10 @@
|
|||||||
//
|
//
|
||||||
// buttonRight
|
// buttonRight
|
||||||
//
|
//
|
||||||
|
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonRight.BackgroundImage = global::WarmlyShip.Properties.Resources.Right;
|
this.buttonRight.BackgroundImage = global::WarmlyShip.Properties.Resources.Right;
|
||||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonRight.Location = new System.Drawing.Point(132, 388);
|
this.buttonRight.Location = new System.Drawing.Point(132, 536);
|
||||||
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 = 9;
|
this.buttonRight.TabIndex = 9;
|
||||||
@ -98,9 +179,10 @@
|
|||||||
//
|
//
|
||||||
// buttonLeft
|
// buttonLeft
|
||||||
//
|
//
|
||||||
|
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonLeft.BackgroundImage = global::WarmlyShip.Properties.Resources.Left;
|
this.buttonLeft.BackgroundImage = global::WarmlyShip.Properties.Resources.Left;
|
||||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonLeft.Location = new System.Drawing.Point(60, 388);
|
this.buttonLeft.Location = new System.Drawing.Point(60, 536);
|
||||||
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;
|
||||||
@ -109,9 +191,9 @@
|
|||||||
//
|
//
|
||||||
// ButtonShowStorage
|
// ButtonShowStorage
|
||||||
//
|
//
|
||||||
this.ButtonShowStorage.Location = new System.Drawing.Point(6, 193);
|
this.ButtonShowStorage.Location = new System.Drawing.Point(12, 402);
|
||||||
this.ButtonShowStorage.Name = "ButtonShowStorage";
|
this.ButtonShowStorage.Name = "ButtonShowStorage";
|
||||||
this.ButtonShowStorage.Size = new System.Drawing.Size(182, 23);
|
this.ButtonShowStorage.Size = new System.Drawing.Size(176, 23);
|
||||||
this.ButtonShowStorage.TabIndex = 7;
|
this.ButtonShowStorage.TabIndex = 7;
|
||||||
this.ButtonShowStorage.Text = "Посмотреть хранилище";
|
this.ButtonShowStorage.Text = "Посмотреть хранилище";
|
||||||
this.ButtonShowStorage.UseVisualStyleBackColor = true;
|
this.ButtonShowStorage.UseVisualStyleBackColor = true;
|
||||||
@ -119,9 +201,9 @@
|
|||||||
//
|
//
|
||||||
// ButtonShowOnMap
|
// ButtonShowOnMap
|
||||||
//
|
//
|
||||||
this.ButtonShowOnMap.Location = new System.Drawing.Point(6, 243);
|
this.ButtonShowOnMap.Location = new System.Drawing.Point(12, 431);
|
||||||
this.ButtonShowOnMap.Name = "ButtonShowOnMap";
|
this.ButtonShowOnMap.Name = "ButtonShowOnMap";
|
||||||
this.ButtonShowOnMap.Size = new System.Drawing.Size(188, 23);
|
this.ButtonShowOnMap.Size = new System.Drawing.Size(176, 23);
|
||||||
this.ButtonShowOnMap.TabIndex = 6;
|
this.ButtonShowOnMap.TabIndex = 6;
|
||||||
this.ButtonShowOnMap.Text = "Посмотреть карту";
|
this.ButtonShowOnMap.Text = "Посмотреть карту";
|
||||||
this.ButtonShowOnMap.UseVisualStyleBackColor = true;
|
this.ButtonShowOnMap.UseVisualStyleBackColor = true;
|
||||||
@ -129,50 +211,28 @@
|
|||||||
//
|
//
|
||||||
// maskedTextBoxPosition
|
// maskedTextBoxPosition
|
||||||
//
|
//
|
||||||
this.maskedTextBoxPosition.Location = new System.Drawing.Point(6, 108);
|
this.maskedTextBoxPosition.Location = new System.Drawing.Point(12, 329);
|
||||||
this.maskedTextBoxPosition.Mask = "00";
|
this.maskedTextBoxPosition.Mask = "00";
|
||||||
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||||
this.maskedTextBoxPosition.Size = new System.Drawing.Size(188, 23);
|
this.maskedTextBoxPosition.Size = new System.Drawing.Size(176, 23);
|
||||||
this.maskedTextBoxPosition.TabIndex = 5;
|
this.maskedTextBoxPosition.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// comboBoxSelectorMap
|
|
||||||
//
|
|
||||||
this.comboBoxSelectorMap.FormattingEnabled = true;
|
|
||||||
this.comboBoxSelectorMap.Items.AddRange(new object[] {
|
|
||||||
"Простая карта",
|
|
||||||
"Море"});
|
|
||||||
this.comboBoxSelectorMap.Location = new System.Drawing.Point(6, 32);
|
|
||||||
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
|
|
||||||
this.comboBoxSelectorMap.Size = new System.Drawing.Size(188, 23);
|
|
||||||
this.comboBoxSelectorMap.TabIndex = 4;
|
|
||||||
this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorShip_SelectedIndexChanged);
|
|
||||||
//
|
|
||||||
// ButtonRemoveShip
|
// ButtonRemoveShip
|
||||||
//
|
//
|
||||||
this.ButtonRemoveShip.Location = new System.Drawing.Point(6, 137);
|
this.ButtonRemoveShip.Location = new System.Drawing.Point(12, 358);
|
||||||
this.ButtonRemoveShip.Name = "ButtonRemoveShip";
|
this.ButtonRemoveShip.Name = "ButtonRemoveShip";
|
||||||
this.ButtonRemoveShip.Size = new System.Drawing.Size(188, 25);
|
this.ButtonRemoveShip.Size = new System.Drawing.Size(176, 25);
|
||||||
this.ButtonRemoveShip.TabIndex = 3;
|
this.ButtonRemoveShip.TabIndex = 3;
|
||||||
this.ButtonRemoveShip.Text = "Удалить корабль";
|
this.ButtonRemoveShip.Text = "Удалить корабль";
|
||||||
this.ButtonRemoveShip.UseVisualStyleBackColor = true;
|
this.ButtonRemoveShip.UseVisualStyleBackColor = true;
|
||||||
this.ButtonRemoveShip.Click += new System.EventHandler(this.ButtonRemoveShip_Click);
|
this.ButtonRemoveShip.Click += new System.EventHandler(this.ButtonRemoveShip_Click);
|
||||||
//
|
//
|
||||||
// ButtonAddShip
|
|
||||||
//
|
|
||||||
this.ButtonAddShip.Location = new System.Drawing.Point(6, 61);
|
|
||||||
this.ButtonAddShip.Name = "ButtonAddShip";
|
|
||||||
this.ButtonAddShip.Size = new System.Drawing.Size(188, 25);
|
|
||||||
this.ButtonAddShip.TabIndex = 2;
|
|
||||||
this.ButtonAddShip.Text = "Добавить корабль";
|
|
||||||
this.ButtonAddShip.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonAddShip.Click += new System.EventHandler(this.ButtonAddShip_Click);
|
|
||||||
//
|
|
||||||
// pictureBox1
|
// pictureBox1
|
||||||
//
|
//
|
||||||
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
|
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.pictureBox1.Name = "pictureBox1";
|
this.pictureBox1.Name = "pictureBox1";
|
||||||
this.pictureBox1.Size = new System.Drawing.Size(600, 450);
|
this.pictureBox1.Size = new System.Drawing.Size(593, 582);
|
||||||
this.pictureBox1.TabIndex = 0;
|
this.pictureBox1.TabIndex = 0;
|
||||||
this.pictureBox1.TabStop = false;
|
this.pictureBox1.TabStop = false;
|
||||||
//
|
//
|
||||||
@ -180,13 +240,15 @@
|
|||||||
//
|
//
|
||||||
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(793, 582);
|
||||||
this.Controls.Add(this.pictureBox1);
|
this.Controls.Add(this.pictureBox1);
|
||||||
this.Controls.Add(this.groupBox1);
|
this.Controls.Add(this.groupBox1);
|
||||||
this.Name = "FormMapWithSetWarmlyShip";
|
this.Name = "FormMapWithSetWarmlyShip";
|
||||||
this.Text = "FormMapWithSetWarmlyShip";
|
this.Text = "FormMapWithSetWarmlyShip";
|
||||||
this.groupBox1.ResumeLayout(false);
|
this.groupBox1.ResumeLayout(false);
|
||||||
this.groupBox1.PerformLayout();
|
this.groupBox1.PerformLayout();
|
||||||
|
this.groupBoxMaps.ResumeLayout(false);
|
||||||
|
this.groupBoxMaps.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
@ -206,5 +268,10 @@
|
|||||||
private Button buttonUp;
|
private Button buttonUp;
|
||||||
private Button buttonRight;
|
private Button buttonRight;
|
||||||
private Button buttonLeft;
|
private Button buttonLeft;
|
||||||
|
private GroupBox groupBoxMaps;
|
||||||
|
private ListBox listBoxMaps;
|
||||||
|
private Button buttonDeleteMap;
|
||||||
|
private Button buttonAddMap;
|
||||||
|
private TextBox textBoxNewMapName;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,45 +14,134 @@ namespace WarmlyShip
|
|||||||
public partial class FormMapWithSetWarmlyShip : Form
|
public partial class FormMapWithSetWarmlyShip : Form
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Объект от класса карты с набором объектов
|
/// Словарь для выпадающего списка
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private MapWithSetWarmlyShipGeneric<DrawningObjectShip, AbstractMap> _mapWarmlyShipCollectionGeneric;
|
private readonly Dictionary<string, AbstractMap> _mapsDict = new()
|
||||||
|
{
|
||||||
|
{ "Простая карта", new SimpleMap() },
|
||||||
|
{ "Море", new MyMap() }
|
||||||
|
};
|
||||||
|
/// <summary>
|
||||||
|
/// Объект от коллекции карт
|
||||||
|
/// </summary>
|
||||||
|
private readonly MapsCollection _mapsCollection;
|
||||||
|
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Объект от класса карты с набором объектов
|
||||||
|
///// </summary>
|
||||||
|
//private MapWithSetWarmlyShipGeneric<DrawningObjectShip, AbstractMap> _mapWarmlyShipCollectionGeneric;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public FormMapWithSetWarmlyShip()
|
public FormMapWithSetWarmlyShip()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_mapsCollection = new MapsCollection(pictureBox1.Width, pictureBox1.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>
|
||||||
/// Выбор карты
|
/// Выбор карты
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ComboBoxSelectorShip_SelectedIndexChanged(object sender, EventArgs e)
|
private void ListBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AbstractMap map = null;
|
pictureBox1.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
switch (comboBoxSelectorMap.Text)
|
|
||||||
{
|
|
||||||
case "Простая карта":
|
|
||||||
map = new SimpleMap();
|
|
||||||
break;
|
|
||||||
case "Море":
|
|
||||||
map = new MyMap();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (map != null)
|
|
||||||
{
|
|
||||||
_mapWarmlyShipCollectionGeneric = new MapWithSetWarmlyShipGeneric<DrawningObjectShip, AbstractMap>(
|
|
||||||
pictureBox1.Width, pictureBox1.Height, map);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_mapWarmlyShipCollectionGeneric = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Выбор карты
|
||||||
|
///// </summary>
|
||||||
|
///// <param name="sender"></param>
|
||||||
|
///// <param name="e"></param>
|
||||||
|
//private void ComboBoxSelectorShip_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
//{
|
||||||
|
// AbstractMap map = null;
|
||||||
|
// switch (comboBoxSelectorMap.Text)
|
||||||
|
// {
|
||||||
|
// case "Простая карта":
|
||||||
|
// map = new SimpleMap();
|
||||||
|
// break;
|
||||||
|
// case "Море":
|
||||||
|
// map = new MyMap();
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// if (map != null)
|
||||||
|
// {
|
||||||
|
// _mapWarmlyShipCollectionGeneric = new MapWithSetWarmlyShipGeneric<DrawningObjectShip, AbstractMap>(
|
||||||
|
// pictureBox1.Width, pictureBox1.Height, map);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// _mapWarmlyShipCollectionGeneric = null;
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление карты
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonDeleteMap_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
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>
|
||||||
/// Добавление объекта
|
/// Добавление объекта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -60,18 +149,18 @@ namespace WarmlyShip
|
|||||||
/// <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 (_mapWarmlyShipCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FormShip form = new();
|
FormShip form = new();
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
DrawningObjectShip car = new(form.SelectedShip);
|
DrawningObjectShip ship = new(form.SelectedShip);
|
||||||
if ((_mapWarmlyShipCollectionGeneric + car) > -1)
|
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + ship!=null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBox1.Image = _mapWarmlyShipCollectionGeneric.ShowSet();
|
pictureBox1.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -88,6 +177,10 @@ namespace WarmlyShip
|
|||||||
/// <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;
|
||||||
@ -98,10 +191,10 @@ namespace WarmlyShip
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||||
if ((_mapWarmlyShipCollectionGeneric - pos) != null)
|
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos != null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект удален");
|
MessageBox.Show("Объект удален");
|
||||||
pictureBox1.Image = _mapWarmlyShipCollectionGeneric.ShowSet();
|
pictureBox1.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -116,11 +209,11 @@ namespace WarmlyShip
|
|||||||
/// <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 (_mapWarmlyShipCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pictureBox1.Image = _mapWarmlyShipCollectionGeneric.ShowSet();
|
pictureBox1.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -130,11 +223,11 @@ namespace WarmlyShip
|
|||||||
/// <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 (_mapWarmlyShipCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pictureBox1.Image = _mapWarmlyShipCollectionGeneric.ShowOnMap();
|
pictureBox1.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowOnMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -144,7 +237,7 @@ namespace WarmlyShip
|
|||||||
/// <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 (_mapWarmlyShipCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -167,9 +260,7 @@ namespace WarmlyShip
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pictureBox1.Image = _mapWarmlyShipCollectionGeneric.MoveObject(dir);
|
pictureBox1.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].MoveObject(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ namespace WarmlyShip
|
|||||||
/// <param name="map">Карта</param>
|
/// <param name="map">Карта</param>
|
||||||
public void AddMap(string name, AbstractMap map)
|
public void AddMap(string name, AbstractMap map)
|
||||||
{
|
{
|
||||||
// TODO Прописать логику для добавления
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Удаление карты
|
/// Удаление карты
|
||||||
|
Loading…
Reference in New Issue
Block a user