Files
tbd-station-14/Content.Client/Power/PowerCharge/PowerChargeBoundUserInterface.cs
Julian Giebel 417d3a87a2 Station Anchor (#26098)
* Work on abstracting out chargeup functionality/ui from grav gen

* Work on station anchor

* Finish implementing station anchors

* uhh yeah

* ok.

* fix tests

* whoops

* Get the last extraneous yaml fail

* PJB review

* beast mode... ACTIVATE!

---------

Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
Co-authored-by: EmoGarbage404 <retron404@gmail.com>
2024-08-31 10:40:28 -04:00

39 lines
1002 B
C#

using Content.Shared.Power;
using Robust.Client.UserInterface;
namespace Content.Client.Power.PowerCharge;
public sealed class PowerChargeBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private PowerChargeWindow? _window;
public PowerChargeBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
public void SetPowerSwitch(bool on)
{
SendMessage(new SwitchChargingMachineMessage(on));
}
protected override void Open()
{
base.Open();
if (!EntMan.TryGetComponent(Owner, out PowerChargeComponent? component))
return;
_window = this.CreateWindow<PowerChargeWindow>();
_window.UpdateWindow(this, Loc.GetString(component.WindowTitle));
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not PowerChargeState chargeState)
return;
_window?.UpdateState(chargeState);
}
}