Added tooltip to support powers in spec ui

This commit is contained in:
teinarss
2019-05-23 18:27:50 +02:00
committed by Paul Chote
parent 12484caf04
commit c89f4b7a76
8 changed files with 113 additions and 6 deletions

View File

@@ -57,6 +57,7 @@ namespace OpenRA.Mods.Common.Widgets
Dictionary<Rectangle, SupportPowerIcon> icons = new Dictionary<Rectangle, SupportPowerIcon>();
public SupportPowerIcon TooltipIcon { get; private set; }
public Func<SupportPowerIcon> GetTooltipIcon;
Lazy<TooltipContainerWidget> tooltipContainer;
HotkeyReference[] hotkeys;
@@ -92,6 +93,7 @@ namespace OpenRA.Mods.Common.Widgets
{
this.modData = modData;
this.worldRenderer = worldRenderer;
GetTooltipIcon = () => TooltipIcon;
spm = world.LocalPlayer.PlayerActor.Trait<SupportPowerManager>();
tooltipContainer = Exts.Lazy(() =>
Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
@@ -239,7 +241,7 @@ namespace OpenRA.Mods.Common.Widgets
return;
tooltipContainer.Value.SetTooltip(TooltipTemplate,
new WidgetArgs() { { "world", worldRenderer.World }, { "player", spm.Self.Owner }, { "palette", this } });
new WidgetArgs() { { "world", worldRenderer.World }, { "player", spm.Self.Owner }, { "getTooltipIcon", GetTooltipIcon } });
}
public override void MouseExited()