mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-02-15 03:31:30 +01:00
* Remove some BUI boilerplate - The disposals overrides got removed due to the helper method handling it. - Replace window creation with CreateWindow helper. - Fixed some stinky code which would cause exceptions. * More * moar * weh * done * More BUIs * More updates * weh * moar * look who it is * weh * merge * weh * fixes
66 lines
1.7 KiB
C#
66 lines
1.7 KiB
C#
using Content.Shared.Containers.ItemSlots;
|
|
using Content.Shared.Nuke;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.UserInterface;
|
|
|
|
namespace Content.Client.Nuke
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed class NukeBoundUserInterface : BoundUserInterface
|
|
{
|
|
[ViewVariables]
|
|
private NukeMenu? _menu;
|
|
|
|
public NukeBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
|
{
|
|
}
|
|
|
|
protected override void Open()
|
|
{
|
|
_menu = this.CreateWindow<NukeMenu>();
|
|
|
|
_menu.OnKeypadButtonPressed += i =>
|
|
{
|
|
SendMessage(new NukeKeypadMessage(i));
|
|
};
|
|
_menu.OnEnterButtonPressed += () =>
|
|
{
|
|
SendMessage(new NukeKeypadEnterMessage());
|
|
};
|
|
_menu.OnClearButtonPressed += () =>
|
|
{
|
|
SendMessage(new NukeKeypadClearMessage());
|
|
};
|
|
|
|
_menu.EjectButton.OnPressed += _ =>
|
|
{
|
|
SendMessage(new ItemSlotButtonPressedEvent(SharedNukeComponent.NukeDiskSlotId));
|
|
};
|
|
_menu.AnchorButton.OnPressed += _ =>
|
|
{
|
|
SendMessage(new NukeAnchorMessage());
|
|
};
|
|
_menu.ArmButton.OnPressed += _ =>
|
|
{
|
|
SendMessage(new NukeArmedMessage());
|
|
};
|
|
}
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
{
|
|
base.UpdateState(state);
|
|
|
|
if (_menu == null)
|
|
return;
|
|
|
|
switch (state)
|
|
{
|
|
case NukeUiState msg:
|
|
_menu.UpdateState(msg);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|