using WarmlyShip.DrawningObjects;
using WarmlyShip.MovementStrategy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WarmlyShip.Generics
{
///
/// Класс для хранения коллекции
///
internal class ShipsGenericStorage
{
///
/// Словарь (хранилище)
///
readonly Dictionary> _shipStorages;
///
/// Возвращение списка названий наборов
///
public List Keys => _shipStorages.Keys.ToList();
///
/// Ширина окна отрисовки
///
private readonly int _pictureWidth;
///
/// Высота окна отрисовки
///
private readonly int _pictureHeight;
///
/// Конструктор
///
///
///
public ShipsGenericStorage(int pictureWidth, int pictureHeight)
{
_shipStorages = new Dictionary>();
_pictureWidth = pictureWidth;
_pictureHeight = pictureHeight;
}
///
/// Добавление набора
///
/// Название набора
public void AddSet(string name)
{
_shipStorages.Add(name, new ShipsGenericCollection(_pictureWidth, _pictureHeight));
}
///
/// Удаление набора
///
/// Название набора
public void DelSet(string name)
{
if (!_shipStorages.ContainsKey(name))
{
return;
}
_shipStorages.Remove(name);
}
///
/// Доступ к набору
///
///
///
public ShipsGenericCollection? this[string ind]
{
get
{
if (_shipStorages.ContainsKey(ind))
{
return _shipStorages[ind];
}
return null;
}
}
}
}