Delta-v/Content.Client/_DV/SmartFridge/SmartFridgeItem.xaml.cs

25 lines
640 B
C#

using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
namespace Content.Client._DV.SmartFridge;
[GenerateTypedNameReferences]
public sealed partial class SmartFridgeItem : BoxContainer
{
public Action? RemoveButtonPressed;
public SmartFridgeItem(EntityUid uid, string text)
{
RobustXamlLoader.Load(this);
EntityView.SetEntity(uid);
NameLabel.Text = text;
RemoveButton.OnPressed += _ => RemoveButtonPressed?.Invoke();
if (uid.IsValid())
RemoveButton.Visible = false;
}
}