Files
tbd-station-14/Content.Client/Power/APC/ApcBoundUserInterface.cs
metalgearsloth cbf329a82d Remove some BUI boilerplate (#28399)
* 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
2024-07-20 15:40:16 +10:00

41 lines
1003 B
C#

using Content.Client.Power.APC.UI;
using Content.Shared.APC;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
namespace Content.Client.Power.APC
{
[UsedImplicitly]
public sealed class ApcBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private ApcMenu? _menu;
public ApcBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_menu = this.CreateWindow<ApcMenu>();
_menu.OnBreaker += BreakerPressed;
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
var castState = (ApcBoundInterfaceState) state;
_menu?.UpdateState(castState);
}
public void BreakerPressed()
{
SendMessage(new ApcToggleMainBreakerMessage());
}
}
}