mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-02-15 03:31:38 +01:00
# Conflicts: # .github/workflows/publish.yml # Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs # Content.Server/GameTicking/GameTicker.Player.cs # Content.Server/VoiceMask/VoiceMaskComponent.cs # Content.Server/VoiceMask/VoiceMaskSystem.Equip.cs # Content.Server/VoiceMask/VoiceMaskSystem.cs # Content.Server/VoiceMask/VoiceMaskerComponent.cs # Resources/Prototypes/Catalog/Fills/Lockers/heads.yml # Resources/Prototypes/Entities/Clothing/Masks/specific.yml # Resources/Prototypes/Entities/Mobs/NPCs/regalrat.yml # Resources/Prototypes/Roles/Jobs/Cargo/quartermaster.yml # Resources/Prototypes/Roles/Jobs/Command/captain.yml # Resources/Prototypes/Roles/Jobs/Command/head_of_personnel.yml # Resources/Prototypes/Roles/Jobs/Engineering/chief_engineer.yml # Resources/Prototypes/Roles/Jobs/Medical/chief_medical_officer.yml # Resources/Prototypes/Roles/Jobs/Science/research_director.yml # Resources/Prototypes/Roles/Jobs/Security/head_of_security.yml # Resources/Prototypes/Roles/Jobs/Wildcards/psychologist.yml # Resources/Textures/Objects/Misc/bureaucracy.rsi/meta.json # Resources/Textures/Objects/Misc/bureaucracy.rsi/paper_stamp-psychologist.png # Resources/Textures/Structures/Walls/solid.rsi/reinf_over0.png # Resources/Textures/Tiles/attributions.yml # Resources/Textures/Tiles/blue_circuit.png # Resources/Textures/Tiles/green_circuit.png # Resources/Textures/Tiles/steel.png
54 lines
1.4 KiB
C#
54 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.AddVerbs();
|
|
|
|
_window.OnNameChange += OnNameSelected;
|
|
_window.OnVerbChange += verb => SendMessage(new VoiceMaskChangeVerbMessage(verb));
|
|
_window.OnVoiceChange += voice => SendMessage(new VoiceMaskChangeVoiceMessage(voice)); // Corvax-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); // Corvax-TTS
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(disposing);
|
|
|
|
_window?.Close();
|
|
}
|
|
}
|