CatStation/Content.Client/Communications/UI/CommunicationsConsoleMenu.xaml.cs
Whatstone 041a7e6504
Scrolling text screens (#43997)
* Scrolling text screens

* remove ScrollingTextScreenComponent, fix comments

* shave a pixel off of the frame, commas cut off

* logMissing to false, state does may not exist

* variable timing, offset array serializer

* namespaces are a state of mind

* Use CustomArraySerializer instead of a one-off

* better alphabetize punctuation text

* Unneeded VV access, 4-space meta.json

* Subscription attributes

* cleanup pass

* shift left

* AJCM's suggestions

Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>

* PadRight returns a string.

* kill the loop, use funny division instead

* smoother animations, dark stripe on outer frame

* Update for the new comms console UI

* communications console changes

* can't spell pain without UI

* the ocho

* it's big brain time

* just a touch wider

* UI polish pass - forgive the sins

* look at my attributions dog

* EDITED

* Text screen layer init deferred until startup

* that's a new one

---------

Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>
2026-08-15 22:03:22 +00:00

62 lines
2.5 KiB
C#

using Content.Shared.AlertLevel;
using Content.Shared.Communications;
using Content.Client.UserInterface.Controls;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
namespace Content.Client.Communications.UI;
/// <summary>
/// The main menu for the communications console interface.
/// Contains a series of widgets for the alert, announce/broadcast and shuttle functions.
/// </summary>
[GenerateTypedNameReferences]
public sealed partial class CommunicationsConsoleMenu : FancyWindow
{
public event Action? OnShuttleCalled;
public event Action? OnShuttleRecalled;
public event Action<ProtoId<AlertLevelPrototype>>? OnAlertLevelChanged;
public event Action<string>? OnRadioAnnounce;
public event Action<string>? OnScreenBroadcast;
public CommunicationsConsoleMenu()
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);
MessagingControls.OnRadioAnnounce += message => OnRadioAnnounce?.Invoke(message);
MessagingControls.OnScreenBroadcast += message => OnScreenBroadcast?.Invoke(message);
AlertLevelControls.OnAlertLevelChanged += newLevel => OnAlertLevelChanged?.Invoke(newLevel);
ShuttleControls.OnShuttleCalled += () => OnShuttleCalled?.Invoke();
ShuttleControls.OnShuttleRecalled += () => OnShuttleRecalled?.Invoke();
}
/// <summary>
/// Use the specified prototype ID as an example display in the
/// UI subsection where users type broadcast messages
/// </summary>
public void SetBroadcastDisplayEntity(EntProtoId broadcastEntityId)
{
MessagingControls.SetBroadcastDisplayEntity(broadcastEntityId);
}
/// <summary>
/// Configure UI to be consistent with the input state
/// </summary>
public void UpdateState(CommunicationsConsoleInterfaceState commsState,
ProtoId<AlertLevelPrototype> currentAlertLevel,
List<ProtoId<AlertLevelPrototype>>? selectableAlertLevels,
bool canChangeAlertLevel)
{
MessagingControls.CanRadioAnnounce = commsState.CanAnnounce;
MessagingControls.CanScreenBroadcast = commsState.CanBroadcast;
var alertLevelSelectable = selectableAlertLevels != null && canChangeAlertLevel;
AlertLevelControls.UpdateAlertLevels(selectableAlertLevels, currentAlertLevel, alertLevelSelectable);
ShuttleControls.UpdateState(commsState.CanCall, commsState.CountdownStarted, commsState.ExpectedCountdownEnd);
}
}