Files
crystall-punk-14/Content.Client/Gravity/UI/GravityGeneratorBoundUserInterface.cs

39 lines
1.0 KiB
C#
Raw Normal View History

using Content.Shared.Gravity;
using JetBrains.Annotations;
using Robust.Client.UserInterface;
namespace Content.Client.Gravity.UI
{
[UsedImplicitly]
public sealed class GravityGeneratorBoundUserInterface : BoundUserInterface
{
2023-07-08 09:02:17 -07:00
[ViewVariables]
private GravityGeneratorWindow? _window;
2023-07-08 09:02:17 -07:00
public GravityGeneratorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_window = this.CreateWindow<GravityGeneratorWindow>();
_window.SetEntity(Owner);
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
var castState = (SharedGravityGeneratorComponent.GeneratorState) state;
_window?.UpdateState(castState);
}
public void SetPowerSwitch(bool on)
{
SendMessage(new SharedGravityGeneratorComponent.SwitchGeneratorMessage(on));
}
}
}