diff --git a/AircraftCarrier/AircraftCarrier/MapWithSetWarshipsGeneric.cs b/AircraftCarrier/AircraftCarrier/MapWithSetWarshipsGeneric.cs index 23c8cc4..10ec2ea 100644 --- a/AircraftCarrier/AircraftCarrier/MapWithSetWarshipsGeneric.cs +++ b/AircraftCarrier/AircraftCarrier/MapWithSetWarshipsGeneric.cs @@ -151,7 +151,8 @@ namespace AircraftCarrier { for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j) {//линия рамзетки места - g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j * _placeSizeHeight); + g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 2, i * _placeSizeWidth + (int)(_placeSizeWidth * 0.8), j * _placeSizeHeight + 2); + g.DrawLine(pen, i * _placeSizeWidth + (int)(_placeSizeWidth * 0.8), j * _placeSizeHeight + 2, i * _placeSizeWidth * 2, j * _placeSizeHeight * 2); } g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, (_pictureHeight / _placeSizeHeight) * _placeSizeHeight); } diff --git a/AircraftCarrier/AircraftCarrier/MapsCollection.cs b/AircraftCarrier/AircraftCarrier/MapsCollection.cs new file mode 100644 index 0000000..e12e716 --- /dev/null +++ b/AircraftCarrier/AircraftCarrier/MapsCollection.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AircraftCarrier +{ + 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(_pictureWidth, _pictureHeight, map)); + } + /// + /// Удаление карты + /// + /// Название карты + public void DelMap(string name) + { + _mapStorages.Remove(name); + } + /// + /// Доступ к докам + /// + /// + /// + public MapWithSetWarshipsGeneric this[string ind] + { + get + { + _mapStorages.TryGetValue(ind, out var MapWithSetWarshipsGeneric); + return MapWithSetWarshipsGeneric; + } + } + } +}