Remove legacy tooltip code.

This commit is contained in:
Paul Chote
2013-04-25 12:13:31 +12:00
parent ba2704291a
commit a1d2229a58
3 changed files with 0 additions and 17 deletions

View File

@@ -24,7 +24,6 @@ namespace OpenRA.Widgets
public Func<Map> Map = () => null; public Func<Map> Map = () => null;
public Func<Dictionary<int2, Session.Client>> SpawnClients = () => new Dictionary<int2, Session.Client>(); public Func<Dictionary<int2, Session.Client>> SpawnClients = () => new Dictionary<int2, Session.Client>();
public Action<MouseInput> OnMouseDown = _ => {}; public Action<MouseInput> OnMouseDown = _ => {};
public Action<int, int2> OnTooltip = (_, __) => { };
public bool IgnoreMouseInput = false; public bool IgnoreMouseInput = false;
public bool ShowSpawnPoints = true; public bool ShowSpawnPoints = true;
@@ -147,13 +146,7 @@ namespace OpenRA.Widgets
Game.Renderer.RgbaSpriteRenderer.DrawSprite(sprite, pos + offset); Game.Renderer.RgbaSpriteRenderer.DrawSprite(sprite, pos + offset);
if ((pos - Viewport.LastMousePos).LengthSquared < 64) if ((pos - Viewport.LastMousePos).LengthSquared < 64)
{
TooltipSpawnIndex = spawnPoints.IndexOf(p) + 1; TooltipSpawnIndex = spawnPoints.IndexOf(p) + 1;
// Legacy tooltip behavior
if (TooltipContainer == null)
OnTooltip(TooltipSpawnIndex, pos);
}
} }
} }
} }

View File

@@ -112,7 +112,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
mapPreview.IsVisible = () => Map != null; mapPreview.IsVisible = () => Map != null;
mapPreview.Map = () => Map; mapPreview.Map = () => Map;
mapPreview.OnMouseDown = mi => LobbyUtils.SelectSpawnPoint( orderManager, mapPreview, Map, mi ); mapPreview.OnMouseDown = mi => LobbyUtils.SelectSpawnPoint( orderManager, mapPreview, Map, mi );
mapPreview.OnTooltip = (spawnPoint, pos) => LobbyUtils.ShowSpawnPointTooltip(orderManager, spawnPoint, pos);
mapPreview.SpawnClients = () => LobbyUtils.GetSpawnClients(orderManager, Map); mapPreview.SpawnClients = () => LobbyUtils.GetSpawnClients(orderManager, Map);
var mapTitle = lobby.GetOrNull<LabelWidget>("MAP_TITLE"); var mapTitle = lobby.GetOrNull<LabelWidget>("MAP_TITLE");

View File

@@ -158,15 +158,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
} }
} }
public static void ShowSpawnPointTooltip(OrderManager orderManager, int spawnPoint, int2 position)
{
var client = orderManager.LobbyInfo.Clients.FirstOrDefault(c => c.SpawnPoint == spawnPoint);
if (client != null)
{
Game.Renderer.Fonts["Bold"].DrawTextWithContrast(client.Name, position + new int2(5, 5), Color.White, Color.Black, 1);
}
}
static Color GetPingColor(Session.Client c) static Color GetPingColor(Session.Client c)
{ {
if (c.Ping < 0) // Ping unknown if (c.Ping < 0) // Ping unknown