Files
tbd-station-14/Content.Client/Lathe/UI/RecipeControl.xaml.cs
Justin 07f87f93d2 Add description in lathe recipe mouseover tooltip (#22621)
* Add description in lathe recipe mouseover tooltip

* Remove old tooltip
2023-12-16 21:06:38 -05:00

38 lines
988 B
C#

using Content.Shared.Research.Prototypes;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Graphics;
namespace Content.Client.Lathe.UI;
[GenerateTypedNameReferences]
public sealed partial class RecipeControl : Control
{
public Action<string>? OnButtonPressed;
public string TooltipText;
public RecipeControl(LatheRecipePrototype recipe, string tooltip, bool canProduce, Texture? texture = null)
{
RobustXamlLoader.Load(this);
RecipeName.Text = recipe.Name;
RecipeTexture.Texture = texture;
Button.Disabled = !canProduce;
TooltipText = tooltip;
Button.TooltipSupplier = SupplyTooltip;
Button.OnPressed += (_) =>
{
OnButtonPressed?.Invoke(recipe.ID);
};
}
private Control? SupplyTooltip(Control sender)
{
return new RecipeTooltip(TooltipText);
}
}