Merge pull request #5115 from Mailaender/split-lobby-sync

Splitted LobbyInfo updates into smaller chunks
This commit is contained in:
Paul Chote
2014-05-17 18:37:36 +12:00
8 changed files with 317 additions and 90 deletions

View File

@@ -183,26 +183,32 @@ namespace OpenRA.Mods.RA.Widgets.Logic
orderManager.IssueOrder(Order.Command("spawn {0} {1}".F((playerToMove ?? orderManager.LocalClient).Index, selectedSpawn)));
}
public static Color LatencyColor(int latency)
public static Color LatencyColor(Session.ClientPing ping)
{
if (ping == null)
return Color.Gray;
// Levels set relative to the default order lag of 3 net ticks (360ms)
// TODO: Adjust this once dynamic lag is implemented
if (latency < 0)
if (ping.Latency < 0)
return Color.Gray;
if (latency < 300)
if (ping.Latency < 300)
return Color.LimeGreen;
if (latency < 600)
if (ping.Latency < 600)
return Color.Orange;
return Color.Red;
}
public static string LatencyDescription(int latency)
public static string LatencyDescription(Session.ClientPing ping)
{
if (latency < 0)
if (ping == null)
return "Unknown";
if (latency < 300)
if (ping.Latency < 0)
return "Unknown";
if (ping.Latency < 300)
return "Good";
if (latency < 600)
if (ping.Latency < 600)
return "Moderate";
return "Poor";
}
@@ -236,7 +242,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
block.IsVisible = () => visible;
if (visible)
block.Get<ColorBlockWidget>("LATENCY_COLOR").GetColor = () => LatencyColor(c.Latency);
block.Get<ColorBlockWidget>("LATENCY_COLOR").GetColor = () => LatencyColor(
orderManager.LobbyInfo.PingFromClient(c));
var tooltip = parent.Get<ClientTooltipRegionWidget>("CLIENT_REGION");
tooltip.IsVisible = () => visible;