Deep Space Com

This commit is contained in:
keslik
2025-03-05 11:30:37 +03:00
parent 5ae1b526ed
commit bc5583a128
11 changed files with 361 additions and 4 deletions

View File

@@ -0,0 +1,57 @@
using Content.Shared._White.DeepSpaceCom;
using JetBrains.Annotations;
namespace Content.Client._White.DeepSpaceCom;
[UsedImplicitly]
public sealed class DeepSpaceComBoundUI : BoundUserInterface
{
[ViewVariables]
private DeepSpaceComMenu? _menu;
public DeepSpaceComBoundUI(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_menu = new();
_menu.OnMicPressed += enabled =>
{
SendMessage(new ToggleDeepSpaceComMicrophoneMessage(enabled));
};
_menu.OnSpeakerPressed += enabled =>
{
SendMessage(new ToggleDeepSpaceComSpeakerMessage(enabled));
};
_menu.OnChannelSelected += channel =>
{
SendMessage(new SelectDeepSpaceComChannelMessage(channel));
};
_menu.OnClose += Close;
_menu.OpenCentered();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;
_menu?.Close();
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not DeepSpaceComBoundUIState msg)
return;
_menu?.Update(msg);
}
}