using AirBomber.MovementStrategy; using AirBomber.Rendering; namespace AirBomber.Generics { internal class EntitiesGenericStorage { readonly Dictionary> _entityStorages; public List Keys => _entityStorages.Keys.ToList(); private readonly int _pictureWidth; private readonly int _pictureHeight; public EntitiesGenericStorage(int PictureWidth, int PictureHeight) { _entityStorages = new Dictionary>(); _pictureWidth = PictureWidth; _pictureHeight = PictureHeight; } public void AddSet(string Name) { var NewCollection = new EntitiesGenericCollection(_pictureWidth, _pictureHeight); if (Keys.Contains(Name)) { MessageBox.Show("Набор с таким именем уже существует", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } _entityStorages.Add(Name, NewCollection); } public void RemoveSet(string Name) { _entityStorages.Remove(Name); } public EntitiesGenericCollection? this[string Index] { get { if (!_entityStorages.ContainsKey(Index)) return null; return _entityStorages[Index]; } } } }