* add Name field to SpeechVerbPrototype * extra locale for voice mask ui * SpeechVerb ui and handling * raaaaaaaaa * reeeeeeeeal Co-authored-by: Tayrtahn <tayrtahn@gmail.com> * fix sort * did you hear john syndicate died of ligma * Update Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml --------- Co-authored-by: deltanedas <@deltanedas:kde.org> Co-authored-by: Tayrtahn <tayrtahn@gmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
52 lines
1.2 KiB
C#
52 lines
1.2 KiB
C#
using Content.Shared.VoiceMask;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.VoiceMask;
|
|
|
|
public sealed class VoiceMaskBoundUserInterface : BoundUserInterface
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
|
|
|
[ViewVariables]
|
|
private VoiceMaskNameChangeWindow? _window;
|
|
|
|
public VoiceMaskBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
|
{
|
|
}
|
|
|
|
protected override void Open()
|
|
{
|
|
base.Open();
|
|
|
|
_window = new(_proto);
|
|
|
|
_window.OpenCentered();
|
|
_window.OnNameChange += OnNameSelected;
|
|
_window.OnVerbChange += verb => SendMessage(new VoiceMaskChangeVerbMessage(verb));
|
|
_window.OnClose += Close;
|
|
}
|
|
|
|
private void OnNameSelected(string name)
|
|
{
|
|
SendMessage(new VoiceMaskChangeNameMessage(name));
|
|
}
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
{
|
|
if (state is not VoiceMaskBuiState cast || _window == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
_window.UpdateState(cast.Name, cast.Verb);
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(disposing);
|
|
|
|
_window?.Close();
|
|
}
|
|
}
|