2021-09-19 18:59:55 +02:00
|
|
|
using Content.Shared.Gravity;
|
|
|
|
|
using JetBrains.Annotations;
|
2024-07-21 14:48:13 +10:00
|
|
|
using Robust.Client.UserInterface;
|
2021-09-19 18:59:55 +02:00
|
|
|
|
|
|
|
|
namespace Content.Client.Gravity.UI
|
|
|
|
|
{
|
|
|
|
|
[UsedImplicitly]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class GravityGeneratorBoundUserInterface : BoundUserInterface
|
2021-09-19 18:59:55 +02:00
|
|
|
{
|
2023-07-08 09:02:17 -07:00
|
|
|
[ViewVariables]
|
2021-09-19 18:59:55 +02:00
|
|
|
private GravityGeneratorWindow? _window;
|
|
|
|
|
|
2023-07-08 09:02:17 -07:00
|
|
|
public GravityGeneratorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
2021-09-19 18:59:55 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Open()
|
|
|
|
|
{
|
|
|
|
|
base.Open();
|
|
|
|
|
|
2024-07-21 14:48:13 +10:00
|
|
|
_window = this.CreateWindow<GravityGeneratorWindow>();
|
|
|
|
|
_window.SetEntity(Owner);
|
2021-09-19 18:59:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
|
|
|
{
|
|
|
|
|
base.UpdateState(state);
|
|
|
|
|
|
|
|
|
|
var castState = (SharedGravityGeneratorComponent.GeneratorState) state;
|
2021-11-02 01:12:55 +01:00
|
|
|
_window?.UpdateState(castState);
|
2021-09-19 18:59:55 +02:00
|
|
|
}
|
|
|
|
|
|
2021-11-02 01:12:55 +01:00
|
|
|
public void SetPowerSwitch(bool on)
|
|
|
|
|
{
|
|
|
|
|
SendMessage(new SharedGravityGeneratorComponent.SwitchGeneratorMessage(on));
|
|
|
|
|
}
|
2021-09-19 18:59:55 +02:00
|
|
|
}
|
|
|
|
|
}
|