Show mod version in the main menu.

This commit is contained in:
Paul Chote
2011-01-22 09:56:55 +13:00
parent d39adf67b2
commit 388e5df377
3 changed files with 30 additions and 7 deletions

View File

@@ -31,10 +31,11 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
widget.GetWidget("MAINMENU_BUTTON_REPLAY_VIEWER").OnMouseUp = mi => { Widget.OpenWindow("REPLAYBROWSER_BG"); return true; };
widget.GetWidget("MAINMENU_BUTTON_QUIT").OnMouseUp = mi => { Game.Exit(); return true; };
var switcher = Game.modData.WidgetLoader.LoadWidget( new Dictionary<string,object>(), Widget.RootWidget, "QUICKMODSWITCHER" );
var selector = switcher.GetWidget<ButtonWidget>("SWITCHER");
selector.OnMouseDown = _ => ShowModsDropDown(selector);
selector.GetText = ActiveModTitle;
var selector = Game.modData.WidgetLoader.LoadWidget( new Dictionary<string,object>(), Widget.RootWidget, "QUICKMODSWITCHER" );
var switcher = selector.GetWidget<ButtonWidget>("SWITCHER");
switcher.OnMouseDown = _ => ShowModsDropDown(switcher);
switcher.GetText = ActiveModTitle;
selector.GetWidget<LabelWidget>("VERSION").GetText = ActiveModVersion;
}
string ActiveModTitle()
@@ -43,6 +44,12 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
return Mod.AllMods[mod].Title;
}
string ActiveModVersion()
{
var mod = Game.modData.Manifest.Mods[0];
return Mod.AllMods[mod].Version;
}
bool ShowModsDropDown(ButtonWidget selector)
{
var dropDownOptions = new List<Pair<string, Action>>();

View File

@@ -78,7 +78,7 @@ Background@QUICKMODSWITCHER:
X:(WINDOW_RIGHT - PARENT_LEFT - WIDTH - 10)
Y:10 - PARENT_TOP
Width:205
Height:35
Height:65
Children:
Label@TITLE:
X:8
@@ -94,7 +94,15 @@ Background@QUICKMODSWITCHER:
Width:150
Height:25
X:50
Y:5
Y:5
Label@VERSION:
Id:VERSION
X:50
Y:30
Width:150
Height:25
Align:Center
Bold:True
Background@PERF_BG:
Id:PERF_BG
Background:dialog4

View File

@@ -79,7 +79,7 @@ Background@QUICKMODSWITCHER:
X:(WINDOW_RIGHT - PARENT_LEFT - WIDTH - 10)
Y:10 - PARENT_TOP
Width:205
Height:35
Height:65
Children:
Label@TITLE:
X:8
@@ -96,6 +96,14 @@ Background@QUICKMODSWITCHER:
Height:25
X:50
Y:5
Label@VERSION:
Id:VERSION
X:50
Y:30
Width:150
Height:25
Align:Center
Bold:True
Background@PERF_BG:
ClickThrough:true
Id:PERF_BG