* First commit * Added base.Initialize() * Voice wire fix (Electricty name) * Various minor cleanups * Localized default voice mask name * Added VoiceOverride stuff * Removed unused stuff * Typo * Better localized stuff * Typo / spelling stuff / comments * Blessed
53 lines
1.3 KiB
C#
53 lines
1.3 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));
|
|
}
|
|
|
|
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();
|
|
}
|
|
}
|