Implement mod-defined package loaders.

This commit is contained in:
Paul Chote
2017-05-07 12:25:04 +00:00
parent 9b4f602cca
commit 0222ea675c
26 changed files with 993 additions and 838 deletions

View File

@@ -11,6 +11,7 @@
using System;
using System.Linq;
using OpenRA.FileSystem;
using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets.Logic
@@ -18,7 +19,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public class ModContentPromptLogic : ChromeLogic
{
[ObjectCreator.UseCtor]
public ModContentPromptLogic(Widget widget, Manifest mod, ModContent content, Action continueLoading)
public ModContentPromptLogic(Widget widget, ModData modData, Manifest mod, ModContent content, Action continueLoading)
{
var panel = widget.Get("CONTENT_PROMPT_PANEL");
@@ -55,8 +56,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
quickButton.Bounds.Y += headerHeight;
quickButton.OnClick = () =>
{
var modFileSystem = new FileSystem.FileSystem(Game.Mods);
var modObjectCreator = new ObjectCreator(mod, Game.Mods);
var modPackageLoaders = modObjectCreator.GetLoaders<IPackageLoader>(mod.PackageFormats, "package");
var modFileSystem = new FileSystem.FileSystem(Game.Mods, modPackageLoaders);
modFileSystem.LoadFromManifest(mod);
var downloadYaml = MiniYaml.Load(modFileSystem, content.Downloads, null);
modFileSystem.UnmountAll();