diff --git a/Content.Client/Lathe/UI/LatheMenu.xaml.cs b/Content.Client/Lathe/UI/LatheMenu.xaml.cs index 3b3d90293c..71b45fc7dc 100644 --- a/Content.Client/Lathe/UI/LatheMenu.xaml.cs +++ b/Content.Client/Lathe/UI/LatheMenu.xaml.cs @@ -157,6 +157,9 @@ public sealed partial class LatheMenu : DefaultWindow sb.Append(Loc.GetString("lathe-menu-tooltip-display", ("material", name), ("amount", amountText))); } + sb.Append('\n'); + sb.Append(Loc.GetString("lathe-menu-description-display", ("description", prototype.Description))); + var icon = prototype.Icon == null ? _spriteSystem.GetPrototypeIcon(prototype.Result).Default : _spriteSystem.Frame0(prototype.Icon); diff --git a/Content.Client/Lathe/UI/RecipeControl.xaml.cs b/Content.Client/Lathe/UI/RecipeControl.xaml.cs index 87ebd6e338..451a988765 100644 --- a/Content.Client/Lathe/UI/RecipeControl.xaml.cs +++ b/Content.Client/Lathe/UI/RecipeControl.xaml.cs @@ -12,18 +12,26 @@ public sealed partial class RecipeControl : Control { public Action? 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.ToolTip = tooltip; Button.Disabled = !canProduce; + TooltipText = tooltip; + Button.TooltipSupplier = SupplyTooltip; Button.OnPressed += (_) => { OnButtonPressed?.Invoke(recipe.ID); }; } + + private Control? SupplyTooltip(Control sender) + { + return new RecipeTooltip(TooltipText); + } } diff --git a/Content.Client/Lathe/UI/RecipeTooltip.xaml b/Content.Client/Lathe/UI/RecipeTooltip.xaml new file mode 100644 index 0000000000..8cb0ec507a --- /dev/null +++ b/Content.Client/Lathe/UI/RecipeTooltip.xaml @@ -0,0 +1,19 @@ + + + + + + + + + + diff --git a/Content.Client/Lathe/UI/RecipeTooltip.xaml.cs b/Content.Client/Lathe/UI/RecipeTooltip.xaml.cs new file mode 100644 index 0000000000..5d2e3ca081 --- /dev/null +++ b/Content.Client/Lathe/UI/RecipeTooltip.xaml.cs @@ -0,0 +1,20 @@ +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 RecipeTooltip : Control +{ + + public RecipeTooltip(string tooltip) + { + RobustXamlLoader.Load(this); + + RecipeTooltipLabel.SetMessage(tooltip); + } +} diff --git a/Resources/Locale/en-US/lathe/ui/lathe-menu.ftl b/Resources/Locale/en-US/lathe/ui/lathe-menu.ftl index 914bb64b4f..3ccdb2b0eb 100644 --- a/Resources/Locale/en-US/lathe/ui/lathe-menu.ftl +++ b/Resources/Locale/en-US/lathe/ui/lathe-menu.ftl @@ -7,6 +7,7 @@ lathe-menu-search-filter = Filter lathe-menu-amount = Amount: lathe-menu-material-display = {$material} ({$amount}) lathe-menu-tooltip-display = {$amount} of {$material} +lathe-menu-description-display = {$description} lathe-menu-material-amount = { $amount -> [1] {NATURALFIXED($amount, 2)} {$unit} *[other] {NATURALFIXED($amount, 2)} {MAKEPLURAL($unit)}