fish-station/Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs
VigersRay d2c1a1df88 Merge remote-tracking branch 'refs/remotes/wizards/master'
# Conflicts:
#	Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs
#	Content.Client/Power/PowerMonitoringWindow.xaml.cs
#	Content.Client/SurveillanceCamera/UI/SurveillanceCameraMonitorBoundUi.cs
#	Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs
#	Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs
#	Content.IntegrationTests/Tests/GameRules/NukeOpsTest.cs
#	Content.IntegrationTests/Tests/PostMapInitTest.cs
#	Content.Server/GameTicking/GameTicker.RoundFlow.cs
#	Content.Server/Ghost/Roles/GhostRoleSystem.cs
#	Content.Server/Players/PlayTimeTracking/PlayTimeTrackingSystem.cs
#	Content.Server/Station/Systems/StationJobsSystem.Roundstart.cs
#	Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/reinforcement_teleporter.yml
#	Resources/ServerInfo/Guidebook/Mobs/SlimePerson.xml
#	Resources/Textures/Structures/Walls/mining.rsi/meta.json
2024-07-22 04:16:05 +03:00

52 lines
1.4 KiB
C#

using Content.Shared.VoiceMask;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Shared.Prototypes;
namespace Content.Client.VoiceMask;
public sealed class VoiceMaskBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly IPrototypeManager _protomanager = default!;
[ViewVariables]
private VoiceMaskNameChangeWindow? _window;
public VoiceMaskBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_window = this.CreateWindow<VoiceMaskNameChangeWindow>();
_window.ReloadVerbs(_protomanager);
_window.OnNameChange += OnNameSelected;
_window.OnVerbChange += verb => SendMessage(new VoiceMaskChangeVerbMessage(verb));
_window.OnVoiceChange += voice => SendMessage(new VoiceMaskChangeVoiceMessage(voice)); // Sunrise-TTS
}
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, cast.Verb); // Sunrise-TTS
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_window?.Close();
}
}