move ActiveModVersion,ActiveModTitle out of cnc-specific code
This commit is contained in:
@@ -33,16 +33,17 @@ namespace OpenRA.Mods.Cnc
|
||||
public void Init(Dictionary<string, string> info)
|
||||
{
|
||||
Info = info;
|
||||
|
||||
// Avoid standard loading mechanisms so we
|
||||
// can display loadscreen as early as possible
|
||||
r = Game.Renderer;
|
||||
if (r == null) return;
|
||||
|
||||
|
||||
var s = new Sheet("mods/cnc/uibits/chrome.png");
|
||||
var res = Renderer.Resolution;
|
||||
Bounds = new Rectangle(0, 0, res.Width, res.Height);
|
||||
ss = new Sprite[]
|
||||
|
||||
ss = new []
|
||||
{
|
||||
new Sprite(s, new Rectangle(161,128,62,33), TextureChannel.Alpha),
|
||||
new Sprite(s, new Rectangle(161,223,62,33), TextureChannel.Alpha),
|
||||
@@ -53,6 +54,7 @@ namespace OpenRA.Mods.Cnc
|
||||
new Sprite(s, new Rectangle(128,223,33,33), TextureChannel.Alpha),
|
||||
new Sprite(s, new Rectangle(223,223,33,33), TextureChannel.Alpha)
|
||||
};
|
||||
|
||||
nodLogo = new Sprite(s, new Rectangle(0, 256, 256, 256), TextureChannel.Alpha);
|
||||
gdiLogo = new Sprite(s, new Rectangle(256, 256, 256, 256), TextureChannel.Alpha);
|
||||
evaLogo = new Sprite(s, new Rectangle(256, 64, 128, 64), TextureChannel.Alpha);
|
||||
@@ -73,6 +75,7 @@ namespace OpenRA.Mods.Cnc
|
||||
{
|
||||
if (r == null || loadTimer.ElapsedTime() < 0.25)
|
||||
return;
|
||||
|
||||
loadTimer.Reset();
|
||||
|
||||
loadTick = ++loadTick % 8;
|
||||
@@ -91,7 +94,7 @@ namespace OpenRA.Mods.Cnc
|
||||
loadingPos = new float2((Bounds.Width - loadingFont.Measure(loadingText).X) / 2, barY);
|
||||
|
||||
versionFont = r.Fonts["Regular"];
|
||||
versionText = CncWidgetUtils.ActiveModVersion();
|
||||
versionText = WidgetUtils.ActiveModVersion();
|
||||
var versionSize = versionFont.Measure(versionText);
|
||||
versionPos = new float2(Bounds.Width - 107 - versionSize.X/2, 115 - versionSize.Y/2);
|
||||
|
||||
|
||||
@@ -17,12 +17,6 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
{
|
||||
public static class CncWidgetUtils
|
||||
{
|
||||
public static string ActiveModVersion()
|
||||
{
|
||||
var mod = Game.modData.Manifest.Mods[0];
|
||||
return Mod.AllMods[mod].Version;
|
||||
}
|
||||
|
||||
public static string ChooseInitialMap(string map)
|
||||
{
|
||||
var availableMaps = Game.modData.AvailableMaps;
|
||||
@@ -37,13 +31,13 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
var prompt = Widget.OpenWindow("CONFIRM_PROMPT");
|
||||
prompt.GetWidget<LabelWidget>("PROMPT_TITLE").GetText = () => title;
|
||||
prompt.GetWidget<LabelWidget>("PROMPT_TEXT").GetText = () => text;
|
||||
|
||||
|
||||
prompt.GetWidget<ButtonWidget>("CONFIRM_BUTTON").OnClick = () =>
|
||||
{
|
||||
Widget.CloseWindow();
|
||||
onConfirm();
|
||||
};
|
||||
|
||||
|
||||
prompt.GetWidget<ButtonWidget>("CANCEL_BUTTON").OnClick = () =>
|
||||
{
|
||||
Widget.CloseWindow();
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
var mpe = world.WorldActor.Trait<CncMenuPaletteEffect>();
|
||||
mpe.Fade(CncMenuPaletteEffect.EffectType.Desaturated);
|
||||
|
||||
menu.GetWidget<LabelWidget>("VERSION_LABEL").GetText = CncWidgetUtils.ActiveModVersion;
|
||||
menu.GetWidget<LabelWidget>("VERSION_LABEL").GetText = WidgetUtils.ActiveModVersion;
|
||||
|
||||
bool hideButtons = false;
|
||||
menu.GetWidget("MENU_BUTTONS").IsVisible = () => !hideButtons;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
.Fade(CncMenuPaletteEffect.EffectType.Desaturated);
|
||||
|
||||
rootMenu = widget.GetWidget("MENU_BACKGROUND");
|
||||
rootMenu.GetWidget<LabelWidget>("VERSION_LABEL").GetText = CncWidgetUtils.ActiveModVersion;
|
||||
rootMenu.GetWidget<LabelWidget>("VERSION_LABEL").GetText = WidgetUtils.ActiveModVersion;
|
||||
|
||||
// Menu buttons
|
||||
var mainMenu = widget.GetWidget("MAIN_MENU");
|
||||
|
||||
Reference in New Issue
Block a user