From 7c19a7d1de4e44c5da0760e7417a6898efabe8b6 Mon Sep 17 00:00:00 2001 From: eoineoineoin Date: Fri, 14 Aug 2026 18:38:21 +0000 Subject: [PATCH] Improve UX and visuals of communications console (#41899) * Implment mockup of comms console UI * Fix broadcast broken by 31823 * Separate announce/broadcast functionality * Tweak resizing behaviour; make window wider by default * Split up comms console into different widgets Makes each section of the UI easier to understand Apply some cleanup, renames, make consistent with style guide, etc. * Polishing, todos, missing pieces * Consolidate button border images. Allow more accent colours with geometric_panel_border * Resolve some TODOs, small polish * Fix warning * Revert modification to StripeBack Old texture relied on two stripe colours, had to replicate with only styles. Split out a new version with tweakable modulation * Make UI more boring * Some element shuffling, style changing * Remove some leftover changes * Remove more leftovers * Fix warnings * Feedback; remove unused bits, dependencies, formatting, highlight --- .../CommunicationsConsoleComponent.cs | 14 ++ ...CommunicationsConsoleBoundUserInterface.cs | 63 +++---- .../UI/CommunicationsConsoleMenu.xaml | 74 ++------ .../UI/CommunicationsConsoleMenu.xaml.cs | 159 +++++------------- .../UI/Widgets/AlertLevelControls.xaml | 22 +++ .../UI/Widgets/AlertLevelControls.xaml.cs | 146 ++++++++++++++++ .../UI/Widgets/MessagingControls.xaml | 30 ++++ .../UI/Widgets/MessagingControls.xaml.cs | 116 +++++++++++++ .../UI/Widgets/ShuttleControls.xaml | 31 ++++ .../UI/Widgets/ShuttleControls.xaml.cs | 67 ++++++++ .../communications-console-component.ftl | 33 +++- 11 files changed, 535 insertions(+), 220 deletions(-) create mode 100644 Content.Client/Communications/CommunicationsConsoleComponent.cs create mode 100644 Content.Client/Communications/UI/Widgets/AlertLevelControls.xaml create mode 100644 Content.Client/Communications/UI/Widgets/AlertLevelControls.xaml.cs create mode 100644 Content.Client/Communications/UI/Widgets/MessagingControls.xaml create mode 100644 Content.Client/Communications/UI/Widgets/MessagingControls.xaml.cs create mode 100644 Content.Client/Communications/UI/Widgets/ShuttleControls.xaml create mode 100644 Content.Client/Communications/UI/Widgets/ShuttleControls.xaml.cs diff --git a/Content.Client/Communications/CommunicationsConsoleComponent.cs b/Content.Client/Communications/CommunicationsConsoleComponent.cs new file mode 100644 index 0000000000..5fdb2771da --- /dev/null +++ b/Content.Client/Communications/CommunicationsConsoleComponent.cs @@ -0,0 +1,14 @@ +using Content.Shared.Communications; +using Robust.Shared.Prototypes; + +namespace Content.Client.Communications; + +[RegisterComponent] +public sealed partial class CommunicationsConsoleComponent : SharedCommunicationsConsoleComponent +{ + /// + /// The prototype ID to use in the UI to show what entities a broadcast will display on + /// + [DataField] + public EntProtoId ScreenDisplayId = "Screen"; +} diff --git a/Content.Client/Communications/UI/CommunicationsConsoleBoundUserInterface.cs b/Content.Client/Communications/UI/CommunicationsConsoleBoundUserInterface.cs index 9366e3ad12..1a26ffd191 100644 --- a/Content.Client/Communications/UI/CommunicationsConsoleBoundUserInterface.cs +++ b/Content.Client/Communications/UI/CommunicationsConsoleBoundUserInterface.cs @@ -1,4 +1,4 @@ -using Content.Shared.CCVar; +using Content.Shared.CCVar; using Content.Shared.Chat; using Content.Shared.AlertLevel; using Content.Shared.Communications; @@ -23,41 +23,36 @@ public sealed partial class CommunicationsConsoleBoundUserInterface(EntityUid ow base.Open(); _menu = this.CreateWindow(); - _menu.OnAnnounce += AnnounceButtonPressed; - _menu.OnBroadcast += BroadcastButtonPressed; - _menu.OnAlertLevel += AlertLevelSelected; - _menu.OnEmergencyLevel += EmergencyShuttleButtonPressed; + _menu.OnRadioAnnounce += RadioAnnounceButtonPressed; + _menu.OnScreenBroadcast += ScreenBroadcastButtonPressed; + _menu.OnAlertLevelChanged += AlertLevelSelected; + _menu.OnShuttleCalled += CallShuttle; + _menu.OnShuttleRecalled += RecallShuttle; + + if (EntMan.TryGetComponent(Owner, out var console)) + { + _menu.SetBroadcastDisplayEntity(console.ScreenDisplayId); + } } public void AlertLevelSelected(ProtoId level) { - if (_menu!.AlertLevelSelectable) - { - // TODO: This does not work until the console UI is predicted and uses component states. - // Also someone decided to send BUI states regularly in an update loop, so this just gets randomly bulldozed until the message reaches the server. - // _menu.CurrentAlertLevel = level; - // _menu.AlertLevelSelectable = false; - // _menu.AlertLevelButton.Disabled = true; - SendMessage(new CommunicationsConsoleSelectAlertLevelMessage(level)); - } + // TODO: This does not work until the console UI is predicted and uses component states. + // Also someone decided to send BUI states regularly in an update loop, so this just gets randomly bulldozed until the message reaches the server. + // _menu.CurrentAlertLevel = level; + // _menu.AlertLevelSelectable = false; + // _menu.AlertLevelButton.Disabled = true; + SendMessage(new CommunicationsConsoleSelectAlertLevelMessage(level)); } - public void EmergencyShuttleButtonPressed() - { - if (_menu!.CountdownStarted) - RecallShuttle(); - else - CallShuttle(); - } - - public void AnnounceButtonPressed(string message) + public void RadioAnnounceButtonPressed(string message) { var maxLength = _cfg.GetCVar(CCVars.ChatMaxAnnouncementLength); var msg = SharedChatSystem.SanitizeAnnouncement(message, maxLength); SendMessage(new CommunicationsConsoleAnnounceMessage(msg)); } - public void BroadcastButtonPressed(string message) + public void ScreenBroadcastButtonPressed(string message) { SendMessage(new CommunicationsConsoleBroadcastMessage(message)); } @@ -87,23 +82,11 @@ public sealed partial class CommunicationsConsoleBoundUserInterface(EntityUid ow if (_menu != null) { - _menu.CanAnnounce = commsState.CanAnnounce; - _menu.CanBroadcast = commsState.CanBroadcast; - _menu.CanCall = commsState.CanCall; - _menu.CountdownStarted = commsState.CountdownStarted; - _menu.CountdownEnd = commsState.ExpectedCountdownEnd; + var currentAlertLevel = alertComp.CurrentAlertLevel; + var selectableAlertLevels = _alertLevel.GetSelectableAlertLevels((stationUid.Value, alertComp)); + var canChangeAlertLevel = _alertLevel.CanChangeAlertLevel((stationUid.Value, alertComp)); - _menu.CurrentAlertLevel = alertComp.CurrentAlertLevel; - _menu.SelectableAlertLevels = _alertLevel.GetSelectableAlertLevels((stationUid.Value, alertComp)); - _menu.AlertLevelSelectable = _alertLevel.CanChangeAlertLevel((stationUid.Value, alertComp)); - - _menu.UpdateCountdown(); - _menu.UpdateAlertLevels(); - - _menu.AlertLevelButton.Disabled = !_menu.AlertLevelSelectable; - _menu.EmergencyShuttleButton.Disabled = !_menu.CanCall; - _menu.AnnounceButton.Disabled = !_menu.CanAnnounce; - _menu.BroadcastButton.Disabled = !_menu.CanBroadcast; + _menu.UpdateState(commsState, currentAlertLevel, selectableAlertLevels, canChangeAlertLevel); } } } diff --git a/Content.Client/Communications/UI/CommunicationsConsoleMenu.xaml b/Content.Client/Communications/UI/CommunicationsConsoleMenu.xaml index b74df979cf..0104fe92d3 100644 --- a/Content.Client/Communications/UI/CommunicationsConsoleMenu.xaml +++ b/Content.Client/Communications/UI/CommunicationsConsoleMenu.xaml @@ -1,62 +1,24 @@ - + MinSize="400 654" SetWidth="450" + Title="{Loc 'comms-console-menu-title'}"> + + + + - - + - + + + - - + - - - -