PIbd_23_Kislitsa_E.D_AirFig.../AirFighter/AirplanesGenericStorage.cs

51 lines
1.6 KiB
C#
Raw Normal View History

2023-10-27 00:17:04 +04:00
using ProjectAirFighter.DrawningObjects;
using ProjectAirFighter.Generics;
using ProjectAirFighter.MovementStrategy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectAirFighter.Generics
{
internal class AirplanesGenericStorage
{
readonly Dictionary<string, AirplaneslGenericCollection<DrawningAirplane, DrawningObjectAirplane>> _airplaneStorages;
public List<string> Keys => _airplaneStorages.Keys.ToList();
private readonly int _pictureWidth;
private readonly int _pictureHeight;
public AirplanesGenericStorage(int pictureWidth, int pictureHeight)
{
_airplaneStorages = new Dictionary<string, AirplaneslGenericCollection<DrawningAirplane, DrawningObjectAirplane>>();
_pictureWidth = pictureWidth;
_pictureHeight = pictureHeight;
}
public void AddSet(string name)
{
_airplaneStorages.Add(name, new AirplaneslGenericCollection<DrawningAirplane, DrawningObjectAirplane>(_pictureWidth, _pictureHeight));
}
public void DelSet(string name)
{
if (!_airplaneStorages.ContainsKey(name))
return;
_airplaneStorages.Remove(name);
}
public AirplaneslGenericCollection<DrawningAirplane, DrawningObjectAirplane>? this[string ind]
{
get
{
if (_airplaneStorages.ContainsKey(ind))
return _airplaneStorages[ind];
return null;
}
}
}
}