Add description in lathe recipe mouseover tooltip (#22621)
* Add description in lathe recipe mouseover tooltip * Remove old tooltip
This commit is contained in:
@@ -157,6 +157,9 @@ public sealed partial class LatheMenu : DefaultWindow
|
|||||||
sb.Append(Loc.GetString("lathe-menu-tooltip-display", ("material", name), ("amount", amountText)));
|
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
|
var icon = prototype.Icon == null
|
||||||
? _spriteSystem.GetPrototypeIcon(prototype.Result).Default
|
? _spriteSystem.GetPrototypeIcon(prototype.Result).Default
|
||||||
: _spriteSystem.Frame0(prototype.Icon);
|
: _spriteSystem.Frame0(prototype.Icon);
|
||||||
|
|||||||
@@ -12,18 +12,26 @@ public sealed partial class RecipeControl : Control
|
|||||||
{
|
{
|
||||||
public Action<string>? OnButtonPressed;
|
public Action<string>? OnButtonPressed;
|
||||||
|
|
||||||
|
public string TooltipText;
|
||||||
|
|
||||||
public RecipeControl(LatheRecipePrototype recipe, string tooltip, bool canProduce, Texture? texture = null)
|
public RecipeControl(LatheRecipePrototype recipe, string tooltip, bool canProduce, Texture? texture = null)
|
||||||
{
|
{
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
|
|
||||||
RecipeName.Text = recipe.Name;
|
RecipeName.Text = recipe.Name;
|
||||||
RecipeTexture.Texture = texture;
|
RecipeTexture.Texture = texture;
|
||||||
Button.ToolTip = tooltip;
|
|
||||||
Button.Disabled = !canProduce;
|
Button.Disabled = !canProduce;
|
||||||
|
TooltipText = tooltip;
|
||||||
|
Button.TooltipSupplier = SupplyTooltip;
|
||||||
|
|
||||||
Button.OnPressed += (_) =>
|
Button.OnPressed += (_) =>
|
||||||
{
|
{
|
||||||
OnButtonPressed?.Invoke(recipe.ID);
|
OnButtonPressed?.Invoke(recipe.ID);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Control? SupplyTooltip(Control sender)
|
||||||
|
{
|
||||||
|
return new RecipeTooltip(TooltipText);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
19
Content.Client/Lathe/UI/RecipeTooltip.xaml
Normal file
19
Content.Client/Lathe/UI/RecipeTooltip.xaml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<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>
|
||||||
20
Content.Client/Lathe/UI/RecipeTooltip.xaml.cs
Normal file
20
Content.Client/Lathe/UI/RecipeTooltip.xaml.cs
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ lathe-menu-search-filter = Filter
|
|||||||
lathe-menu-amount = Amount:
|
lathe-menu-amount = Amount:
|
||||||
lathe-menu-material-display = {$material} ({$amount})
|
lathe-menu-material-display = {$material} ({$amount})
|
||||||
lathe-menu-tooltip-display = {$amount} of {$material}
|
lathe-menu-tooltip-display = {$amount} of {$material}
|
||||||
|
lathe-menu-description-display = {$description}
|
||||||
lathe-menu-material-amount = { $amount ->
|
lathe-menu-material-amount = { $amount ->
|
||||||
[1] {NATURALFIXED($amount, 2)} {$unit}
|
[1] {NATURALFIXED($amount, 2)} {$unit}
|
||||||
*[other] {NATURALFIXED($amount, 2)} {MAKEPLURAL($unit)}
|
*[other] {NATURALFIXED($amount, 2)} {MAKEPLURAL($unit)}
|
||||||
|
|||||||
Reference in New Issue
Block a user