Files
crystall-punk-14/Content.Client/Anomaly/Ui/AnomalyGeneratorBoundUserInterface.cs

55 lines
1.2 KiB
C#
Raw Normal View History

2023-01-17 00:05:20 -05:00
using Content.Shared.Anomaly;
using Content.Shared.Gravity;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
2023-07-08 09:02:17 -07:00
namespace Content.Client.Anomaly.Ui;
2023-01-17 00:05:20 -05:00
[UsedImplicitly]
public sealed class AnomalyGeneratorBoundUserInterface : BoundUserInterface
{
private AnomalyGeneratorWindow? _window;
2023-07-08 09:02:17 -07:00
public AnomalyGeneratorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
2023-01-17 00:05:20 -05:00
{
}
protected override void Open()
{
base.Open();
2023-07-08 09:02:17 -07:00
_window = new(Owner);
2023-01-17 00:05:20 -05:00
_window.OpenCentered();
_window.OnClose += Close;
_window.OnGenerateButtonPressed += () =>
{
SendMessage(new AnomalyGeneratorGenerateButtonPressedEvent());
};
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not AnomalyGeneratorUserInterfaceState msg)
return;
_window?.UpdateState(msg);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing) return;
_window?.Dispose();
}
public void SetPowerSwitch(bool on)
{
SendMessage(new SharedGravityGeneratorComponent.SwitchGeneratorMessage(on));
}
}