diff --git a/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs index d04940495c..ea34267804 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs @@ -53,6 +53,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic GameServer currentServer; MapPreview currentMap; bool showNotices; + int playerCount; enum SearchStatus { Fetching, Failed, NoGames, Hidden } @@ -218,6 +219,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic } } + var playersLabel = widget.GetOrNull("PLAYER_COUNT"); + if (playersLabel != null) + { + var playersText = new CachedTransform(c => c == 1 ? "1 Player Online" : c.ToString() + " Players Online"); + playersLabel.IsVisible = () => playerCount != 0; + playersLabel.GetText = () => playersText.Update(playerCount); + } + mapPreview = widget.GetOrNull("SELECTED_MAP_PREVIEW"); if (mapPreview != null) mapPreview.Preview = () => currentMap; @@ -512,6 +521,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (nextServerRow != null) nextServerRow.OnClick(); + + playerCount = games.Sum(g => g.Players); }); } diff --git a/mods/cnc/chrome/multiplayer-browser.yaml b/mods/cnc/chrome/multiplayer-browser.yaml index 3ebce6fcc7..c4e162995a 100644 --- a/mods/cnc/chrome/multiplayer-browser.yaml +++ b/mods/cnc/chrome/multiplayer-browser.yaml @@ -220,6 +220,13 @@ Container@MULTIPLAYER_PANEL: IgnoreMouseOver: True Children: LogicTicker@ANIMATION: + Label@PLAYER_COUNT: + X: 198 + Y: PARENT_BOTTOM - 40 + Width: 189 + Height: 25 + Align: Center + Font: Bold Button@DIRECTCONNECT_BUTTON: X: 387 Y: PARENT_BOTTOM - 40 diff --git a/mods/common/chrome/multiplayer-browser.yaml b/mods/common/chrome/multiplayer-browser.yaml index 7b4baa7bd7..875bf127e0 100644 --- a/mods/common/chrome/multiplayer-browser.yaml +++ b/mods/common/chrome/multiplayer-browser.yaml @@ -214,6 +214,13 @@ Background@MULTIPLAYER_PANEL: IgnoreMouseOver: True Children: LogicTicker@ANIMATION: + Label@PLAYER_COUNT: + X: 208 + Y: PARENT_BOTTOM - HEIGHT - 20 + Width: 190 + Height: 25 + Align: Center + Font: Bold Button@DIRECTCONNECT_BUTTON: X: 398 Y: PARENT_BOTTOM - HEIGHT - 20