* Reapply "Remove some BUI boilerplate" (#30214)
This reverts commit cb0ba66be3.
* Fix gas tank
* Fix PA
* Fix microwave
* Comms console underwrap
* Fix rcd
* log wehs
55 lines
1.3 KiB
C#
55 lines
1.3 KiB
C#
using Content.Shared.Silicons.Borgs;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.UserInterface;
|
|
|
|
namespace Content.Client.Silicons.Borgs;
|
|
|
|
[UsedImplicitly]
|
|
public sealed class BorgBoundUserInterface : BoundUserInterface
|
|
{
|
|
[ViewVariables]
|
|
private BorgMenu? _menu;
|
|
|
|
public BorgBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
|
{
|
|
}
|
|
|
|
protected override void Open()
|
|
{
|
|
base.Open();
|
|
|
|
_menu = this.CreateWindow<BorgMenu>();
|
|
_menu.SetEntity(Owner);
|
|
|
|
_menu.BrainButtonPressed += () =>
|
|
{
|
|
SendMessage(new BorgEjectBrainBuiMessage());
|
|
};
|
|
|
|
_menu.EjectBatteryButtonPressed += () =>
|
|
{
|
|
SendMessage(new BorgEjectBatteryBuiMessage());
|
|
};
|
|
|
|
_menu.NameChanged += name =>
|
|
{
|
|
SendMessage(new BorgSetNameBuiMessage(name));
|
|
};
|
|
|
|
_menu.RemoveModuleButtonPressed += module =>
|
|
{
|
|
SendMessage(new BorgRemoveModuleBuiMessage(EntMan.GetNetEntity(module)));
|
|
};
|
|
}
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
{
|
|
base.UpdateState(state);
|
|
|
|
if (state is not BorgBuiState msg)
|
|
return;
|
|
_menu?.UpdateState(msg);
|
|
}
|
|
}
|