6
StarHorizon_Public/Content.Client/_NF/Research/UI/MiniRecipeCardControl.xaml.cs
2025-11-12 10:55:00 +03:00

36 lines
1.3 KiB
C#

using Content.Client.Lathe;
using Content.Shared.Research.Prototypes;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Client._NF.Research.UI;
[GenerateTypedNameReferences]
public sealed partial class MiniRecipeCardControl : Control
{
public MiniRecipeCardControl(TechnologyPrototype technology, LatheRecipePrototype proto, IPrototypeManager prototypeManager, SpriteSystem sprite, LatheSystem lathe)
{
RobustXamlLoader.Load(this);
var discipline = prototypeManager.Index(technology.Discipline);
Background.ModulateSelfOverride = discipline.Color;
NameLabel.SetMessage(lathe.GetRecipeName(proto));
if (proto.Result.HasValue)
// Showcase.Texture = sprite.Frame0(prototypeManager.Index(proto.Result.Value)); // Frontier
Showcase.SetPrototype(proto.Result); // Frontier
if (proto.Description.HasValue)
{
var tooltip = new Tooltip();
tooltip.SetMessage(FormattedMessage.FromUnformatted(lathe.GetRecipeDescription(proto)));
Main.TooltipSupplier = _ => tooltip;
}
}
}