Unhardcode modchooser mod for content installation.

This commit is contained in:
Paul Chote
2017-01-27 17:07:55 +00:00
parent 657ba90ae3
commit 9b6afd3c37
5 changed files with 29 additions and 11 deletions

View File

@@ -109,12 +109,23 @@ namespace OpenRA.Mods.Common.LoadScreens
GC.SuppressFinalize(this);
}
public bool RequiredContentIsInstalled()
public bool BeforeLoad()
{
// If a ModContent section is defined then we need to make sure that the
// required content is installed or switch to the defined content installer.
if (!modData.Manifest.Contains<ModContent>())
return true;
var content = modData.Manifest.Get<ModContent>();
return content.Packages
var contentInstalled = content.Packages
.Where(p => p.Value.Required)
.All(p => p.Value.TestFiles.All(f => File.Exists(Platform.ResolvePath(f))));
if (contentInstalled)
return true;
Game.InitializeMod(content.ContentInstallerMod, new Arguments());
return false;
}
}
}

View File

@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.LoadScreens
sprite.Sheet.Dispose();
}
public bool RequiredContentIsInstalled()
public bool BeforeLoad()
{
return true;
}