Modified actor tooltips to include friendly name and internal name

This commit is contained in:
Dmitri Suvorov
2015-06-28 14:16:37 +03:00
parent e4f3a17477
commit 1fb03ad656
2 changed files with 6 additions and 3 deletions

View File

@@ -69,8 +69,8 @@ namespace OpenRA.Mods.Common.Traits
Footprint = new ReadOnlyDictionary<CPos, SubCell>(footprint);
}
var tooltipInfo = Info.Traits.GetOrDefault<ITooltipInfo>();
Tooltip = "{0} ({1})".F(tooltipInfo != null ? tooltipInfo.TooltipForPlayerStance(Stance.None) : Info.Name, ID);
var tooltip = Info.Traits.GetOrDefault<TooltipInfo>();
Tooltip = tooltip == null ? Info.Name + " - " + ID : tooltip.Name + " (" + Info.Name + ") - " + ID;
GeneratePreviews();

View File

@@ -135,7 +135,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
item.Bounds.Width = preview.Bounds.Width + 2 * preview.Bounds.X;
item.Bounds.Height = preview.Bounds.Height + 2 * preview.Bounds.Y;
item.IsVisible = () => true;
item.GetTooltipText = () => actor.Name;
var tooltip = actor.Traits.GetOrDefault<TooltipInfo>();
item.GetTooltipText = () => tooltip == null ? actor.Name : tooltip.Name + " (" + actor.Name + ")";
panel.AddChild(item);
}
catch