diff --git a/OpenRA.Game/Network/GeoIP.cs b/OpenRA.Game/Network/GeoIP.cs index 44072720e6..f24f639398 100644 --- a/OpenRA.Game/Network/GeoIP.cs +++ b/OpenRA.Game/Network/GeoIP.cs @@ -87,7 +87,7 @@ namespace OpenRA.Network } } - return "Unknown Location"; + return null; } } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs index 70aeaaafbc..f08a5a6a2e 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs @@ -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("IP"); - ipLabel.GetText = () => client.IpAddress; - var locationLabel = widget.Get("LOCATION"); - locationLabel.GetText = () => client.Location; + var ipLabel = widget.Get("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; } } diff --git a/mods/cnc/chrome/tooltips.yaml b/mods/cnc/chrome/tooltips.yaml index a8526b5ba6..67824a1c30 100644 --- a/mods/cnc/chrome/tooltips.yaml +++ b/mods/cnc/chrome/tooltips.yaml @@ -400,7 +400,7 @@ Background@LATENCY_TOOLTIP: Background@ANONYMOUS_PLAYER_TOOLTIP: Logic: AnonymousProfileTooltipLogic Background: panel-black - Height: 55 + Height: 30 Width: 200 Children: Label@NAME: @@ -411,30 +411,31 @@ Background@ANONYMOUS_PLAYER_TOOLTIP: Font: MediumBold Label@LOCATION: X: 5 - Y: 24 + Y: 25 Height: 12 + Visible: False Font: TinyBold Label@IP: X: 5 - Y: 37 + Y: 25 Height: 12 + Visible: False Font: TinyBold Container@GAME_ADMIN: X: 5 - Y: 49 + Y: 25 Height: 12 Visible: False Children: Image@ICON: X: 1 - Y: 5 + Y: 4 Width: 7 Height: 5 ImageCollection: lobby-bits ImageName: admin Label@LABEL: X: 10 - Y: 1 Height: 12 Text: Game Admin Font: TinyBold diff --git a/mods/common/chrome/tooltips.yaml b/mods/common/chrome/tooltips.yaml index 4134425222..51ade8983f 100644 --- a/mods/common/chrome/tooltips.yaml +++ b/mods/common/chrome/tooltips.yaml @@ -133,7 +133,7 @@ Background@LATENCY_TOOLTIP: Background@ANONYMOUS_PLAYER_TOOLTIP: Logic: AnonymousProfileTooltipLogic Background: dialog4 - Height: 56 + Height: 30 Width: 200 Children: Label@NAME: @@ -144,29 +144,31 @@ Background@ANONYMOUS_PLAYER_TOOLTIP: Font: MediumBold Label@LOCATION: X: 7 - Y: 24 + Y: 25 Height: 12 + Visible: False Font: TinyBold Label@IP: X: 7 - Y: 37 + Y: 25 Height: 12 + Visible: False Font: TinyBold Container@GAME_ADMIN: X: 7 - Y: 49 + Y: 25 Height: 12 Visible: False Children: Image@ICON: - Y: 5 + X: 1 + Y: 4 Width: 7 Height: 5 ImageCollection: lobby-bits ImageName: admin Label@LABEL: - X: 9 - Y: 1 + X: 10 Height: 12 Text: Game Admin Font: TinyBold diff --git a/mods/d2k/chrome/tooltips.yaml b/mods/d2k/chrome/tooltips.yaml index 8a47d97c33..dee9331733 100644 --- a/mods/d2k/chrome/tooltips.yaml +++ b/mods/d2k/chrome/tooltips.yaml @@ -133,32 +133,35 @@ Background@LATENCY_TOOLTIP: Background@ANONYMOUS_PLAYER_TOOLTIP: Logic: AnonymousProfileTooltipLogic Background: dialog3 - Height: 57 + Height: 32 Width: 200 Children: Label@NAME: X: 7 - Y: 2 + Y: 3 Text: Anonymous Player Height: 24 Font: MediumBold Label@LOCATION: X: 7 - Y: 25 + Y: 26 Height: 12 + Visible: False Font: TinyBold Label@IP: X: 7 - Y: 38 + Y: 26 Height: 12 + Visible: False Font: TinyBold Container@GAME_ADMIN: X: 7 - Y: 50 + Y: 26 Height: 12 Visible: False Children: Image@ICON: + X: 1 Y: 4 Width: 7 Height: 5 @@ -166,7 +169,6 @@ Background@ANONYMOUS_PLAYER_TOOLTIP: ImageName: admin Label@LABEL: X: 10 - Y: 3 Height: 12 Text: Game Admin Font: TinyBold