only colorize the LatencyDescription

not together with the prefix
This commit is contained in:
Matthias Mailänder
2013-08-09 20:34:38 +02:00
parent 685073fedd
commit c034715f69
4 changed files with 30 additions and 8 deletions

View File

@@ -27,6 +27,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var latency = widget.Get<LabelWidget>("LATENCY");
var latencyFont = Game.Renderer.Fonts[latency.Font];
var latencyPrefix = widget.Get<LabelWidget>("LATENCY_PREFIX");
var latencyPrefixFont = Game.Renderer.Fonts[latencyPrefix.Font];
var ip = widget.Get<LabelWidget>("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)

View File

@@ -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
Text:Latency:
Label@LATENCY:
Y:29
Height:10
Font:TinyBold

View File

@@ -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
Text:Latency:
Label@LATENCY:
Y:31
Height:10
Font:TinyBold

View File

@@ -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
Text:Latency:
Label@LATENCY:
Y:31
Height:10
Font:TinyBold