diff --git a/Battleship/Battleship/MapsCollection.cs b/Battleship/Battleship/MapsCollection.cs new file mode 100644 index 0000000..8f176d2 --- /dev/null +++ b/Battleship/Battleship/MapsCollection.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Battleship +{ + internal class MapsCollection + { + readonly Dictionary> _mapStorage; + + public List Keys => _mapStorage.Keys.ToList(); + + private readonly int _pictureWidth; + + private readonly int _pictureHeight; + + public MapsCollection(int pictureWidth, int pictureHeight) + { + _mapStorage = new Dictionary>(); + _pictureWidth = pictureWidth; + _pictureHeight = pictureHeight; + } + public void AddMap(string name, AbstractMap map) + { + var NewElem = new MapWithSetBattleshipGeneric( + _pictureWidth, _pictureHeight, map); + _mapStorage.Add(name, NewElem); + } + public void DelMap(string name) + { + _mapStorage.Remove(name); + } + public MapWithSetBattleshipGeneric this[string ind] + { + get + { + return _mapStorage[ind]; + } + } + } +} \ No newline at end of file