diff --git a/Content.Client/Radio/Ui/HandheldRadioBoundUserInterface.cs b/Content.Client/Radio/Ui/HandheldRadioBoundUserInterface.cs new file mode 100644 index 00000000000..c16d1649026 --- /dev/null +++ b/Content.Client/Radio/Ui/HandheldRadioBoundUserInterface.cs @@ -0,0 +1,59 @@ +using Content.Shared.Radio; +using JetBrains.Annotations; +using Robust.Client.GameObjects; + +namespace Content.Client.Radio.Ui; + + +[UsedImplicitly] +public sealed class HandheldRadioBoundUserInterface : BoundUserInterface +{ + [ViewVariables] + private HandheldRadioMenu? _menu; + + public HandheldRadioBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + + } + + protected override void Open() + { + base.Open(); + + _menu = new(); + + _menu.OnMicPressed += enabled => + { + SendMessage(new ToggleHandheldRadioMicMessage(enabled)); + }; + _menu.OnSpeakerPressed += enabled => + { + SendMessage(new ToggleHandheldRadioSpeakerMessage(enabled)); + }; + _menu.OnFrequencyChanged += frequency => + { + SendMessage(new SelectHandheldRadioFrequencyMessage(frequency)); + }; + + _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 HandheldRadioBoundUIState msg) + return; + + _menu?.Update(msg); + } +} diff --git a/Content.Client/Radio/Ui/HandheldRadioMenu.xaml b/Content.Client/Radio/Ui/HandheldRadioMenu.xaml new file mode 100644 index 00000000000..3877d1ead23 --- /dev/null +++ b/Content.Client/Radio/Ui/HandheldRadioMenu.xaml @@ -0,0 +1,29 @@ + + + + + + +