Commit
This commit is contained in:
parent
99b22b3d7c
commit
8dc12df36b
78
gidro/FormPlaneCollection.Designer.cs
generated
78
gidro/FormPlaneCollection.Designer.cs
generated
@ -30,12 +30,18 @@
|
||||
{
|
||||
pictureBoxCollection = new PictureBox();
|
||||
groupBox1 = new GroupBox();
|
||||
groupBox2 = new GroupBox();
|
||||
buttonDeleteObject = new Button();
|
||||
listBoxStorages = new ListBox();
|
||||
buttonAddObject = new Button();
|
||||
textBoxStorageName = new TextBox();
|
||||
buttonRefreshCollection = new Button();
|
||||
buttonRemovePlane = new Button();
|
||||
maskedTextBoxNumber = new MaskedTextBox();
|
||||
buttonAddPlane = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit();
|
||||
groupBox1.SuspendLayout();
|
||||
groupBox2.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxCollection
|
||||
@ -43,26 +49,77 @@
|
||||
pictureBoxCollection.Dock = DockStyle.Fill;
|
||||
pictureBoxCollection.Location = new Point(0, 0);
|
||||
pictureBoxCollection.Name = "pictureBoxCollection";
|
||||
pictureBoxCollection.Size = new Size(1026, 443);
|
||||
pictureBoxCollection.Size = new Size(1026, 446);
|
||||
pictureBoxCollection.TabIndex = 1;
|
||||
pictureBoxCollection.TabStop = false;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.Controls.Add(groupBox2);
|
||||
groupBox1.Controls.Add(buttonRefreshCollection);
|
||||
groupBox1.Controls.Add(buttonRemovePlane);
|
||||
groupBox1.Controls.Add(maskedTextBoxNumber);
|
||||
groupBox1.Controls.Add(buttonAddPlane);
|
||||
groupBox1.Location = new Point(852, 0);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new Size(174, 421);
|
||||
groupBox1.Size = new Size(174, 439);
|
||||
groupBox1.TabIndex = 2;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "Инструменты";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
groupBox2.Controls.Add(buttonDeleteObject);
|
||||
groupBox2.Controls.Add(listBoxStorages);
|
||||
groupBox2.Controls.Add(buttonAddObject);
|
||||
groupBox2.Controls.Add(textBoxStorageName);
|
||||
groupBox2.Location = new Point(12, 39);
|
||||
groupBox2.Name = "groupBox2";
|
||||
groupBox2.Size = new Size(150, 219);
|
||||
groupBox2.TabIndex = 4;
|
||||
groupBox2.TabStop = false;
|
||||
groupBox2.Text = "Наборы";
|
||||
//
|
||||
// buttonDeleteObject
|
||||
//
|
||||
buttonDeleteObject.Location = new Point(6, 190);
|
||||
buttonDeleteObject.Name = "buttonDeleteObject";
|
||||
buttonDeleteObject.Size = new Size(138, 23);
|
||||
buttonDeleteObject.TabIndex = 3;
|
||||
buttonDeleteObject.Text = "Удалить набор";
|
||||
buttonDeleteObject.UseVisualStyleBackColor = true;
|
||||
buttonDeleteObject.Click += ButtonDelObject_Click;
|
||||
//
|
||||
// listBoxStorages
|
||||
//
|
||||
listBoxStorages.FormattingEnabled = true;
|
||||
listBoxStorages.ItemHeight = 15;
|
||||
listBoxStorages.Location = new Point(6, 85);
|
||||
listBoxStorages.Name = "listBoxStorages";
|
||||
listBoxStorages.Size = new Size(138, 94);
|
||||
listBoxStorages.TabIndex = 2;
|
||||
listBoxStorages.SelectedIndexChanged += ListBoxObjects_SelectedIndexChanged;
|
||||
//
|
||||
// buttonAddObject
|
||||
//
|
||||
buttonAddObject.Location = new Point(6, 56);
|
||||
buttonAddObject.Name = "buttonAddObject";
|
||||
buttonAddObject.Size = new Size(138, 23);
|
||||
buttonAddObject.TabIndex = 1;
|
||||
buttonAddObject.Text = "Добавить набор";
|
||||
buttonAddObject.UseVisualStyleBackColor = true;
|
||||
buttonAddObject.Click += ButtonAddObject_Click;
|
||||
//
|
||||
// textBoxStorageName
|
||||
//
|
||||
textBoxStorageName.Location = new Point(6, 22);
|
||||
textBoxStorageName.Name = "textBoxStorageName";
|
||||
textBoxStorageName.Size = new Size(138, 23);
|
||||
textBoxStorageName.TabIndex = 0;
|
||||
//
|
||||
// buttonRefreshCollection
|
||||
//
|
||||
buttonRefreshCollection.Location = new Point(14, 206);
|
||||
buttonRefreshCollection.Location = new Point(14, 407);
|
||||
buttonRefreshCollection.Name = "buttonRefreshCollection";
|
||||
buttonRefreshCollection.Size = new Size(149, 23);
|
||||
buttonRefreshCollection.TabIndex = 3;
|
||||
@ -72,7 +129,7 @@
|
||||
//
|
||||
// buttonRemovePlane
|
||||
//
|
||||
buttonRemovePlane.Location = new Point(14, 155);
|
||||
buttonRemovePlane.Location = new Point(14, 377);
|
||||
buttonRemovePlane.Name = "buttonRemovePlane";
|
||||
buttonRemovePlane.Size = new Size(149, 24);
|
||||
buttonRemovePlane.TabIndex = 2;
|
||||
@ -82,14 +139,14 @@
|
||||
//
|
||||
// maskedTextBoxNumber
|
||||
//
|
||||
maskedTextBoxNumber.Location = new Point(14, 101);
|
||||
maskedTextBoxNumber.Location = new Point(14, 348);
|
||||
maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||
maskedTextBoxNumber.Size = new Size(149, 23);
|
||||
maskedTextBoxNumber.TabIndex = 1;
|
||||
//
|
||||
// buttonAddPlane
|
||||
//
|
||||
buttonAddPlane.Location = new Point(14, 45);
|
||||
buttonAddPlane.Location = new Point(14, 317);
|
||||
buttonAddPlane.Name = "buttonAddPlane";
|
||||
buttonAddPlane.Size = new Size(149, 25);
|
||||
buttonAddPlane.TabIndex = 0;
|
||||
@ -101,7 +158,7 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1026, 443);
|
||||
ClientSize = new Size(1026, 446);
|
||||
Controls.Add(groupBox1);
|
||||
Controls.Add(pictureBoxCollection);
|
||||
Name = "FormPlaneCollection";
|
||||
@ -109,6 +166,8 @@
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).EndInit();
|
||||
groupBox1.ResumeLayout(false);
|
||||
groupBox1.PerformLayout();
|
||||
groupBox2.ResumeLayout(false);
|
||||
groupBox2.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@ -120,5 +179,10 @@
|
||||
private Button buttonRemovePlane;
|
||||
private MaskedTextBox maskedTextBoxNumber;
|
||||
private Button buttonAddPlane;
|
||||
private GroupBox groupBox2;
|
||||
private Button buttonDeleteObject;
|
||||
private ListBox listBoxStorages;
|
||||
private Button buttonAddObject;
|
||||
private TextBox textBoxStorageName;
|
||||
}
|
||||
}
|
@ -18,17 +18,85 @@ namespace ProjectSeaplane
|
||||
/// <summary>
|
||||
/// Набор объектов
|
||||
/// </summary>
|
||||
private readonly PlanesGenericCollection<DrawningPlane,
|
||||
DrawningObjectPlane> _planes;
|
||||
private readonly PlanesGenericStorage _storage;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public FormPlaneCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
_planes = new PlanesGenericCollection<DrawningPlane,
|
||||
DrawningObjectPlane>(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
||||
_storage = new PlanesGenericStorage(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
||||
}
|
||||
/// <summary>
|
||||
/// Заполнение listBoxObjects
|
||||
/// </summary>
|
||||
private void ReloadObjects()
|
||||
{
|
||||
int index = listBoxStorages.SelectedIndex;
|
||||
listBoxStorages.Items.Clear();
|
||||
foreach (var key in _storage.Keys)
|
||||
{
|
||||
listBoxStorages.Items.Add(key);
|
||||
}
|
||||
if (listBoxStorages.Items.Count > 0 && (index == -1 || index
|
||||
>= listBoxStorages.Items.Count))
|
||||
{
|
||||
listBoxStorages.SelectedIndex = 0;
|
||||
}
|
||||
else if (listBoxStorages.Items.Count > 0 && index > -1 &&
|
||||
index < listBoxStorages.Items.Count)
|
||||
{
|
||||
listBoxStorages.SelectedIndex = index;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление набора в коллекцию
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonAddObject_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
||||
{
|
||||
MessageBox.Show("Не все данные заполнены", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_storage.AddSet(textBoxStorageName.Text);
|
||||
ReloadObjects();
|
||||
}
|
||||
/// <summary>
|
||||
/// Выбор набора
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ListBoxObjects_SelectedIndexChanged(object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
pictureBoxCollection.Image =
|
||||
_storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowPlanes();
|
||||
}
|
||||
/// <summary>
|
||||
/// Удаление набора
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonDelObject_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show($"Удалить объект {listBoxStorages.SelectedItem}?",
|
||||
"Удаление", MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
_storage.DelSet(listBoxStorages.SelectedItem.ToString()
|
||||
?? string.Empty);
|
||||
ReloadObjects();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавление объекта в набор
|
||||
/// </summary>
|
||||
@ -36,13 +104,22 @@ namespace ProjectSeaplane
|
||||
/// <param name="e"></param>
|
||||
private void buttonAddPlane_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
FormSeaplane form = new FormSeaplane();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_planes + form.SelectedPlane != -1)
|
||||
if (obj + form.SelectedPlane)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = _planes.ShowPlanes();
|
||||
pictureBoxCollection.Image = obj.ShowPlanes();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -57,21 +134,26 @@ namespace ProjectSeaplane
|
||||
/// <param name="e"></param>
|
||||
private void buttonRemovePlane_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int pos = -1;
|
||||
try
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
||||
return;
|
||||
}
|
||||
catch (Exception ex) { }
|
||||
if (_planes - pos)
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление",
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
||||
if (obj - pos != null)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
pictureBoxCollection.Image = _planes.ShowPlanes();
|
||||
pictureBoxCollection.Image = obj.ShowPlanes();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -85,7 +167,18 @@ namespace ProjectSeaplane
|
||||
/// <param name="e"></param>
|
||||
private void buttonRefreshCollection_Click(object sender, EventArgs e)
|
||||
{
|
||||
pictureBoxCollection.Image = _planes.ShowPlanes();
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pictureBoxCollection.Image = obj.ShowPlanes();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,13 +52,13 @@ namespace ProjectSeaplane.Generics
|
||||
/// <param name="collect"></param>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
public static int? operator +(PlanesGenericCollection<T, U> collect, T? obj)
|
||||
public static bool operator +(PlanesGenericCollection<T, U> collect, T? obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
return collect?._collection.Insert(obj);
|
||||
return (bool)collect?._collection.Insert(obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -67,14 +67,14 @@ namespace ProjectSeaplane.Generics
|
||||
/// <param name="collect"></param>
|
||||
/// <param name="pos"></param>
|
||||
/// <returns></returns>
|
||||
public static bool operator -(PlanesGenericCollection<T, U> collect, int pos)
|
||||
public static T? operator -(PlanesGenericCollection<T, U> collect, int pos)
|
||||
{
|
||||
T? obj = collect._collection.Get(pos);
|
||||
if (obj == null)
|
||||
T? obj = collect._collection[pos];
|
||||
if (obj != null)
|
||||
{
|
||||
return false;
|
||||
collect._collection.Remove(pos);
|
||||
}
|
||||
return collect._collection.Remove(pos);
|
||||
return obj;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -84,7 +84,7 @@ namespace ProjectSeaplane.Generics
|
||||
/// <returns></returns>
|
||||
public U? GetU(int pos)
|
||||
{
|
||||
return (U?)_collection.Get(pos)?.GetMoveableObject;
|
||||
return (U?)_collection[pos]?.GetMoveableObject;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -125,21 +125,17 @@ namespace ProjectSeaplane.Generics
|
||||
{
|
||||
int width = _pictureWidth / _placeSizeWidth;
|
||||
int height = _pictureHeight / _placeSizeHeight;
|
||||
for (int i = 0; i < _collection.Count; i++)
|
||||
int i = 0;
|
||||
foreach (var plane in _collection.GetPlanes())
|
||||
{
|
||||
// TODO получение объекта
|
||||
DrawningPlane? plane = _collection.Get(i);
|
||||
if (plane == null)
|
||||
if (plane != null)
|
||||
{
|
||||
continue;
|
||||
plane.SetPosition((width - 1 - (i % width)) * _placeSizeWidth, (width - (i / width) - 1) * _placeSizeHeight);
|
||||
plane.DrawTransport(g);
|
||||
}
|
||||
int r = width - (i / width) - 1;
|
||||
int s = width - 1 - (i % width);
|
||||
// TODO установка позиции
|
||||
plane.SetPosition(s * _placeSizeWidth, r * _placeSizeHeight);
|
||||
// TODO прорисовка объекта
|
||||
plane.DrawTransport(g);
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
48
gidro/PlanesGenericStorage.cs
Normal file
48
gidro/PlanesGenericStorage.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ProjectSeaplane.DrawningObjects;
|
||||
using ProjectSeaplane.MovementStrategy;
|
||||
using ProjectSeaplane.Generics;
|
||||
|
||||
namespace ProjectSeaplane.Generics
|
||||
{
|
||||
internal class PlanesGenericStorage
|
||||
{
|
||||
readonly Dictionary<string, PlanesGenericCollection<DrawningPlane, DrawningObjectPlane>> _planeStorages;
|
||||
public List<string> Keys => _planeStorages.Keys.ToList();
|
||||
private readonly int _pictureWidth;
|
||||
private readonly int _pictureHeight;
|
||||
public PlanesGenericStorage(int pictureWidth, int pictureHeight)
|
||||
{
|
||||
_planeStorages = new Dictionary<string, PlanesGenericCollection<DrawningPlane, DrawningObjectPlane>>();
|
||||
_pictureWidth = pictureWidth;
|
||||
_pictureHeight = pictureHeight;
|
||||
}
|
||||
public void AddSet(string name)
|
||||
{
|
||||
if (_planeStorages.ContainsKey(name)) return;
|
||||
_planeStorages[name] = new PlanesGenericCollection<DrawningPlane, DrawningObjectPlane>(_pictureWidth, _pictureHeight);
|
||||
}
|
||||
|
||||
public void DelSet(string name)
|
||||
{
|
||||
if (!_planeStorages.ContainsKey(name)) return;
|
||||
_planeStorages.Remove(name);
|
||||
}
|
||||
|
||||
public PlanesGenericCollection<DrawningPlane, DrawningObjectPlane>?
|
||||
this[string ind]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_planeStorages.ContainsKey(ind)) return _planeStorages[ind];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -16,44 +16,32 @@ namespace ProjectSeaplane.Generics
|
||||
/// <summary>
|
||||
/// Массив объектов, которые храним
|
||||
/// </summary>
|
||||
private readonly T?[] _places;
|
||||
private readonly List<T?> _places;
|
||||
/// <summary>
|
||||
/// Количество объектов в массиве
|
||||
/// </summary>
|
||||
public int Count => _places.Length;
|
||||
public int Count => _places.Count;
|
||||
/// <summary>
|
||||
/// Максимальное количество объектов в списке
|
||||
/// </summary>
|
||||
private readonly int _maxCount;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="count"></param>
|
||||
public SetGeneric(int count)
|
||||
{
|
||||
_places = new T?[count];
|
||||
_maxCount = count;
|
||||
_places = new List<T?>(count);
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление объекта в набор
|
||||
/// </summary>
|
||||
/// <param name="car">Добавляемый автомобиль</param>
|
||||
/// <returns></returns>
|
||||
public int Insert(T plane)
|
||||
public bool Insert(T plane)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < _places.Length; i++)
|
||||
{
|
||||
if (_places[i] == null)
|
||||
{
|
||||
index = i; break;
|
||||
}
|
||||
}
|
||||
if (index < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
for (int i = index; i > 0; i--)
|
||||
{
|
||||
_places[i] = _places[i - 1];
|
||||
}
|
||||
_places[0] = plane;
|
||||
return 0;
|
||||
return Insert(plane, 0);
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление объекта в набор на конкретную позицию
|
||||
@ -61,31 +49,16 @@ namespace ProjectSeaplane.Generics
|
||||
/// <param name="car">Добавляемый автомобиль</param>
|
||||
/// <param name="position">Позиция</param>
|
||||
/// <returns></returns>
|
||||
public int Insert(T plane, int position)
|
||||
public bool Insert(T plane, int position)
|
||||
{
|
||||
if (position < 0 || position >= Count)
|
||||
return -1;
|
||||
if (_places[position] == null)
|
||||
{
|
||||
_places[position] = plane;
|
||||
return position;
|
||||
}
|
||||
int index = -1;
|
||||
for (int i = position; i < Count; i++)
|
||||
{
|
||||
if (_places[i] == null)
|
||||
{
|
||||
index = i; break;
|
||||
}
|
||||
}
|
||||
if (index < 0)
|
||||
return -1;
|
||||
for (int i = index; index > position; i--)
|
||||
{
|
||||
_places[i] = _places[i - 1];
|
||||
}
|
||||
_places[position] = plane;
|
||||
return position;
|
||||
if (position < 0 || position >= _maxCount)
|
||||
return false;
|
||||
|
||||
if (Count >= _maxCount)
|
||||
return false;
|
||||
_places.Insert(0, plane);
|
||||
return true;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Удаление объекта из набора с конкретной позиции
|
||||
@ -94,21 +67,50 @@ namespace ProjectSeaplane.Generics
|
||||
/// <returns></returns>
|
||||
public bool Remove(int position)
|
||||
{
|
||||
if (position < 0 || position >= Count)
|
||||
if (position < 0 || position > _maxCount)
|
||||
return false;
|
||||
_places[position] = null;
|
||||
if (position >= Count)
|
||||
return false;
|
||||
_places.RemoveAt(position);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение объекта из набора по позиции
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <returns></returns>
|
||||
public T? Get(int position)
|
||||
public T? this[int position]
|
||||
{
|
||||
if (position < 0 || position >= Count)
|
||||
return null;
|
||||
return _places[position];
|
||||
get
|
||||
{
|
||||
if (position < 0 || position > _maxCount)
|
||||
return null;
|
||||
return _places[position];
|
||||
}
|
||||
set
|
||||
{
|
||||
if (position < 0 || position > _maxCount)
|
||||
return;
|
||||
_places[position] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Проход по списку
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<T?> GetPlanes(int? maxPlanes = null)
|
||||
{
|
||||
for (int i = 0; i < _places.Count; ++i)
|
||||
{
|
||||
yield return _places[i];
|
||||
if (maxPlanes.HasValue && i == maxPlanes.Value)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user