Voice mask (#10458)
This commit is contained in:
46
Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs
Normal file
46
Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using Content.Shared.VoiceMask;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client.VoiceMask;
|
||||
|
||||
public sealed class VoiceMaskBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
public VoiceMaskBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
private VoiceMaskNameChangeWindow? _window;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_window = new();
|
||||
|
||||
_window.OpenCentered();
|
||||
_window.OnNameChange += OnNameSelected;
|
||||
_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);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
_window?.Close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user