Add tooltips to the password icon and player count.

This commit is contained in:
Paul Chote
2017-12-27 18:47:37 +00:00
committed by reaperrr
parent 0eaec5d861
commit ef680dbbfe
4 changed files with 49 additions and 9 deletions

View File

@@ -635,7 +635,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
password.GetImageName = () => canJoin ? "protected" : "protected-disabled";
}
var players = item.GetOrNull<LabelWidget>("PLAYERS");
var players = item.GetOrNull<LabelWithTooltipWidget>("PLAYERS");
if (players != null)
{
var label = "{0} / {1}".F(game.Players + game.Bots, game.MaxPlayers + game.Bots)
@@ -644,6 +644,20 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var color = canJoin ? players.TextColor : incompatibleGameColor;
players.GetText = () => label;
players.GetColor = () => color;
if (game.Clients.Any())
{
var displayClients = game.Clients.Select(c => c.Name);
if (game.Clients.Length > 10)
displayClients = displayClients
.Take(9)
.Append("+ {0} other players".F(game.Clients.Length - 9));
var tooltip = displayClients.JoinWith("\n");
players.GetTooltipText = () => tooltip;
}
else
players.GetTooltipText = null;
}
var state = item.GetOrNull<LabelWidget>("STATUS");