* 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
39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using Content.Shared.Gravity;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.UserInterface;
|
|
|
|
namespace Content.Client.Gravity.UI
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed class GravityGeneratorBoundUserInterface : BoundUserInterface
|
|
{
|
|
[ViewVariables]
|
|
private GravityGeneratorWindow? _window;
|
|
|
|
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));
|
|
}
|
|
}
|
|
}
|