* Intercom buffs and fixes * remove unused bui state * mild sec intercom buff * reinforce sec intercoms
56 lines
1.2 KiB
C#
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);
|
|
}
|
|
}
|