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);
{
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.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);
+ }
}
--- /dev/null
+<Control xmlns="https://spacestation14.io"
+ xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
+ MaxWidth="400">
+ <PanelContainer>
+ <PanelContainer.PanelOverride>
+ <gfx:StyleBoxFlat
+ BorderThickness="2"
+ BorderColor="#464966"
+ BackgroundColor="#25252A"
+ />
+ </PanelContainer.PanelOverride>
+ <BoxContainer
+ Orientation="Vertical"
+ RectClipContent="True"
+ Margin="4">
+ <RichTextLabel Name="RecipeTooltipLabel" HorizontalExpand="True" />
+ </BoxContainer>
+ </PanelContainer>
+</Control>
--- /dev/null
+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);
+ }
+}
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)}