diff --git a/ProjectLocomotive/ProjectLocomotive/MapsCollection.cs b/ProjectLocomotive/ProjectLocomotive/MapsCollection.cs new file mode 100644 index 0000000..6354e7d --- /dev/null +++ b/ProjectLocomotive/ProjectLocomotive/MapsCollection.cs @@ -0,0 +1,53 @@ +using ProjectLocomotive; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Locomotive +{ + internal class MapsCollection + { + /// Словарь (хранилище) с картами + readonly Dictionary> _mapStorages; + /// Возвращение списка названий карт + public List Keys => _mapStorages.Keys.ToList(); + /// Ширина окна отрисовки + private readonly int _pictureWidth; + /// Высота окна отрисовки + private readonly int _pictureHeight; + /// Конструктор + public MapsCollection(int pictureWidth, int pictureHeight) + { + _mapStorages = new Dictionary>(); + _pictureWidth = pictureWidth; + _pictureHeight = pictureHeight; + } + /// Добавление карты + public void AddMap(string name, AbstractMap map) + { + // Логика для добавления + if (!_mapStorages.ContainsKey(name)) _mapStorages.Add(name, new MapWithSetLocomotivesGeneric(_pictureWidth, _pictureHeight, map)); + } + /// Удаление карты + public void DelMap(string name) + { + // Логика для удаления + if (_mapStorages.ContainsKey(name)) _mapStorages.Remove(name); + } + /// Доступ к парковке + public MapWithSetLocomotivesGeneric this[string ind] + { + get + { + // Логика получения объекта + if (_mapStorages.ContainsKey(ind)) return _mapStorages[ind]; + return null; + } + } + + } +} \ No newline at end of file