diff --git a/OpenRA.Mods.RA/Widgets/Logic/ClientTooltipLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ClientTooltipLogic.cs index 7dbef343b5..68d040034c 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ClientTooltipLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ClientTooltipLogic.cs @@ -27,6 +27,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic var latency = widget.Get("LATENCY"); var latencyFont = Game.Renderer.Fonts[latency.Font]; + var latencyPrefix = widget.Get("LATENCY_PREFIX"); + var latencyPrefixFont = Game.Renderer.Fonts[latencyPrefix.Font]; + var ip = widget.Get("IP"); var ipFont = Game.Renderer.Fonts[ip.Font]; @@ -43,8 +46,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic tooltipContainer.IsVisible = () => (orderManager.LobbyInfo.ClientWithIndex(clientIndex) != null); tooltipContainer.BeforeRender = () => { + var latencyPrefixSize = latencyPrefix.Bounds.X + latencyPrefixFont.Measure(latencyPrefix.GetText()+" ").X; var width = Math.Max(locationFont.Measure(location.GetText()).X, (Math.Max(adminFont.Measure(admin.GetText()).X, - Math.Max(ipFont.Measure(ip.GetText()).X, latencyFont.Measure(latency.GetText()).X)))); + Math.Max(ipFont.Measure(ip.GetText()).X, latencyPrefixSize + latencyFont.Measure(latency.GetText()).X)))); widget.Bounds.Width = width + 2 * margin; latency.Bounds.Width = widget.Bounds.Width; ip.Bounds.Width = widget.Bounds.Width; @@ -63,10 +67,13 @@ namespace OpenRA.Mods.RA.Widgets.Logic location.Bounds.Y += admin.Bounds.Height; widget.Bounds.Height += admin.Bounds.Height; } + + latencyPrefix.Bounds.Y = latency.Bounds.Y; + latency.Bounds.X = latencyPrefixSize; }; admin.IsVisible = () => orderManager.LobbyInfo.ClientWithIndex(clientIndex).IsAdmin; - latency.GetText = () => "Latency: {0}".F(LobbyUtils.LatencyDescription(orderManager.LobbyInfo.ClientWithIndex(clientIndex).Latency)); + latency.GetText = () => LobbyUtils.LatencyDescription(orderManager.LobbyInfo.ClientWithIndex(clientIndex).Latency); latency.GetColor = () => LobbyUtils.LatencyColor(orderManager.LobbyInfo.ClientWithIndex(clientIndex).Latency); var ipAddress = orderManager.LobbyInfo.ClientWithIndex(clientIndex).IpAddress; if ((ipAddress == null || ipAddress == "127.0.0.1") && UPnP.NatDevice != null) diff --git a/mods/cnc/chrome/tooltips.yaml b/mods/cnc/chrome/tooltips.yaml index 5bcc0b36be..9531f7d3e9 100644 --- a/mods/cnc/chrome/tooltips.yaml +++ b/mods/cnc/chrome/tooltips.yaml @@ -150,8 +150,13 @@ Background@CLIENT_TOOLTIP: Height:10 Font:TinyBold Align:Center - Label@LATENCY: + Label@LATENCY_PREFIX: + X:10 Y:29 Height:10 Font:TinyBold - Align:Center \ No newline at end of file + Text:Latency: + Label@LATENCY: + Y:29 + Height:10 + Font:TinyBold \ No newline at end of file diff --git a/mods/d2k/chrome/tooltips.yaml b/mods/d2k/chrome/tooltips.yaml index fdb8d346aa..7486ad1ed4 100644 --- a/mods/d2k/chrome/tooltips.yaml +++ b/mods/d2k/chrome/tooltips.yaml @@ -80,8 +80,13 @@ Background@CLIENT_TOOLTIP: Height:10 Font:TinyBold Align:Center - Label@LATENCY: + Label@LATENCY_PREFIX: + X:10 Y:31 Height:10 Font:TinyBold - Align:Center \ No newline at end of file + Text:Latency: + Label@LATENCY: + Y:31 + Height:10 + Font:TinyBold \ No newline at end of file diff --git a/mods/ra/chrome/tooltips.yaml b/mods/ra/chrome/tooltips.yaml index 4e824144ff..5fa419777d 100644 --- a/mods/ra/chrome/tooltips.yaml +++ b/mods/ra/chrome/tooltips.yaml @@ -80,8 +80,13 @@ Background@CLIENT_TOOLTIP: Height:10 Font:TinyBold Align:Center - Label@LATENCY: + Label@LATENCY_PREFIX: + X:10 Y:31 Height:10 Font:TinyBold - Align:Center \ No newline at end of file + Text:Latency: + Label@LATENCY: + Y:31 + Height:10 + Font:TinyBold \ No newline at end of file