Fix loadscreen text when switching between internal mods.

This commit is contained in:
Paul Chote
2019-05-26 19:56:32 +01:00
committed by reaperrr
parent 1c965d812f
commit 829b8cd2e1

View File

@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Cnc
versionText = modData.Manifest.Metadata.Version; versionText = modData.Manifest.Metadata.Version;
} }
bool setup; object rendererFonts;
SpriteFont loadingFont, versionFont; SpriteFont loadingFont, versionFont;
string loadingText, versionText; string loadingText, versionText;
float2 loadingPos, versionPos; float2 loadingPos, versionPos;
@@ -97,8 +97,10 @@ namespace OpenRA.Mods.Cnc
null); null);
var barY = bounds.Height - 78; var barY = bounds.Height - 78;
if (!setup && r.Fonts != null) // The fonts dictionary may change when switching between the mod and content installer
if (r.Fonts != rendererFonts)
{ {
rendererFonts = r.Fonts;
loadingFont = r.Fonts["BigBold"]; loadingFont = r.Fonts["BigBold"];
loadingText = loadInfo["Text"]; loadingText = loadInfo["Text"];
loadingPos = new float2((bounds.Width - loadingFont.Measure(loadingText).X) / 2, barY); loadingPos = new float2((bounds.Width - loadingFont.Measure(loadingText).X) / 2, barY);
@@ -106,8 +108,6 @@ namespace OpenRA.Mods.Cnc
versionFont = r.Fonts["Regular"]; versionFont = r.Fonts["Regular"];
var versionSize = versionFont.Measure(versionText); var versionSize = versionFont.Measure(versionText);
versionPos = new float2(bounds.Width - 107 - versionSize.X / 2, 115 - versionSize.Y / 2); versionPos = new float2(bounds.Width - 107 - versionSize.X / 2, 115 - versionSize.Y / 2);
setup = true;
} }
if (loadingFont != null) if (loadingFont != null)