Add plumbing for mod-defined sprite loaders.
This commit is contained in:
@@ -24,6 +24,7 @@ namespace OpenRA
|
||||
public readonly ObjectCreator ObjectCreator;
|
||||
public readonly WidgetLoader WidgetLoader;
|
||||
public readonly MapCache MapCache;
|
||||
public readonly ISpriteLoader[] SpriteLoaders;
|
||||
public ILoadScreen LoadScreen = null;
|
||||
public VoxelLoader VoxelLoader;
|
||||
public readonly RulesetCache RulesetCache;
|
||||
@@ -45,6 +46,18 @@ namespace OpenRA
|
||||
RulesetCache.LoadingProgress += HandleLoadingProgress;
|
||||
MapCache = new MapCache(this);
|
||||
|
||||
var loaders = new List<ISpriteLoader>();
|
||||
foreach (var format in Manifest.SpriteFormats)
|
||||
{
|
||||
var loader = ObjectCreator.FindType(format + "Loader");
|
||||
if (loader == null || !loader.GetInterfaces().Contains(typeof(ISpriteLoader)))
|
||||
throw new InvalidOperationException("Unable to find a sprite loader for type '{0}'.".F(format));
|
||||
|
||||
loaders.Add((ISpriteLoader)ObjectCreator.CreateBasic(loader));
|
||||
}
|
||||
|
||||
SpriteLoaders = loaders.ToArray();
|
||||
|
||||
// HACK: Mount only local folders so we have a half-working environment for the asset installer
|
||||
GlobalFileSystem.UnmountAll();
|
||||
foreach (var dir in Manifest.Folders)
|
||||
|
||||
Reference in New Issue
Block a user