move ActiveModVersion,ActiveModTitle out of cnc-specific code

This commit is contained in:
Chris Forbes
2011-09-24 21:19:05 +12:00
parent 15d846bfb0
commit e7900d069d
6 changed files with 31 additions and 38 deletions

View File

@@ -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();

View File

@@ -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;

View File

@@ -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");