| 12345678910111213141516171819202122232425262728293031323334 |
- using Content.Shared.Research.Prototypes;
- using Robust.Client.AutoGenerated;
- using Robust.Client.UserInterface;
- using Robust.Client.UserInterface.XAML;
- namespace Content.Client.Lathe.UI;
- [GenerateTypedNameReferences]
- public sealed partial class RecipeControl : Control
- {
- public Action<string>? OnButtonPressed;
- public Func<string> TooltipTextSupplier;
- public RecipeControl(LatheSystem latheSystem, LatheRecipePrototype recipe, Func<string> tooltipTextSupplier, bool canProduce, Control displayControl)
- {
- RobustXamlLoader.Load(this);
- RecipeName.Text = latheSystem.GetRecipeName(recipe);
- RecipeDisplayContainer.AddChild(displayControl);
- Button.Disabled = !canProduce;
- TooltipTextSupplier = tooltipTextSupplier;
- Button.TooltipSupplier = SupplyTooltip;
- Button.OnPressed += (_) =>
- {
- OnButtonPressed?.Invoke(recipe.ID);
- };
- }
- private Control? SupplyTooltip(Control sender)
- {
- return new RecipeTooltip(TooltipTextSupplier());
- }
- }
|