Files
Delta-v/Content.Client/_DV/AACTablet/UI/AACBoundUserInterface.cs
T
da885b1b1d PORT: AAC Tablet Radio Compatibility from Starcup (#5569)
* Allows the AAC to send messages over the radio

* Allows AAC names to be highlighted in chat

* Restores VoiceOverrideComponent to the AAC

* refactor: separate confluent code into new files

Signed-off-by: little-meow-meow <204685920+little-meow-meow@users.noreply.github.com>

* style fix

Signed-off-by: little-meow-meow <204685920+little-meow-meow@users.noreply.github.com>

* Ugh this took me too long to figure out

-Made so many changes to AACTabletBuiState, moved it under _DV: Made it compatible with Wizden #40293 which moved all radio comps and system to shared
-Had issues with having two AAC UI open so made it so one closes before another opens
-Trial and error with the UI window lol

* Reverted Refactor + Comment Clean up

Reverted 0873b66449 which split code between starcup namespace and removed starcup comments because it's editing _DV files.

Fix namespace error due to radio moving the share, seem to work just fine!

---------

Signed-off-by: little-meow-meow <204685920+little-meow-meow@users.noreply.github.com>
Co-authored-by: Oxdeception <9624-oxdeception@users.noreply.gitgud.io>
Co-authored-by: little-meow-meow <204685920+little-meow-meow@users.noreply.github.com>
Co-authored-by: Janet Blackquill <uhhadd@gmail.com>
2026-05-15 17:17:49 +00:00

64 lines
1.7 KiB
C#

using Content.Client.Chat.TypingIndicator;
using Content.Shared._DV.AACTablet;
using Content.Shared._DV.QuickPhrase;
using Content.Shared.Chat.TypingIndicator;
using Robust.Client.UserInterface;
using Robust.Shared.Prototypes;
namespace Content.Client._DV.AACTablet.UI;
public sealed class AACBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private AACWindow? _window;
private static readonly ProtoId<TypingIndicatorPrototype> AACTypingIndicator = "aac";
private TypingIndicatorSystem? _typing;
public AACBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
if (_window is { Disposed: false })
_window.Close();
_window = this.CreateWindow<AACWindow>();
_window.OnClose += Close;
_window.PhraseButtonPressed += OnPhraseButtonPressed;
_window.Typing += OnTyping;
_window.SubmitPressed += OnSubmit;
}
private void OnPhraseButtonPressed(List<ProtoId<QuickPhrasePrototype>> phraseId, string prefix)
{
SendMessage(new AACTabletSendPhraseMessage(phraseId, prefix));
}
private void OnTyping()
{
_typing ??= EntMan.System<TypingIndicatorSystem>();
_typing?.ClientAlternateTyping(AACTypingIndicator);
}
private void OnSubmit()
{
_typing ??= EntMan.System<TypingIndicatorSystem>();
_typing?.ClientSubmittedChatText();
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not AACTabletBuiState msg)
return;
_window?.Update(msg);
}
}