Hide location and IP labels if not known.
This commit is contained in:
@@ -87,7 +87,7 @@ namespace OpenRA.Network
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Unknown Location";
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -316,16 +316,30 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var nameFont = Game.Renderer.Fonts[nameLabel.Font];
|
var nameFont = Game.Renderer.Fonts[nameLabel.Font];
|
||||||
widget.Bounds.Width = nameFont.Measure(nameLabel.Text).X + 2 * nameLabel.Bounds.Left;
|
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");
|
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)
|
if (client.IsAdmin)
|
||||||
{
|
{
|
||||||
var adminLabel = widget.Get("GAME_ADMIN");
|
adminLabel.IsVisible = () => true;
|
||||||
adminLabel.IsVisible = () => client.IsAdmin;
|
|
||||||
widget.Bounds.Height += adminLabel.Bounds.Height;
|
widget.Bounds.Height += adminLabel.Bounds.Height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ Background@LATENCY_TOOLTIP:
|
|||||||
Background@ANONYMOUS_PLAYER_TOOLTIP:
|
Background@ANONYMOUS_PLAYER_TOOLTIP:
|
||||||
Logic: AnonymousProfileTooltipLogic
|
Logic: AnonymousProfileTooltipLogic
|
||||||
Background: panel-black
|
Background: panel-black
|
||||||
Height: 55
|
Height: 30
|
||||||
Width: 200
|
Width: 200
|
||||||
Children:
|
Children:
|
||||||
Label@NAME:
|
Label@NAME:
|
||||||
@@ -411,30 +411,31 @@ Background@ANONYMOUS_PLAYER_TOOLTIP:
|
|||||||
Font: MediumBold
|
Font: MediumBold
|
||||||
Label@LOCATION:
|
Label@LOCATION:
|
||||||
X: 5
|
X: 5
|
||||||
Y: 24
|
Y: 25
|
||||||
Height: 12
|
Height: 12
|
||||||
|
Visible: False
|
||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
Label@IP:
|
Label@IP:
|
||||||
X: 5
|
X: 5
|
||||||
Y: 37
|
Y: 25
|
||||||
Height: 12
|
Height: 12
|
||||||
|
Visible: False
|
||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
Container@GAME_ADMIN:
|
Container@GAME_ADMIN:
|
||||||
X: 5
|
X: 5
|
||||||
Y: 49
|
Y: 25
|
||||||
Height: 12
|
Height: 12
|
||||||
Visible: False
|
Visible: False
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
X: 1
|
X: 1
|
||||||
Y: 5
|
Y: 4
|
||||||
Width: 7
|
Width: 7
|
||||||
Height: 5
|
Height: 5
|
||||||
ImageCollection: lobby-bits
|
ImageCollection: lobby-bits
|
||||||
ImageName: admin
|
ImageName: admin
|
||||||
Label@LABEL:
|
Label@LABEL:
|
||||||
X: 10
|
X: 10
|
||||||
Y: 1
|
|
||||||
Height: 12
|
Height: 12
|
||||||
Text: Game Admin
|
Text: Game Admin
|
||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ Background@LATENCY_TOOLTIP:
|
|||||||
Background@ANONYMOUS_PLAYER_TOOLTIP:
|
Background@ANONYMOUS_PLAYER_TOOLTIP:
|
||||||
Logic: AnonymousProfileTooltipLogic
|
Logic: AnonymousProfileTooltipLogic
|
||||||
Background: dialog4
|
Background: dialog4
|
||||||
Height: 56
|
Height: 30
|
||||||
Width: 200
|
Width: 200
|
||||||
Children:
|
Children:
|
||||||
Label@NAME:
|
Label@NAME:
|
||||||
@@ -144,29 +144,31 @@ Background@ANONYMOUS_PLAYER_TOOLTIP:
|
|||||||
Font: MediumBold
|
Font: MediumBold
|
||||||
Label@LOCATION:
|
Label@LOCATION:
|
||||||
X: 7
|
X: 7
|
||||||
Y: 24
|
Y: 25
|
||||||
Height: 12
|
Height: 12
|
||||||
|
Visible: False
|
||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
Label@IP:
|
Label@IP:
|
||||||
X: 7
|
X: 7
|
||||||
Y: 37
|
Y: 25
|
||||||
Height: 12
|
Height: 12
|
||||||
|
Visible: False
|
||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
Container@GAME_ADMIN:
|
Container@GAME_ADMIN:
|
||||||
X: 7
|
X: 7
|
||||||
Y: 49
|
Y: 25
|
||||||
Height: 12
|
Height: 12
|
||||||
Visible: False
|
Visible: False
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
Y: 5
|
X: 1
|
||||||
|
Y: 4
|
||||||
Width: 7
|
Width: 7
|
||||||
Height: 5
|
Height: 5
|
||||||
ImageCollection: lobby-bits
|
ImageCollection: lobby-bits
|
||||||
ImageName: admin
|
ImageName: admin
|
||||||
Label@LABEL:
|
Label@LABEL:
|
||||||
X: 9
|
X: 10
|
||||||
Y: 1
|
|
||||||
Height: 12
|
Height: 12
|
||||||
Text: Game Admin
|
Text: Game Admin
|
||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
|
|||||||
@@ -133,32 +133,35 @@ Background@LATENCY_TOOLTIP:
|
|||||||
Background@ANONYMOUS_PLAYER_TOOLTIP:
|
Background@ANONYMOUS_PLAYER_TOOLTIP:
|
||||||
Logic: AnonymousProfileTooltipLogic
|
Logic: AnonymousProfileTooltipLogic
|
||||||
Background: dialog3
|
Background: dialog3
|
||||||
Height: 57
|
Height: 32
|
||||||
Width: 200
|
Width: 200
|
||||||
Children:
|
Children:
|
||||||
Label@NAME:
|
Label@NAME:
|
||||||
X: 7
|
X: 7
|
||||||
Y: 2
|
Y: 3
|
||||||
Text: Anonymous Player
|
Text: Anonymous Player
|
||||||
Height: 24
|
Height: 24
|
||||||
Font: MediumBold
|
Font: MediumBold
|
||||||
Label@LOCATION:
|
Label@LOCATION:
|
||||||
X: 7
|
X: 7
|
||||||
Y: 25
|
Y: 26
|
||||||
Height: 12
|
Height: 12
|
||||||
|
Visible: False
|
||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
Label@IP:
|
Label@IP:
|
||||||
X: 7
|
X: 7
|
||||||
Y: 38
|
Y: 26
|
||||||
Height: 12
|
Height: 12
|
||||||
|
Visible: False
|
||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
Container@GAME_ADMIN:
|
Container@GAME_ADMIN:
|
||||||
X: 7
|
X: 7
|
||||||
Y: 50
|
Y: 26
|
||||||
Height: 12
|
Height: 12
|
||||||
Visible: False
|
Visible: False
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
|
X: 1
|
||||||
Y: 4
|
Y: 4
|
||||||
Width: 7
|
Width: 7
|
||||||
Height: 5
|
Height: 5
|
||||||
@@ -166,7 +169,6 @@ Background@ANONYMOUS_PLAYER_TOOLTIP:
|
|||||||
ImageName: admin
|
ImageName: admin
|
||||||
Label@LABEL:
|
Label@LABEL:
|
||||||
X: 10
|
X: 10
|
||||||
Y: 3
|
|
||||||
Height: 12
|
Height: 12
|
||||||
Text: Game Admin
|
Text: Game Admin
|
||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
|
|||||||
Reference in New Issue
Block a user