* Reapply "Remove some BUI boilerplate" (#30214)
This reverts commit cb0ba66be3.
* Fix gas tank
* Fix PA
* Fix microwave
* Comms console underwrap
* Fix rcd
* log wehs
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using Content.Shared.SprayPainter;
|
|
using Content.Shared.SprayPainter.Components;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
namespace Content.Client.SprayPainter.UI;
|
|
|
|
public sealed class SprayPainterBoundUserInterface : BoundUserInterface
|
|
{
|
|
[ViewVariables]
|
|
private SprayPainterWindow? _window;
|
|
|
|
public SprayPainterBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
|
{
|
|
}
|
|
|
|
protected override void Open()
|
|
{
|
|
base.Open();
|
|
|
|
_window = this.CreateWindow<SprayPainterWindow>();
|
|
|
|
_window.OnSpritePicked = OnSpritePicked;
|
|
_window.OnColorPicked = OnColorPicked;
|
|
|
|
if (EntMan.TryGetComponent(Owner, out SprayPainterComponent? comp))
|
|
{
|
|
_window.Populate(EntMan.System<SprayPainterSystem>().Entries, comp.Index, comp.PickedColor, comp.ColorPalette);
|
|
}
|
|
}
|
|
|
|
private void OnSpritePicked(ItemList.ItemListSelectedEventArgs args)
|
|
{
|
|
SendMessage(new SprayPainterSpritePickedMessage(args.ItemIndex));
|
|
}
|
|
|
|
private void OnColorPicked(ItemList.ItemListSelectedEventArgs args)
|
|
{
|
|
var key = _window?.IndexToColorKey(args.ItemIndex);
|
|
SendMessage(new SprayPainterColorPickedMessage(key));
|
|
}
|
|
}
|