diff --git a/WarmlyShip/WarmlyShip/MapsCollection.cs b/WarmlyShip/WarmlyShip/MapsCollection.cs new file mode 100644 index 0000000..13d66c0 --- /dev/null +++ b/WarmlyShip/WarmlyShip/MapsCollection.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WarmlyShip +{ + 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) + { + _mapStorages.Add(name, new MapWithSetShipGeneric(_pictureWidth, _pictureHeight, map)); + } + public void DelMap(string name) + { + _mapStorages.Remove(name); + } + + public MapWithSetShipGeneric this[string ind] + { + get + { + foreach (var map in _mapStorages) + { + if(map.Key == ind) return map.Value; + } + return null; + } + } + + } +}