Show mod info in server browser
This commit is contained in:
@@ -44,7 +44,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
preview.IsVisible = () => CurrentMap() != null;
|
preview.IsVisible = () => CurrentMap() != null;
|
||||||
|
|
||||||
bg.GetWidget<LabelWidget>("SERVER_IP").GetText = () => currentServer.Address;
|
bg.GetWidget<LabelWidget>("SERVER_IP").GetText = () => currentServer.Address;
|
||||||
bg.GetWidget<LabelWidget>("SERVER_MODS").GetText = () => string.Join(",", currentServer.Mods);
|
bg.GetWidget<LabelWidget>("SERVER_MODS").GetText = () => GenerateModsLabel();
|
||||||
bg.GetWidget<LabelWidget>("MAP_TITLE").GetText = () => (CurrentMap() != null) ? CurrentMap().Title : "Unknown";
|
bg.GetWidget<LabelWidget>("MAP_TITLE").GetText = () => (CurrentMap() != null) ? CurrentMap().Title : "Unknown";
|
||||||
bg.GetWidget<LabelWidget>("MAP_PLAYERS").GetText = () =>
|
bg.GetWidget<LabelWidget>("MAP_PLAYERS").GetText = () =>
|
||||||
{
|
{
|
||||||
@@ -121,6 +121,13 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
? null : Game.modData.AvailableMaps[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<GameServer> games)
|
void RefreshServerList(IEnumerable<GameServer> games)
|
||||||
{
|
{
|
||||||
var r = Widget.RootWidget;
|
var r = Widget.RootWidget;
|
||||||
|
|||||||
@@ -16,10 +16,12 @@ namespace OpenRA.Widgets
|
|||||||
public class LabelWidget : Widget
|
public class LabelWidget : Widget
|
||||||
{
|
{
|
||||||
public enum TextAlign { Left, Center, Right }
|
public enum TextAlign { Left, Center, Right }
|
||||||
|
public enum TextVAlign { Top, Middle, Bottom }
|
||||||
|
|
||||||
public string Text = null;
|
public string Text = null;
|
||||||
public string Background = null;
|
public string Background = null;
|
||||||
public TextAlign Align = TextAlign.Left;
|
public TextAlign Align = TextAlign.Left;
|
||||||
|
public TextVAlign VAlign = TextVAlign.Middle;
|
||||||
public bool Bold = false;
|
public bool Bold = false;
|
||||||
public Func<string> GetText;
|
public Func<string> GetText;
|
||||||
public Func<string> GetBackground;
|
public Func<string> GetBackground;
|
||||||
@@ -54,7 +56,13 @@ namespace OpenRA.Widgets
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int2 textSize = font.Measure(text);
|
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)
|
if (Align == TextAlign.Center)
|
||||||
position += new int2((Bounds.Width - textSize.X)/2, 0);
|
position += new int2((Bounds.Width - textSize.X)/2, 0);
|
||||||
|
|||||||
@@ -141,10 +141,16 @@ Background@JOINSERVER_BG:
|
|||||||
Height:PARENT_BOTTOM
|
Height:PARENT_BOTTOM
|
||||||
Visible:false
|
Visible:false
|
||||||
Children:
|
Children:
|
||||||
|
MapPreview@MAP_PREVIEW:
|
||||||
|
Id:MAP_PREVIEW
|
||||||
|
X:PARENT_RIGHT-241
|
||||||
|
Y:30
|
||||||
|
Width:192
|
||||||
|
Height:192
|
||||||
Label@SERVER_IP_LABEL:
|
Label@SERVER_IP_LABEL:
|
||||||
Id:SERVER_IP_LABEL
|
Id:SERVER_IP_LABEL
|
||||||
X:PARENT_RIGHT - 200 - WIDTH
|
X:PARENT_RIGHT - 200 - WIDTH
|
||||||
Y:50
|
Y:230
|
||||||
Align:Right
|
Align:Right
|
||||||
Width:70
|
Width:70
|
||||||
Height:20
|
Height:20
|
||||||
@@ -153,46 +159,14 @@ Background@JOINSERVER_BG:
|
|||||||
Label@SERVER_IP:
|
Label@SERVER_IP:
|
||||||
Id:SERVER_IP
|
Id:SERVER_IP
|
||||||
X:PARENT_RIGHT - 195
|
X:PARENT_RIGHT - 195
|
||||||
Y:50
|
Y:230
|
||||||
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
|
|
||||||
Align:Left
|
Align:Left
|
||||||
Width:70
|
Width:70
|
||||||
Height:20
|
Height:20
|
||||||
Label@MAP_PLAYERS_LABEL:
|
Label@MAP_PLAYERS_LABEL:
|
||||||
Id:MAP_PLAYERS_LABEL
|
Id:MAP_PLAYERS_LABEL
|
||||||
X:PARENT_RIGHT - 200 - WIDTH
|
X:PARENT_RIGHT - 200 - WIDTH
|
||||||
Y:110
|
Y:250
|
||||||
Align:Right
|
Align:Right
|
||||||
Width:70
|
Width:70
|
||||||
Height:20
|
Height:20
|
||||||
@@ -201,16 +175,43 @@ Background@JOINSERVER_BG:
|
|||||||
Label@MAP_PLAYERS:
|
Label@MAP_PLAYERS:
|
||||||
Id:MAP_PLAYERS
|
Id:MAP_PLAYERS
|
||||||
X:PARENT_RIGHT - 195
|
X:PARENT_RIGHT - 195
|
||||||
Y:110
|
Y:250
|
||||||
Align:Left
|
Align:Left
|
||||||
Width:70
|
Width:70
|
||||||
Height:20
|
Height:20
|
||||||
MapPreview@MAP_PREVIEW:
|
Label@MAP_TITLE_LABEL:
|
||||||
Id:MAP_PREVIEW
|
Id:MAP_TITLE_LABEL
|
||||||
X:PARENT_RIGHT-241
|
X:PARENT_RIGHT - 200 - WIDTH
|
||||||
Y:140
|
Y:270
|
||||||
Width:192
|
Align:Right
|
||||||
Height:192
|
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:
|
Button@DIRECTCONNECT_BUTTON:
|
||||||
Id:DIRECTCONNECT_BUTTON
|
Id:DIRECTCONNECT_BUTTON
|
||||||
X:20
|
X:20
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Metadata:
|
Metadata:
|
||||||
Title: Command & Conquer
|
Title: C&C
|
||||||
Description: OpenRA Reimagining of the classic game
|
Description: OpenRA Reimagining of the classic game
|
||||||
Version: a0001
|
Version: a0001
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ Background@CREATESERVER_BG:
|
|||||||
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||||
Width:400
|
Width:400
|
||||||
Height:240
|
Height:240
|
||||||
Visible:true
|
|
||||||
Children:
|
Children:
|
||||||
Label@LABEL_TITLE:
|
Label@LABEL_TITLE:
|
||||||
Id:LABEL_TITLE
|
Id:LABEL_TITLE
|
||||||
@@ -100,7 +99,6 @@ Background@JOINSERVER_BG:
|
|||||||
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||||
Width:700
|
Width:700
|
||||||
Height:410
|
Height:410
|
||||||
Visible:true
|
|
||||||
Children:
|
Children:
|
||||||
Label@JOINSERVER_LABEL_TITLE:
|
Label@JOINSERVER_LABEL_TITLE:
|
||||||
Id:JOINSERVER_LABEL_TITLE
|
Id:JOINSERVER_LABEL_TITLE
|
||||||
@@ -143,10 +141,16 @@ Background@JOINSERVER_BG:
|
|||||||
Height:PARENT_BOTTOM
|
Height:PARENT_BOTTOM
|
||||||
Visible:false
|
Visible:false
|
||||||
Children:
|
Children:
|
||||||
|
MapPreview@MAP_PREVIEW:
|
||||||
|
Id:MAP_PREVIEW
|
||||||
|
X:PARENT_RIGHT-241
|
||||||
|
Y:30
|
||||||
|
Width:192
|
||||||
|
Height:192
|
||||||
Label@SERVER_IP_LABEL:
|
Label@SERVER_IP_LABEL:
|
||||||
Id:SERVER_IP_LABEL
|
Id:SERVER_IP_LABEL
|
||||||
X:PARENT_RIGHT - 200 - WIDTH
|
X:PARENT_RIGHT - 200 - WIDTH
|
||||||
Y:50
|
Y:230
|
||||||
Align:Right
|
Align:Right
|
||||||
Width:70
|
Width:70
|
||||||
Height:20
|
Height:20
|
||||||
@@ -155,46 +159,14 @@ Background@JOINSERVER_BG:
|
|||||||
Label@SERVER_IP:
|
Label@SERVER_IP:
|
||||||
Id:SERVER_IP
|
Id:SERVER_IP
|
||||||
X:PARENT_RIGHT - 195
|
X:PARENT_RIGHT - 195
|
||||||
Y:50
|
Y:230
|
||||||
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
|
|
||||||
Align:Left
|
Align:Left
|
||||||
Width:70
|
Width:70
|
||||||
Height:20
|
Height:20
|
||||||
Label@MAP_PLAYERS_LABEL:
|
Label@MAP_PLAYERS_LABEL:
|
||||||
Id:MAP_PLAYERS_LABEL
|
Id:MAP_PLAYERS_LABEL
|
||||||
X:PARENT_RIGHT - 200 - WIDTH
|
X:PARENT_RIGHT - 200 - WIDTH
|
||||||
Y:110
|
Y:250
|
||||||
Align:Right
|
Align:Right
|
||||||
Width:70
|
Width:70
|
||||||
Height:20
|
Height:20
|
||||||
@@ -203,16 +175,43 @@ Background@JOINSERVER_BG:
|
|||||||
Label@MAP_PLAYERS:
|
Label@MAP_PLAYERS:
|
||||||
Id:MAP_PLAYERS
|
Id:MAP_PLAYERS
|
||||||
X:PARENT_RIGHT - 195
|
X:PARENT_RIGHT - 195
|
||||||
Y:110
|
Y:250
|
||||||
Align:Left
|
Align:Left
|
||||||
Width:70
|
Width:70
|
||||||
Height:20
|
Height:20
|
||||||
MapPreview@MAP_PREVIEW:
|
Label@MAP_TITLE_LABEL:
|
||||||
Id:MAP_PREVIEW
|
Id:MAP_TITLE_LABEL
|
||||||
X:PARENT_RIGHT-241
|
X:PARENT_RIGHT - 200 - WIDTH
|
||||||
Y:140
|
Y:270
|
||||||
Width:192
|
Align:Right
|
||||||
Height:192
|
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:
|
Button@DIRECTCONNECT_BUTTON:
|
||||||
Id:DIRECTCONNECT_BUTTON
|
Id:DIRECTCONNECT_BUTTON
|
||||||
X:20
|
X:20
|
||||||
@@ -252,7 +251,6 @@ Background@DIRECTCONNECT_BG:
|
|||||||
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||||
Width:400
|
Width:400
|
||||||
Height:155
|
Height:155
|
||||||
Visible:true
|
|
||||||
Children:
|
Children:
|
||||||
Label@DIRECTCONNECT_LABEL_TITLE:
|
Label@DIRECTCONNECT_LABEL_TITLE:
|
||||||
Id:DIRECTCONNECT_LABEL_TITLE
|
Id:DIRECTCONNECT_LABEL_TITLE
|
||||||
@@ -301,7 +299,6 @@ Background@CONNECTION_FAILED_BG:
|
|||||||
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||||
Width:450
|
Width:450
|
||||||
Height:150
|
Height:150
|
||||||
Visible:true
|
|
||||||
Children:
|
Children:
|
||||||
Label@CONNECTION_FAILED_TITLE:
|
Label@CONNECTION_FAILED_TITLE:
|
||||||
Id:CONNECTION_FAILED_TITLE
|
Id:CONNECTION_FAILED_TITLE
|
||||||
@@ -343,7 +340,6 @@ Background@CONNECTING_BG:
|
|||||||
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||||
Width:450
|
Width:450
|
||||||
Height:150
|
Height:150
|
||||||
Visible:true
|
|
||||||
Children:
|
Children:
|
||||||
Label@CONNECTING_TITLE:
|
Label@CONNECTING_TITLE:
|
||||||
Id:CONNECTING_TITLE
|
Id:CONNECTING_TITLE
|
||||||
|
|||||||
Reference in New Issue
Block a user