Merge pull request #10719 from pchote/filesystem-loadscreens
Load Loadscreen images via the virtual filesystem.
This commit is contained in:
@@ -53,7 +53,7 @@ namespace OpenRA
|
|||||||
if (useLoadScreen)
|
if (useLoadScreen)
|
||||||
{
|
{
|
||||||
LoadScreen = ObjectCreator.CreateObject<ILoadScreen>(Manifest.LoadScreen.Value);
|
LoadScreen = ObjectCreator.CreateObject<ILoadScreen>(Manifest.LoadScreen.Value);
|
||||||
LoadScreen.Init(Manifest, Manifest.LoadScreen.ToDictionary(my => my.Value));
|
LoadScreen.Init(this, Manifest.LoadScreen.ToDictionary(my => my.Value));
|
||||||
LoadScreen.Display();
|
LoadScreen.Display();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public interface ILoadScreen : IDisposable
|
public interface ILoadScreen : IDisposable
|
||||||
{
|
{
|
||||||
void Init(Manifest m, Dictionary<string, string> info);
|
void Init(ModData m, Dictionary<string, string> info);
|
||||||
void Display();
|
void Display();
|
||||||
void StartGame(Arguments args);
|
void StartGame(Arguments args);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
Rectangle bounds;
|
Rectangle bounds;
|
||||||
Renderer r;
|
Renderer r;
|
||||||
|
|
||||||
public override void Init(Manifest m, Dictionary<string, string> info)
|
public override void Init(ModData modData, Dictionary<string, string> info)
|
||||||
{
|
{
|
||||||
loadInfo = info;
|
loadInfo = info;
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
r = Game.Renderer;
|
r = Game.Renderer;
|
||||||
if (r == null) return;
|
if (r == null) return;
|
||||||
|
|
||||||
using (var stream = File.OpenRead(Platform.ResolvePath(loadInfo["Image"])))
|
using (var stream = modData.ModFiles.Open(info["Image"]))
|
||||||
sheet = new Sheet(SheetType.BGRA, stream);
|
sheet = new Sheet(SheetType.BGRA, stream);
|
||||||
|
|
||||||
var res = r.Resolution;
|
var res = r.Resolution;
|
||||||
@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
brightBlock = new Sprite(sheet, new Rectangle(320, 0, 16, 35), TextureChannel.Alpha);
|
brightBlock = new Sprite(sheet, new Rectangle(320, 0, 16, 35), TextureChannel.Alpha);
|
||||||
dimBlock = new Sprite(sheet, new Rectangle(336, 0, 16, 35), TextureChannel.Alpha);
|
dimBlock = new Sprite(sheet, new Rectangle(336, 0, 16, 35), TextureChannel.Alpha);
|
||||||
|
|
||||||
versionText = m.Mod.Version;
|
versionText = modData.Manifest.Mod.Version;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool setup;
|
bool setup;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.LoadScreens
|
|||||||
{
|
{
|
||||||
public LaunchArguments Launch;
|
public LaunchArguments Launch;
|
||||||
|
|
||||||
public virtual void Init(Manifest m, Dictionary<string, string> info) { }
|
public virtual void Init(ModData m, Dictionary<string, string> info) { }
|
||||||
|
|
||||||
public virtual void Display()
|
public virtual void Display()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.LoadScreens
|
|||||||
Sprite stripe, logo;
|
Sprite stripe, logo;
|
||||||
string[] messages = { "Loading..." };
|
string[] messages = { "Loading..." };
|
||||||
|
|
||||||
public override void Init(Manifest m, Dictionary<string, string> info)
|
public override void Init(ModData modData, Dictionary<string, string> info)
|
||||||
{
|
{
|
||||||
// Avoid standard loading mechanisms so we
|
// Avoid standard loading mechanisms so we
|
||||||
// can display the loadscreen as early as possible
|
// can display the loadscreen as early as possible
|
||||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.LoadScreens
|
|||||||
|
|
||||||
if (info.ContainsKey("Image"))
|
if (info.ContainsKey("Image"))
|
||||||
{
|
{
|
||||||
using (var stream = File.OpenRead(Platform.ResolvePath(info["Image"])))
|
using (var stream = modData.ModFiles.Open(info["Image"]))
|
||||||
sheet = new Sheet(SheetType.BGRA, stream);
|
sheet = new Sheet(SheetType.BGRA, stream);
|
||||||
|
|
||||||
logo = new Sprite(sheet, new Rectangle(0, 0, 256, 256), TextureChannel.Alpha);
|
logo = new Sprite(sheet, new Rectangle(0, 0, 256, 256), TextureChannel.Alpha);
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ namespace OpenRA.Mods.Common.LoadScreens
|
|||||||
Sprite sprite;
|
Sprite sprite;
|
||||||
Rectangle bounds;
|
Rectangle bounds;
|
||||||
|
|
||||||
public void Init(Manifest m, Dictionary<string, string> info)
|
public void Init(ModData modData, Dictionary<string, string> info)
|
||||||
{
|
{
|
||||||
var res = Game.Renderer.Resolution;
|
var res = Game.Renderer.Resolution;
|
||||||
bounds = new Rectangle(0, 0, res.Width, res.Height);
|
bounds = new Rectangle(0, 0, res.Width, res.Height);
|
||||||
|
|
||||||
using (var stream = File.OpenRead(info["Image"]))
|
using (var stream = modData.ModFiles.Open(info["Image"]))
|
||||||
{
|
{
|
||||||
var sheet = new Sheet(SheetType.BGRA, stream);
|
var sheet = new Sheet(SheetType.BGRA, stream);
|
||||||
sprite = new Sprite(sheet, new Rectangle(0, 0, 1024, 480), TextureChannel.Alpha);
|
sprite = new Sprite(sheet, new Rectangle(0, 0, 1024, 480), TextureChannel.Alpha);
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ Translations:
|
|||||||
d2k:languages/english.yaml
|
d2k:languages/english.yaml
|
||||||
|
|
||||||
LoadScreen: LogoStripeLoadScreen
|
LoadScreen: LogoStripeLoadScreen
|
||||||
Image: d2k:uibits/loadscreen.png
|
Image: ./mods/d2k/uibits/loadscreen.png
|
||||||
Text: Filling Crates..., Breeding Sandworms..., Fuelling carryalls..., Deploying harvesters..., Preparing 'thopters..., Summoning mentats...
|
Text: Filling Crates..., Breeding Sandworms..., Fuelling carryalls..., Deploying harvesters..., Preparing 'thopters..., Summoning mentats...
|
||||||
|
|
||||||
ContentInstaller:
|
ContentInstaller:
|
||||||
|
|||||||
Reference in New Issue
Block a user