Added tooltip to support powers in spec ui
This commit is contained in:
@@ -19,9 +19,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
public class SupportPowerTooltipLogic : ChromeLogic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public SupportPowerTooltipLogic(Widget widget, TooltipContainerWidget tooltipContainer, SupportPowersWidget palette, World world)
|
||||
public SupportPowerTooltipLogic(Widget widget, TooltipContainerWidget tooltipContainer, Func<SupportPowersWidget.SupportPowerIcon> getTooltipIcon, World world)
|
||||
{
|
||||
widget.IsVisible = () => palette.TooltipIcon != null && palette.TooltipIcon.Power.Info != null;
|
||||
widget.IsVisible = () => getTooltipIcon() != null && getTooltipIcon().Power.Info != null;
|
||||
var nameLabel = widget.Get<LabelWidget>("NAME");
|
||||
var hotkeyLabel = widget.Get<LabelWidget>("HOTKEY");
|
||||
var timeLabel = widget.Get<LabelWidget>("TIME");
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
tooltipContainer.BeforeRender = () =>
|
||||
{
|
||||
var icon = palette.TooltipIcon;
|
||||
var icon = getTooltipIcon();
|
||||
if (icon == null || icon.Power == null || icon.Power.Instances.Count == 0)
|
||||
return;
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
lastRemainingSeconds = remainingSeconds;
|
||||
};
|
||||
|
||||
timeLabel.GetColor = () => palette.TooltipIcon != null && !palette.TooltipIcon.Power.Active
|
||||
timeLabel.GetColor = () => getTooltipIcon() != null && !getTooltipIcon().Power.Active
|
||||
? Color.Red : Color.White;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user