using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Artilleries { internal class MapsCollection { readonly Dictionary> _mapsStorage; public List Keys => _mapsStorage.Keys.ToList(); private readonly int _pictureWidth; private readonly int _pictureHeight; public MapsCollection(int pictureWidth, int pictureHeight) { _mapsStorage = new Dictionary>(); _pictureWidth = pictureWidth; _pictureHeight = pictureHeight; } public void AddMap(string name, AbstractMap map) { if (!_mapsStorage.ContainsKey(name)) { _mapsStorage.Add(name, new MapWithSetArtilleriesGeneric(_pictureWidth, _pictureHeight, map)); } } public void DelMap(string name) { if (_mapsStorage.ContainsKey(name)) { _mapsStorage.Remove(name); } } public MapWithSetArtilleriesGeneric this[string index] { get { return _mapsStorage.ContainsKey(index) ? _mapsStorage[index] : null; } } } }