Добавлена возможность перемещать самолет по карте, и не перемещать в хранилище
This commit is contained in:
parent
d58705a5b2
commit
19eeb2b950
@ -34,6 +34,8 @@ namespace AirBomber
|
||||
return DrawMapWithObject();
|
||||
}
|
||||
|
||||
public bool HasMap => _map != null;
|
||||
|
||||
/// <summary>Проверяет наличие непроходимых участков в заданной области</summary>
|
||||
/// <param name="area">Заданная область</param>
|
||||
/// <param name="iBarrier">i-ый индекс первого барьера, который был найден в области</param>
|
||||
|
@ -103,6 +103,7 @@
|
||||
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonDown.TabIndex = 10;
|
||||
this.buttonDown.UseVisualStyleBackColor = true;
|
||||
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
@ -114,6 +115,7 @@
|
||||
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonRight.TabIndex = 9;
|
||||
this.buttonRight.UseVisualStyleBackColor = true;
|
||||
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
@ -125,6 +127,7 @@
|
||||
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonLeft.TabIndex = 8;
|
||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
||||
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
@ -136,6 +139,7 @@
|
||||
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonUp.TabIndex = 7;
|
||||
this.buttonUp.UseVisualStyleBackColor = true;
|
||||
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonShowOnMap
|
||||
//
|
||||
@ -162,7 +166,8 @@
|
||||
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(17, 32);
|
||||
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
|
||||
this.comboBoxSelectorMap.Size = new System.Drawing.Size(175, 23);
|
||||
|
@ -125,7 +125,7 @@
|
||||
/// <param name="e"></param>
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_mapAirplanesCollectionGeneric == null)
|
||||
if (_mapAirplanesCollectionGeneric == null || !_mapAirplanesCollectionGeneric.Map.HasMap)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ namespace AirBomber
|
||||
/// Карта
|
||||
/// </summary>
|
||||
private readonly U _map;
|
||||
|
||||
public U Map => _map;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
@ -93,7 +96,7 @@ namespace AirBomber
|
||||
var airplane = _setAirplanes.Get(i);
|
||||
if (airplane != null)
|
||||
{
|
||||
return _map.CreateMap(_pictureWidth, _pictureHeight, airplane);
|
||||
return Map.CreateMap(_pictureWidth, _pictureHeight, airplane);
|
||||
}
|
||||
}
|
||||
return new(_pictureWidth, _pictureHeight);
|
||||
@ -105,9 +108,9 @@ namespace AirBomber
|
||||
/// <returns></returns>
|
||||
public Bitmap MoveObject(Direction direction)
|
||||
{
|
||||
if (_map != null)
|
||||
if (Map != null)
|
||||
{
|
||||
return _map.MoveObject(direction);
|
||||
return Map.MoveObject(direction);
|
||||
}
|
||||
return new(_pictureWidth, _pictureHeight);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user