From 0c949d446add4ada8732a67d2690171cb134c77b Mon Sep 17 00:00:00 2001 From: ultradyper Date: Fri, 14 Aug 2026 15:09:29 +0000 Subject: [PATCH 1/5] =?UTF-8?q?add:=20=D0=9F=D0=BE=D1=80=D1=82=D0=B0=D1=82?= =?UTF-8?q?=D0=B8=D0=B2=D0=BD=D1=8B=D0=B5=20=D1=82=D0=B5=D0=BB=D0=B5=D1=84?= =?UTF-8?q?=D0=BE=D0=BD=D1=8B=20=D0=9A=D0=9C=D0=B0=20=D0=B8=20=D1=83=D1=82?= =?UTF-8?q?=D0=B8=D0=BB=D0=B8=D0=B7=D0=B0=D1=82=D0=BE=D1=80=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Client/ADT/Telephone/ADTPhoneBui.cs | 91 +++++++ .../ADT/Telephone/ADTPhoneWindow.xaml | 38 +++ .../ADT/Telephone/ADTPhoneWindow.xaml.cs | 15 ++ .../ADT/Telephone/ADTPhoneSystem.cs | 236 ++++++++++++++++++ .../ADT/Telephone/ADTPhoneComponent.cs | 20 ++ Content.Shared/ADT/Telephone/ADTPhoneUi.cs | 57 +++++ Resources/Audio/ADT/Phone/attributions.yml | 24 ++ Resources/Audio/ADT/Phone/phone_busy.ogg | Bin 0 -> 10191 bytes Resources/Audio/ADT/Phone/remote_hangup.ogg | Bin 0 -> 5348 bytes Resources/Audio/ADT/Phone/remote_pickup.ogg | Bin 0 -> 23617 bytes Resources/Audio/ADT/Phone/ring_outgoing.ogg | Bin 0 -> 29781 bytes Resources/Audio/ADT/Phone/telephone_ring.ogg | Bin 0 -> 34806 bytes .../Locale/en-US/ADT/telephone/phone.ftl | 12 + .../Locale/ru-RU/ADT/telephone/phone.ftl | 12 + .../ADT/Entities/Objects/Devices/phones.yml | 43 ++++ .../Devices/phone.rsi/inhand-left-ear.png | Bin 0 -> 382 bytes .../Objects/Devices/phone.rsi/inhand-left.png | Bin 0 -> 397 bytes .../Devices/phone.rsi/inhand-right-ear.png | Bin 0 -> 413 bytes .../Devices/phone.rsi/inhand-right.png | Bin 0 -> 409 bytes .../ADT/Objects/Devices/phone.rsi/meta.json | 33 +++ .../Objects/Devices/phone.rsi/rpb_phone.png | Bin 0 -> 376 bytes .../Devices/phone.rsi/scout_microphone.png | Bin 0 -> 395 bytes 22 files changed, 581 insertions(+) create mode 100644 Content.Client/ADT/Telephone/ADTPhoneBui.cs create mode 100644 Content.Client/ADT/Telephone/ADTPhoneWindow.xaml create mode 100644 Content.Client/ADT/Telephone/ADTPhoneWindow.xaml.cs create mode 100644 Content.Server/ADT/Telephone/ADTPhoneSystem.cs create mode 100644 Content.Shared/ADT/Telephone/ADTPhoneComponent.cs create mode 100644 Content.Shared/ADT/Telephone/ADTPhoneUi.cs create mode 100644 Resources/Audio/ADT/Phone/attributions.yml create mode 100644 Resources/Audio/ADT/Phone/phone_busy.ogg create mode 100644 Resources/Audio/ADT/Phone/remote_hangup.ogg create mode 100644 Resources/Audio/ADT/Phone/remote_pickup.ogg create mode 100644 Resources/Audio/ADT/Phone/ring_outgoing.ogg create mode 100644 Resources/Audio/ADT/Phone/telephone_ring.ogg create mode 100644 Resources/Locale/en-US/ADT/telephone/phone.ftl create mode 100644 Resources/Locale/ru-RU/ADT/telephone/phone.ftl create mode 100644 Resources/Prototypes/ADT/Entities/Objects/Devices/phones.yml create mode 100644 Resources/Textures/ADT/Objects/Devices/phone.rsi/inhand-left-ear.png create mode 100644 Resources/Textures/ADT/Objects/Devices/phone.rsi/inhand-left.png create mode 100644 Resources/Textures/ADT/Objects/Devices/phone.rsi/inhand-right-ear.png create mode 100644 Resources/Textures/ADT/Objects/Devices/phone.rsi/inhand-right.png create mode 100644 Resources/Textures/ADT/Objects/Devices/phone.rsi/meta.json create mode 100644 Resources/Textures/ADT/Objects/Devices/phone.rsi/rpb_phone.png create mode 100644 Resources/Textures/ADT/Objects/Devices/phone.rsi/scout_microphone.png diff --git a/Content.Client/ADT/Telephone/ADTPhoneBui.cs b/Content.Client/ADT/Telephone/ADTPhoneBui.cs new file mode 100644 index 00000000000..f1ab56db61b --- /dev/null +++ b/Content.Client/ADT/Telephone/ADTPhoneBui.cs @@ -0,0 +1,91 @@ +using Content.Shared.ADT.Telephone; +using Robust.Client.UserInterface; +using Robust.Client.UserInterface.Controls; + +namespace Content.Client.ADT.Telephone; + +public sealed class ADTPhoneBui : BoundUserInterface +{ + private ADTPhoneWindow? _window; + private bool _dnd; + + public ADTPhoneBui(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + } + + protected override void Open() + { + base.Open(); + + // Reuse the window if it was somehow opened twice. + if (_window is { Disposed: false, IsOpen: true }) + return; + + _window = this.CreateWindow(); + if (EntMan.TryGetComponent(Owner, out MetaDataComponent? metaData)) + _window.Title = metaData.EntityName; + + _window.SearchBar.OnTextChanged += OnSearchChanged; + _window.AnswerButton.OnPressed += _ => SendMessage(new ADTPhoneAnswerMsg()); + _window.HangUpButton.OnPressed += _ => SendMessage(new ADTPhoneHangUpMsg()); + _window.DndButton.OnPressed += _ => SendMessage(new ADTPhoneDndMsg(!_dnd)); + + Refresh(); + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + Refresh(); + } + + private void OnSearchChanged(LineEdit.LineEditEventArgs args) + { + if (_window == null) + return; + + var text = args.Text; + foreach (var child in _window.PhonesList.Children) + { + if (child is Button button) + button.Visible = string.IsNullOrEmpty(text) || + button.Text?.Contains(text, StringComparison.OrdinalIgnoreCase) == true; + } + } + + private void Refresh() + { + if (_window is not { IsOpen: true } || State is not ADTPhoneBuiState state) + return; + + _dnd = state.Dnd; + + _window.PhonesList.DisposeAllChildren(); + + if (state.Phones.Count == 0) + { + _window.PhonesList.AddChild(new Label + { + Text = Loc.GetString("adt-phone-no-phones"), + HorizontalAlignment = Control.HAlignment.Center, + Margin = new Thickness(0, 8), + }); + } + + foreach (var phone in state.Phones) + { + var button = new Button + { + Text = phone.Name, + HorizontalExpand = true, + StyleClasses = { "OpenBoth" }, + }; + var id = phone.Id; + button.OnPressed += _ => SendMessage(new ADTPhoneCallMsg(id)); + _window.PhonesList.AddChild(button); + } + + _window.AnswerButton.Visible = state.Ringing; + _window.HangUpButton.Visible = state.Engaged; + _window.DndButton.Text = Loc.GetString(state.Dnd ? "adt-phone-dnd-on" : "adt-phone-dnd-off"); + } +} diff --git a/Content.Client/ADT/Telephone/ADTPhoneWindow.xaml b/Content.Client/ADT/Telephone/ADTPhoneWindow.xaml new file mode 100644 index 00000000000..f53305bc440 --- /dev/null +++ b/Content.Client/ADT/Telephone/ADTPhoneWindow.xaml @@ -0,0 +1,38 @@ + + + + + + + +