Revert "Remove some BUI boilerplate" (#30214)
Revert "Remove some BUI boilerplate (#28399)"
This reverts commit cbf329a82d.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Content.Shared.Power.Generator;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface;
|
||||
|
||||
namespace Content.Client.Power.Generator;
|
||||
|
||||
@@ -17,25 +16,10 @@ public sealed class PortableGeneratorBoundUserInterface : BoundUserInterface
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
_window = this.CreateWindow<GeneratorWindow>();
|
||||
_window.SetEntity(Owner);
|
||||
_window.OnState += args =>
|
||||
{
|
||||
if (args)
|
||||
{
|
||||
Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
};
|
||||
|
||||
_window.OnPower += SetTargetPower;
|
||||
_window.OnEjectFuel += EjectFuel;
|
||||
_window.OnSwitchOutput += SwitchOutput;
|
||||
_window = new GeneratorWindow(this, Owner);
|
||||
|
||||
_window.OpenCenteredLeft();
|
||||
_window.OnClose += Close;
|
||||
}
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
@@ -46,6 +30,11 @@ public sealed class PortableGeneratorBoundUserInterface : BoundUserInterface
|
||||
_window?.Update(msg);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
_window?.Dispose();
|
||||
}
|
||||
|
||||
public void SetTargetPower(int target)
|
||||
{
|
||||
SendMessage(new PortableGeneratorSetTargetPowerMessage(target));
|
||||
|
||||
Reference in New Issue
Block a user