Move ModContent out of the engine.

This commit is contained in:
Paul Chote
2016-08-05 19:05:43 +01:00
parent bf4867909f
commit cff8e949d8
9 changed files with 26 additions and 9 deletions

View File

@@ -12,6 +12,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Mods.Common.Widgets.Logic;
using OpenRA.Widgets;
@@ -21,8 +22,12 @@ namespace OpenRA.Mods.Common.LoadScreens
public class BlankLoadScreen : ILoadScreen
{
public LaunchArguments Launch;
ModData modData;
public virtual void Init(ModData m, Dictionary<string, string> info) { }
public virtual void Init(ModData modData, Dictionary<string, string> info)
{
this.modData = modData;
}
public virtual void Display()
{
@@ -97,5 +102,13 @@ namespace OpenRA.Mods.Common.LoadScreens
Dispose(true);
GC.SuppressFinalize(this);
}
public bool RequiredContentIsInstalled()
{
var content = modData.Manifest.Get<ModContent>();
return content.Packages
.Where(p => p.Value.Required)
.All(p => p.Value.TestFiles.All(f => File.Exists(Platform.ResolvePath(f))));
}
}
}

View File

@@ -31,6 +31,8 @@ namespace OpenRA.Mods.Common.LoadScreens
public override void Init(ModData modData, Dictionary<string, string> info)
{
base.Init(modData, info);
// Avoid standard loading mechanisms so we
// can display the loadscreen as early as possible
r = Game.Renderer;

View File

@@ -11,7 +11,6 @@
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using OpenRA.Graphics;
using OpenRA.Widgets;
@@ -58,5 +57,10 @@ namespace OpenRA.Mods.Common.LoadScreens
if (sprite != null)
sprite.Sheet.Dispose();
}
public bool RequiredContentIsInstalled()
{
return true;
}
}
}