Hide location and IP labels if not known.
This commit is contained in:
@@ -316,16 +316,30 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var nameFont = Game.Renderer.Fonts[nameLabel.Font];
|
||||
widget.Bounds.Width = nameFont.Measure(nameLabel.Text).X + 2 * nameLabel.Bounds.Left;
|
||||
|
||||
var ipLabel = widget.Get<LabelWidget>("IP");
|
||||
ipLabel.GetText = () => client.IpAddress;
|
||||
|
||||
var locationLabel = widget.Get<LabelWidget>("LOCATION");
|
||||
locationLabel.GetText = () => client.Location;
|
||||
var ipLabel = widget.Get<LabelWidget>("IP");
|
||||
var adminLabel = widget.Get("GAME_ADMIN");
|
||||
|
||||
if (client.Location != null)
|
||||
{
|
||||
locationLabel.IsVisible = () => true;
|
||||
locationLabel.GetText = () => client.Location;
|
||||
widget.Bounds.Height += locationLabel.Bounds.Height;
|
||||
ipLabel.Bounds.Y += locationLabel.Bounds.Height;
|
||||
adminLabel.Bounds.Y += locationLabel.Bounds.Height;
|
||||
}
|
||||
|
||||
if (client.IpAddress != null)
|
||||
{
|
||||
ipLabel.IsVisible = () => true;
|
||||
ipLabel.GetText = () => client.IpAddress;
|
||||
widget.Bounds.Height += ipLabel.Bounds.Height;
|
||||
adminLabel.Bounds.Y += locationLabel.Bounds.Height;
|
||||
}
|
||||
|
||||
if (client.IsAdmin)
|
||||
{
|
||||
var adminLabel = widget.Get("GAME_ADMIN");
|
||||
adminLabel.IsVisible = () => client.IsAdmin;
|
||||
adminLabel.IsVisible = () => true;
|
||||
widget.Bounds.Height += adminLabel.Bounds.Height;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user