Files
OldThink/Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs
rhailrake ea4f7595a2 [feat] TTS
# Conflicts:
#	Content.Client/Options/UI/Tabs/AudioTab.xaml.cs
#	Content.Client/Preferences/UI/HumanoidProfileEditor.xaml
#	Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
#	Content.Server/Database/ServerDbBase.cs
#	Content.Server/Entry/EntryPoint.cs
#	Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.cs
#	Content.Server/IoC/ServerContentIoC.cs
#	Content.Server/VoiceMask/VoiceMaskSystem.cs
#	Resources/Prototypes/Entities/Mobs/Species/base.yml
2024-01-10 23:56:07 +07:00

50 lines
1.1 KiB
C#

using Content.Shared.VoiceMask;
using Robust.Client.GameObjects;
namespace Content.Client.VoiceMask;
public sealed class VoiceMaskBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private VoiceMaskNameChangeWindow? _window;
public VoiceMaskBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_window = new();
_window.OpenCentered();
_window.OnNameChange += OnNameSelected;
_window.OnVoiceChange += (value) => SendMessage(new VoiceMaskChangeVoiceMessage(value));
_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.Voice);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_window?.Close();
}
}