Files
tbd-station-14/Content.Client/Radio/Ui/IntercomBoundUserInterface.cs
Nemanja 0e9ed36b85 Intercom buffs and fixes (#29580)
* Intercom buffs and fixes

* remove unused bui state

* mild sec intercom buff

* reinforce sec intercoms
2024-07-08 00:19:10 +10:00

56 lines
1.2 KiB
C#

using Content.Shared.Radio;
using Content.Shared.Radio.Components;
using JetBrains.Annotations;
namespace Content.Client.Radio.Ui;
[UsedImplicitly]
public sealed class IntercomBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private IntercomMenu? _menu;
public IntercomBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
var comp = EntMan.GetComponent<IntercomComponent>(Owner);
_menu = new((Owner, comp));
_menu.OnMicPressed += enabled =>
{
SendMessage(new ToggleIntercomMicMessage(enabled));
};
_menu.OnSpeakerPressed += enabled =>
{
SendMessage(new ToggleIntercomSpeakerMessage(enabled));
};
_menu.OnChannelSelected += channel =>
{
SendMessage(new SelectIntercomChannelMessage(channel));
};
_menu.OnClose += Close;
_menu.OpenCentered();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;
_menu?.Close();
}
public void Update(Entity<IntercomComponent> ent)
{
_menu?.Update(ent);
}
}