2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Client.GameObjects;
|
|
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-06-09 22:19:39 +02:00
|
|
|
|
using static Content.Shared.Wires.SharedWiresComponent;
|
2019-09-01 22:15:34 +02:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Client.Wires.UI
|
2019-09-01 22:15:34 +02:00
|
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class WiresBoundUserInterface : BoundUserInterface
|
2019-09-01 22:15:34 +02:00
|
|
|
|
{
|
2021-03-10 14:48:29 +01:00
|
|
|
|
private WiresMenu? _menu;
|
|
|
|
|
|
|
2019-09-01 22:15:34 +02:00
|
|
|
|
public WiresBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void Open()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Open();
|
|
|
|
|
|
|
2021-03-10 14:48:29 +01:00
|
|
|
|
_menu = new WiresMenu(this);
|
2019-09-01 22:15:34 +02:00
|
|
|
|
_menu.OnClose += Close;
|
|
|
|
|
|
_menu.OpenCentered();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.UpdateState(state);
|
2021-03-10 14:48:29 +01:00
|
|
|
|
_menu?.Populate((WiresBoundUserInterfaceState) state);
|
2019-09-01 22:15:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-05-27 15:09:22 +02:00
|
|
|
|
public void PerformAction(int id, WiresAction action)
|
2019-09-01 22:15:34 +02:00
|
|
|
|
{
|
2020-05-27 15:09:22 +02:00
|
|
|
|
SendMessage(new WiresActionMessage(id, action));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void Dispose(bool disposing)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Dispose(disposing);
|
2020-10-06 10:16:42 +02:00
|
|
|
|
if (!disposing)
|
|
|
|
|
|
return;
|
2020-05-27 15:09:22 +02:00
|
|
|
|
|
2021-03-10 14:48:29 +01:00
|
|
|
|
_menu?.Dispose();
|
2019-09-01 22:15:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|