diff --git a/OpenRA.Game/Widgets/Delegates/ServerBrowserDelegate.cs b/OpenRA.Game/Widgets/Delegates/ServerBrowserDelegate.cs index abbadfa974..34e2be4293 100644 --- a/OpenRA.Game/Widgets/Delegates/ServerBrowserDelegate.cs +++ b/OpenRA.Game/Widgets/Delegates/ServerBrowserDelegate.cs @@ -44,7 +44,7 @@ namespace OpenRA.Widgets.Delegates preview.IsVisible = () => CurrentMap() != null; bg.GetWidget("SERVER_IP").GetText = () => currentServer.Address; - bg.GetWidget("SERVER_MODS").GetText = () => string.Join(",", currentServer.Mods); + bg.GetWidget("SERVER_MODS").GetText = () => GenerateModsLabel(); bg.GetWidget("MAP_TITLE").GetText = () => (CurrentMap() != null) ? CurrentMap().Title : "Unknown"; bg.GetWidget("MAP_PLAYERS").GetText = () => { @@ -120,6 +120,13 @@ namespace OpenRA.Widgets.Delegates return (currentServer == null || !Game.modData.AvailableMaps.ContainsKey(currentServer.Map)) ? null : Game.modData.AvailableMaps[currentServer.Map]; } + + string GenerateModsLabel() + { + return string.Join("\n", currentServer.Mods.Select(m => + ModData.AllMods.ContainsKey(m) ? string.Format("{0} ({1})", ModData.AllMods[m].Title, ModData.AllMods[m].Version) + : string.Format("Unknown Mod: {0}",m)).ToArray()); + } void RefreshServerList(IEnumerable games) { diff --git a/OpenRA.Game/Widgets/LabelWidget.cs b/OpenRA.Game/Widgets/LabelWidget.cs index 3a078987e3..5d87120dec 100644 --- a/OpenRA.Game/Widgets/LabelWidget.cs +++ b/OpenRA.Game/Widgets/LabelWidget.cs @@ -16,10 +16,12 @@ namespace OpenRA.Widgets public class LabelWidget : Widget { public enum TextAlign { Left, Center, Right } + public enum TextVAlign { Top, Middle, Bottom } public string Text = null; public string Background = null; public TextAlign Align = TextAlign.Left; + public TextVAlign VAlign = TextVAlign.Middle; public bool Bold = false; public Func GetText; public Func GetBackground; @@ -54,8 +56,14 @@ namespace OpenRA.Widgets return; int2 textSize = font.Measure(text); - int2 position = RenderOrigin + new int2(0, (Bounds.Height - textSize.Y)/2); - + int2 position = RenderOrigin; + + if (VAlign == TextVAlign.Middle) + position += new int2(0, (Bounds.Height - textSize.Y)/2); + + if (VAlign == TextVAlign.Bottom) + position += new int2(0, Bounds.Height - textSize.Y); + if (Align == TextAlign.Center) position += new int2((Bounds.Width - textSize.X)/2, 0); diff --git a/mods/cnc/chrome/serverbrowser.yaml b/mods/cnc/chrome/serverbrowser.yaml index 1a5f8fa25e..de18dc908b 100644 --- a/mods/cnc/chrome/serverbrowser.yaml +++ b/mods/cnc/chrome/serverbrowser.yaml @@ -141,10 +141,16 @@ Background@JOINSERVER_BG: Height:PARENT_BOTTOM Visible:false Children: + MapPreview@MAP_PREVIEW: + Id:MAP_PREVIEW + X:PARENT_RIGHT-241 + Y:30 + Width:192 + Height:192 Label@SERVER_IP_LABEL: Id:SERVER_IP_LABEL X:PARENT_RIGHT - 200 - WIDTH - Y:50 + Y:230 Align:Right Width:70 Height:20 @@ -153,46 +159,14 @@ Background@JOINSERVER_BG: Label@SERVER_IP: Id:SERVER_IP X:PARENT_RIGHT - 195 - Y:50 - Align:Left - Width:70 - Height:20 - Label@SERVER_MODS_LABEL: - Id:SERVER_MODS_LABEL - X:PARENT_RIGHT - 200 - WIDTH - Y:70 - Align:Right - Width:70 - Height:20 - Text:Mods: - Bold:True - Label@SERVER_MODS: - Id:SERVER_MODS - X:PARENT_RIGHT - 195 - Y:70 - Align:Left - Width:70 - Height:20 - Label@MAP_TITLE_LABEL: - Id:MAP_TITLE_LABEL - X:PARENT_RIGHT - 200 - WIDTH - Y:90 - Align:Right - Width:70 - Height:20 - Text:Map: - Bold:True - Label@MAP_TITLE: - Id:MAP_TITLE - X:PARENT_RIGHT - 195 - Y:90 + Y:230 Align:Left Width:70 Height:20 Label@MAP_PLAYERS_LABEL: Id:MAP_PLAYERS_LABEL X:PARENT_RIGHT - 200 - WIDTH - Y:110 + Y:250 Align:Right Width:70 Height:20 @@ -201,16 +175,43 @@ Background@JOINSERVER_BG: Label@MAP_PLAYERS: Id:MAP_PLAYERS X:PARENT_RIGHT - 195 - Y:110 + Y:250 Align:Left Width:70 Height:20 - MapPreview@MAP_PREVIEW: - Id:MAP_PREVIEW - X:PARENT_RIGHT-241 - Y:140 - Width:192 - Height:192 + Label@MAP_TITLE_LABEL: + Id:MAP_TITLE_LABEL + X:PARENT_RIGHT - 200 - WIDTH + Y:270 + Align:Right + Width:70 + Height:20 + Text:Map: + Bold:True + Label@MAP_TITLE: + Id:MAP_TITLE + X:PARENT_RIGHT - 195 + Y:270 + Align:Left + Width:70 + Height:20 + Label@SERVER_MODS_LABEL: + Id:SERVER_MODS_LABEL + X:PARENT_RIGHT - 200 - WIDTH + Y:290 + Align:Right + Width:70 + Height:20 + Text:Mods: + Bold:True + Label@SERVER_MODS: + Id:SERVER_MODS + X:PARENT_RIGHT - 195 + Y:293 + Align:Left + VAlign:Top + Width:70 + Height:20 Button@DIRECTCONNECT_BUTTON: Id:DIRECTCONNECT_BUTTON X:20 diff --git a/mods/cnc/mod.yaml b/mods/cnc/mod.yaml index 602c54811e..80c63fea25 100644 --- a/mods/cnc/mod.yaml +++ b/mods/cnc/mod.yaml @@ -1,5 +1,5 @@ Metadata: - Title: Command & Conquer + Title: C&C Description: OpenRA Reimagining of the classic game Version: a0001 diff --git a/mods/ra/chrome/serverbrowser.yaml b/mods/ra/chrome/serverbrowser.yaml index fa2ab20936..c7d93a04b9 100644 --- a/mods/ra/chrome/serverbrowser.yaml +++ b/mods/ra/chrome/serverbrowser.yaml @@ -5,7 +5,6 @@ Background@CREATESERVER_BG: Y:(WINDOW_BOTTOM - HEIGHT)/2 Width:400 Height:240 - Visible:true Children: Label@LABEL_TITLE: Id:LABEL_TITLE @@ -100,7 +99,6 @@ Background@JOINSERVER_BG: Y:(WINDOW_BOTTOM - HEIGHT)/2 Width:700 Height:410 - Visible:true Children: Label@JOINSERVER_LABEL_TITLE: Id:JOINSERVER_LABEL_TITLE @@ -143,10 +141,16 @@ Background@JOINSERVER_BG: Height:PARENT_BOTTOM Visible:false Children: + MapPreview@MAP_PREVIEW: + Id:MAP_PREVIEW + X:PARENT_RIGHT-241 + Y:30 + Width:192 + Height:192 Label@SERVER_IP_LABEL: Id:SERVER_IP_LABEL X:PARENT_RIGHT - 200 - WIDTH - Y:50 + Y:230 Align:Right Width:70 Height:20 @@ -155,46 +159,14 @@ Background@JOINSERVER_BG: Label@SERVER_IP: Id:SERVER_IP X:PARENT_RIGHT - 195 - Y:50 - Align:Left - Width:70 - Height:20 - Label@SERVER_MODS_LABEL: - Id:SERVER_MODS_LABEL - X:PARENT_RIGHT - 200 - WIDTH - Y:70 - Align:Right - Width:70 - Height:20 - Text:Mods: - Bold:True - Label@SERVER_MODS: - Id:SERVER_MODS - X:PARENT_RIGHT - 195 - Y:70 - Align:Left - Width:70 - Height:20 - Label@MAP_TITLE_LABEL: - Id:MAP_TITLE_LABEL - X:PARENT_RIGHT - 200 - WIDTH - Y:90 - Align:Right - Width:70 - Height:20 - Text:Map: - Bold:True - Label@MAP_TITLE: - Id:MAP_TITLE - X:PARENT_RIGHT - 195 - Y:90 + Y:230 Align:Left Width:70 Height:20 Label@MAP_PLAYERS_LABEL: Id:MAP_PLAYERS_LABEL X:PARENT_RIGHT - 200 - WIDTH - Y:110 + Y:250 Align:Right Width:70 Height:20 @@ -203,16 +175,43 @@ Background@JOINSERVER_BG: Label@MAP_PLAYERS: Id:MAP_PLAYERS X:PARENT_RIGHT - 195 - Y:110 + Y:250 Align:Left Width:70 Height:20 - MapPreview@MAP_PREVIEW: - Id:MAP_PREVIEW - X:PARENT_RIGHT-241 - Y:140 - Width:192 - Height:192 + Label@MAP_TITLE_LABEL: + Id:MAP_TITLE_LABEL + X:PARENT_RIGHT - 200 - WIDTH + Y:270 + Align:Right + Width:70 + Height:20 + Text:Map: + Bold:True + Label@MAP_TITLE: + Id:MAP_TITLE + X:PARENT_RIGHT - 195 + Y:270 + Align:Left + Width:70 + Height:20 + Label@SERVER_MODS_LABEL: + Id:SERVER_MODS_LABEL + X:PARENT_RIGHT - 200 - WIDTH + Y:290 + Align:Right + Width:70 + Height:20 + Text:Mods: + Bold:True + Label@SERVER_MODS: + Id:SERVER_MODS + X:PARENT_RIGHT - 195 + Y:293 + Align:Left + VAlign:Top + Width:70 + Height:20 Button@DIRECTCONNECT_BUTTON: Id:DIRECTCONNECT_BUTTON X:20 @@ -252,7 +251,6 @@ Background@DIRECTCONNECT_BG: Y:(WINDOW_BOTTOM - HEIGHT)/2 Width:400 Height:155 - Visible:true Children: Label@DIRECTCONNECT_LABEL_TITLE: Id:DIRECTCONNECT_LABEL_TITLE @@ -301,7 +299,6 @@ Background@CONNECTION_FAILED_BG: Y:(WINDOW_BOTTOM - HEIGHT)/2 Width:450 Height:150 - Visible:true Children: Label@CONNECTION_FAILED_TITLE: Id:CONNECTION_FAILED_TITLE @@ -343,7 +340,6 @@ Background@CONNECTING_BG: Y:(WINDOW_BOTTOM - HEIGHT)/2 Width:450 Height:150 - Visible:true Children: Label@CONNECTING_TITLE: Id:CONNECTING_TITLE @@ -369,4 +365,4 @@ Background@CONNECTING_BG: Width:160 Height:25 Text:Abort - Bold:True + Bold:True \ No newline at end of file