39 lines
1.6 KiB
C#
39 lines
1.6 KiB
C#
using WarmlyLocomotive.DrawningObjects;
|
|
using WarmlyLocomotive.MovementStrategy;
|
|
namespace WarmlyLocomotive.Generics
|
|
{
|
|
internal class WarmlyLocomotivesGenericStorage
|
|
{
|
|
readonly Dictionary<string, WarmlyLocomotivesGenericCollection<DrawningWarmlyLocomotive, DrawningObjectWarmlyLocomotive>> _warmlylocomotiveStorages;
|
|
public List<string> Keys => _warmlylocomotiveStorages.Keys.ToList();
|
|
private readonly int _pictureWidth;
|
|
private readonly int _pictureHeight;
|
|
public WarmlyLocomotivesGenericStorage(int pictureWidth, int pictureHeight)
|
|
{
|
|
_warmlylocomotiveStorages = new Dictionary<string,
|
|
WarmlyLocomotivesGenericCollection<DrawningWarmlyLocomotive, DrawningObjectWarmlyLocomotive>>();
|
|
_pictureWidth = pictureWidth;
|
|
_pictureHeight = pictureHeight;
|
|
}
|
|
public void AddSet(string name)
|
|
{
|
|
_warmlylocomotiveStorages.Add(name, new WarmlyLocomotivesGenericCollection<DrawningWarmlyLocomotive, DrawningObjectWarmlyLocomotive>(_pictureWidth, _pictureHeight));
|
|
}
|
|
public void DelSet(string name)
|
|
{
|
|
if (!_warmlylocomotiveStorages.ContainsKey(name))
|
|
return;
|
|
_warmlylocomotiveStorages.Remove(name);
|
|
}
|
|
public WarmlyLocomotivesGenericCollection<DrawningWarmlyLocomotive, DrawningObjectWarmlyLocomotive>? this[string ind]
|
|
{
|
|
get
|
|
{
|
|
if (_warmlylocomotiveStorages.ContainsKey(ind))
|
|
return _warmlylocomotiveStorages[ind];
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|