42 lines
925 B
C#
42 lines
925 B
C#
using System.Collections.Generic;
|
|
using System.ComponentModel.Composition;
|
|
using System.Linq;
|
|
using JD.Interfaces.Composition;
|
|
using Ubisoft;
|
|
|
|
namespace JD.Serialization
|
|
{
|
|
[InheritedExport(typeof(IMapInfoProvider))]
|
|
public interface IMapInfoProvider
|
|
{
|
|
MapInfo GetMapInfo(string path);
|
|
}
|
|
|
|
public struct MapInfo
|
|
{
|
|
public string Name;
|
|
|
|
public string PictosFolder;
|
|
|
|
public string PictosFolderRelative;
|
|
|
|
public string MovesFolderRelative;
|
|
}
|
|
|
|
public class MapInfoManager : Singleton<MapInfoManager>
|
|
{
|
|
private MapInfoManager()
|
|
{
|
|
this.ComposeCatalog(typeof(IMapInfoProvider));
|
|
}
|
|
|
|
[ImportMany]
|
|
public List<IMapInfoProvider> MapProviderList { get; set; }
|
|
|
|
public MapInfo? GetMapInfo(string path)
|
|
{
|
|
return MapProviderList.FirstOrDefault()?.GetMapInfo(path);
|
|
}
|
|
}
|
|
|
|
}
|