Files
crystall-punk-14/Content.Client/Wires/UI/WiresBoundUserInterface.cs

44 lines
1.1 KiB
C#
Raw Permalink Normal View History

using Content.Shared.Wires;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
2021-06-09 22:19:39 +02:00
namespace Content.Client.Wires.UI
{
public sealed class WiresBoundUserInterface : BoundUserInterface
{
2023-07-08 09:02:17 -07:00
[ViewVariables]
private WiresMenu? _menu;
2023-07-08 09:02:17 -07:00
public WiresBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_menu = this.CreateWindow<WiresMenu>();
_menu.OnAction += PerformAction;
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
_menu?.Populate((WiresBoundUserInterfaceState) state);
}
public void PerformAction(int id, WiresAction action)
{
SendMessage(new WiresActionMessage(id, action));
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;
_menu?.Dispose();
}
}
}