* Start work on stripping. * more strippable work * Stripping works * Nullable * MORE NULLABLE * nullable moment * life is pain * Interaction check. * Update Content.Client/GameObjects/Components/HUD/Inventory/StrippableBoundUserInterface.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Client/GameObjects/Components/HUD/Inventory/StrippableBoundUserInterface.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/HandsComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/HandsComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/HandsComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/StrippableComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/StrippableComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/HandsComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/StrippableComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/StrippableComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Shared/GameObjects/Components/GUI/SharedStrippableComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Server/GameObjects/Components/GUI/StrippableComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Rename InventoryComponent and HandsComponent's OnChanged event to OnItemChanged * Apply suggestions from code review Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Use static EquipmentSlotDefines * Do not expose ContainerSlot on Inventory or Hands. Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
65 lines
1.7 KiB
C#
65 lines
1.7 KiB
C#
using System;
|
|
using Content.Client.UserInterface.Stylesheets;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Maths;
|
|
|
|
namespace Content.Client.UserInterface
|
|
{
|
|
public class StrippingMenu : SS14Window
|
|
{
|
|
protected override Vector2? CustomSize => new Vector2(400, 600);
|
|
|
|
private readonly VBoxContainer _vboxContainer;
|
|
|
|
public StrippingMenu(string title)
|
|
{
|
|
Title = title;
|
|
|
|
_vboxContainer = new VBoxContainer()
|
|
{
|
|
SizeFlagsVertical = SizeFlags.FillExpand,
|
|
SeparationOverride = 5,
|
|
};
|
|
|
|
Contents.AddChild(_vboxContainer);
|
|
}
|
|
|
|
public void ClearButtons()
|
|
{
|
|
_vboxContainer.DisposeAllChildren();
|
|
}
|
|
|
|
public void AddButton(string title, string name, Action<BaseButton.ButtonEventArgs> onPressed)
|
|
{
|
|
var button = new Button()
|
|
{
|
|
Text = name,
|
|
StyleClasses = { StyleBase.ButtonOpenRight }
|
|
};
|
|
|
|
button.OnPressed += onPressed;
|
|
|
|
_vboxContainer.AddChild(new HBoxContainer()
|
|
{
|
|
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
|
SeparationOverride = 5,
|
|
Children =
|
|
{
|
|
new Label()
|
|
{
|
|
Text = $"{title}:"
|
|
},
|
|
new Control()
|
|
{
|
|
SizeFlagsHorizontal = SizeFlags.FillExpand
|
|
},
|
|
button,
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|