Add a total player count to the MP browser.
This commit is contained in:
@@ -53,6 +53,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
GameServer currentServer;
|
GameServer currentServer;
|
||||||
MapPreview currentMap;
|
MapPreview currentMap;
|
||||||
bool showNotices;
|
bool showNotices;
|
||||||
|
int playerCount;
|
||||||
|
|
||||||
enum SearchStatus { Fetching, Failed, NoGames, Hidden }
|
enum SearchStatus { Fetching, Failed, NoGames, Hidden }
|
||||||
|
|
||||||
@@ -218,6 +219,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var playersLabel = widget.GetOrNull<LabelWidget>("PLAYER_COUNT");
|
||||||
|
if (playersLabel != null)
|
||||||
|
{
|
||||||
|
var playersText = new CachedTransform<int, string>(c => c == 1 ? "1 Player Online" : c.ToString() + " Players Online");
|
||||||
|
playersLabel.IsVisible = () => playerCount != 0;
|
||||||
|
playersLabel.GetText = () => playersText.Update(playerCount);
|
||||||
|
}
|
||||||
|
|
||||||
mapPreview = widget.GetOrNull<MapPreviewWidget>("SELECTED_MAP_PREVIEW");
|
mapPreview = widget.GetOrNull<MapPreviewWidget>("SELECTED_MAP_PREVIEW");
|
||||||
if (mapPreview != null)
|
if (mapPreview != null)
|
||||||
mapPreview.Preview = () => currentMap;
|
mapPreview.Preview = () => currentMap;
|
||||||
@@ -512,6 +521,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
if (nextServerRow != null)
|
if (nextServerRow != null)
|
||||||
nextServerRow.OnClick();
|
nextServerRow.OnClick();
|
||||||
|
|
||||||
|
playerCount = games.Sum(g => g.Players);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -220,6 +220,13 @@ Container@MULTIPLAYER_PANEL:
|
|||||||
IgnoreMouseOver: True
|
IgnoreMouseOver: True
|
||||||
Children:
|
Children:
|
||||||
LogicTicker@ANIMATION:
|
LogicTicker@ANIMATION:
|
||||||
|
Label@PLAYER_COUNT:
|
||||||
|
X: 198
|
||||||
|
Y: PARENT_BOTTOM - 40
|
||||||
|
Width: 189
|
||||||
|
Height: 25
|
||||||
|
Align: Center
|
||||||
|
Font: Bold
|
||||||
Button@DIRECTCONNECT_BUTTON:
|
Button@DIRECTCONNECT_BUTTON:
|
||||||
X: 387
|
X: 387
|
||||||
Y: PARENT_BOTTOM - 40
|
Y: PARENT_BOTTOM - 40
|
||||||
|
|||||||
@@ -214,6 +214,13 @@ Background@MULTIPLAYER_PANEL:
|
|||||||
IgnoreMouseOver: True
|
IgnoreMouseOver: True
|
||||||
Children:
|
Children:
|
||||||
LogicTicker@ANIMATION:
|
LogicTicker@ANIMATION:
|
||||||
|
Label@PLAYER_COUNT:
|
||||||
|
X: 208
|
||||||
|
Y: PARENT_BOTTOM - HEIGHT - 20
|
||||||
|
Width: 190
|
||||||
|
Height: 25
|
||||||
|
Align: Center
|
||||||
|
Font: Bold
|
||||||
Button@DIRECTCONNECT_BUTTON:
|
Button@DIRECTCONNECT_BUTTON:
|
||||||
X: 398
|
X: 398
|
||||||
Y: PARENT_BOTTOM - HEIGHT - 20
|
Y: PARENT_BOTTOM - HEIGHT - 20
|
||||||
|
|||||||
Reference in New Issue
Block a user