Revert "Remove some BUI boilerplate" (#30214)

Revert "Remove some BUI boilerplate (#28399)"

This reverts commit cbf329a82d.
This commit is contained in:
Nemanja
2024-07-20 20:42:27 -04:00
committed by GitHub
parent 6d664c9157
commit cb0ba66be3
137 changed files with 1755 additions and 1096 deletions

View File

@@ -1,5 +1,4 @@
using Content.Shared.Power;
using Robust.Client.UserInterface;
namespace Content.Client.Power;
@@ -12,9 +11,9 @@ public sealed class PowerMonitoringConsoleBoundUserInterface : BoundUserInterfac
protected override void Open()
{
_menu = this.CreateWindow<PowerMonitoringWindow>();
_menu.SetEntity(Owner);
_menu.SendPowerMonitoringConsoleMessageAction += SendPowerMonitoringConsoleMessage;
_menu = new PowerMonitoringWindow(this, Owner);
_menu.OpenCentered();
_menu.OnClose += Close;
}
protected override void UpdateState(BoundUserInterfaceState state)
@@ -23,6 +22,9 @@ public sealed class PowerMonitoringConsoleBoundUserInterface : BoundUserInterfac
var castState = (PowerMonitoringConsoleBoundInterfaceState) state;
if (castState == null)
return;
EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
_menu?.ShowEntites
(castState.TotalSources,
@@ -38,4 +40,13 @@ public sealed class PowerMonitoringConsoleBoundUserInterface : BoundUserInterfac
{
SendMessage(new PowerMonitoringConsoleMessage(netEntity, group));
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;
_menu?.Dispose();
}
}