diff --git a/Content.Client/Radio/Ui/IntercomBoundUserInterface.cs b/Content.Client/Radio/Ui/IntercomBoundUserInterface.cs new file mode 100644 index 0000000000..abbb1d58ec --- /dev/null +++ b/Content.Client/Radio/Ui/IntercomBoundUserInterface.cs @@ -0,0 +1,58 @@ +using Content.Shared.Radio; +using JetBrains.Annotations; +using Robust.Client.GameObjects; + +namespace Content.Client.Radio.Ui; + +[UsedImplicitly] +public sealed class IntercomBoundUserInterface : BoundUserInterface +{ + [ViewVariables] + private IntercomMenu? _menu; + + public IntercomBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + + } + + protected override void Open() + { + base.Open(); + + _menu = new(); + + _menu.OnMicPressed += enabled => + { + SendMessage(new ToggleIntercomMicMessage(enabled)); + }; + _menu.OnSpeakerPressed += enabled => + { + SendMessage(new ToggleIntercomSpeakerMessage(enabled)); + }; + _menu.OnChannelSelected += channel => + { + SendMessage(new SelectIntercomChannelMessage(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 IntercomBoundUIState msg) + return; + + _menu?.Update(msg); + } +} diff --git a/Content.Client/Radio/Ui/IntercomMenu.xaml b/Content.Client/Radio/Ui/IntercomMenu.xaml new file mode 100644 index 0000000000..aed4fc754e --- /dev/null +++ b/Content.Client/Radio/Ui/IntercomMenu.xaml @@ -0,0 +1,31 @@ + + + + + + + + +