From 388e5df3775563b6d6bb7ccc9dceabeeb6e2bd41 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 22 Jan 2011 09:56:55 +1300 Subject: [PATCH] Show mod version in the main menu. --- .../Widgets/Delegates/MainMenuButtonsDelegate.cs | 15 +++++++++++---- mods/cnc/chrome/mainmenu.yaml | 12 ++++++++++-- mods/ra/chrome/mainmenu.yaml | 10 +++++++++- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/OpenRA.Mods.RA/Widgets/Delegates/MainMenuButtonsDelegate.cs b/OpenRA.Mods.RA/Widgets/Delegates/MainMenuButtonsDelegate.cs index 002886a9cf..61d520e56a 100755 --- a/OpenRA.Mods.RA/Widgets/Delegates/MainMenuButtonsDelegate.cs +++ b/OpenRA.Mods.RA/Widgets/Delegates/MainMenuButtonsDelegate.cs @@ -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(), Widget.RootWidget, "QUICKMODSWITCHER" ); - var selector = switcher.GetWidget("SWITCHER"); - selector.OnMouseDown = _ => ShowModsDropDown(selector); - selector.GetText = ActiveModTitle; + var selector = Game.modData.WidgetLoader.LoadWidget( new Dictionary(), Widget.RootWidget, "QUICKMODSWITCHER" ); + var switcher = selector.GetWidget("SWITCHER"); + switcher.OnMouseDown = _ => ShowModsDropDown(switcher); + switcher.GetText = ActiveModTitle; + selector.GetWidget("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>(); diff --git a/mods/cnc/chrome/mainmenu.yaml b/mods/cnc/chrome/mainmenu.yaml index b8e169ae54..a9244c1cf6 100644 --- a/mods/cnc/chrome/mainmenu.yaml +++ b/mods/cnc/chrome/mainmenu.yaml @@ -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 diff --git a/mods/ra/chrome/mainmenu.yaml b/mods/ra/chrome/mainmenu.yaml index 46138a3501..46d39ef356 100644 --- a/mods/ra/chrome/mainmenu.yaml +++ b/mods/ra/chrome/mainmenu.yaml @@ -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