fish-station/Content.Client/_Sunrise/Synth/SynthMonitorBoundUserInterface.cs
Vigers Ray 5775d4cdef
Merge sunrise build (#2)
* commit
2024-05-31 02:16:18 +03:00

50 lines
1.1 KiB
C#

using Content.Shared.Synth.Components;
using JetBrains.Annotations;
namespace Content.Client._Sunrise.Synth;
[UsedImplicitly]
public sealed class SynthMonitorBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private SynthMonitorMenu? _menu;
public SynthMonitorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_menu = new SynthMonitorMenu();
_menu.OnClose += Close;
_menu.OnIdSelected += OnIdSelected;
_menu.OpenCentered();
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not SynthScreenBoundUserInterfaceState st)
return;
_menu?.UpdateState(st.ScreenList);
}
private void OnIdSelected(string selectedId)
{
SendMessage(new SynthScreenPrototypeSelectedMessage(selectedId));
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
_menu?.Close();
_menu = null;
}
}
}