Files
tbd-station-14/Content.Client/StationRecords/GeneralStationRecordConsoleBoundUserInterface.cs
nikthechampiongr c8b55e5e44 Record deletion (#27883)
* Allow for Station Records interface for aghosts to delete records

* Fix record consoles not working when there are more than 2 crew members.

HOW DID NOONE NOTICE THIS SOONER???

* Stop being unconventional
2024-05-12 17:07:54 +02:00

46 lines
1.2 KiB
C#

using Content.Shared.StationRecords;
namespace Content.Client.StationRecords;
public sealed class GeneralStationRecordConsoleBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private GeneralStationRecordConsoleWindow? _window = default!;
public GeneralStationRecordConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_window = new();
_window.OnKeySelected += key =>
SendMessage(new SelectStationRecord(key));
_window.OnFiltersChanged += (type, filterValue) =>
SendMessage(new SetStationRecordFilter(type, filterValue));
_window.OnDeleted += id => SendMessage(new DeleteStationRecord(id));
_window.OnClose += Close;
_window.OpenCentered();
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not GeneralStationRecordConsoleState cast)
return;
_window?.UpdateState(cast);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_window?.Close();
}
}