using Content.Shared.Power; namespace Content.Client.Power; public sealed class PowerMonitoringConsoleBoundUserInterface : BoundUserInterface { [ViewVariables] private PowerMonitoringWindow? _menu; public PowerMonitoringConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) { } protected override void Open() { _menu = new PowerMonitoringWindow(this, Owner); _menu.OpenCentered(); _menu.OnClose += Close; } protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); var castState = (PowerMonitoringConsoleBoundInterfaceState) state; if (castState == null) return; EntMan.TryGetComponent(Owner, out var xform); _menu?.ShowEntites (castState.TotalSources, castState.TotalBatteryUsage, castState.TotalLoads, castState.AllEntries, castState.FocusSources, castState.FocusLoads, xform?.Coordinates); } public void SendPowerMonitoringConsoleMessage(NetEntity? netEntity, PowerMonitoringConsoleGroup group) { SendMessage(new PowerMonitoringConsoleMessage(netEntity, group)); } protected override void Dispose(bool disposing) { base.Dispose(disposing); if (!disposing) return; _menu?.Dispose(); } }