2022-07-29 14:13:22 +12:00
|
|
|
using Content.Shared.Wires;
|
2022-05-05 19:35:06 -07:00
|
|
|
using Robust.Client.GameObjects;
|
2024-07-21 14:48:13 +10:00
|
|
|
using Robust.Client.UserInterface;
|
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
|
|
|
{
|
2023-07-08 09:02:17 -07:00
|
|
|
[ViewVariables]
|
2021-03-10 14:48:29 +01:00
|
|
|
private WiresMenu? _menu;
|
|
|
|
|
|
2023-07-08 09:02:17 -07:00
|
|
|
public WiresBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
2019-09-01 22:15:34 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Open()
|
|
|
|
|
{
|
|
|
|
|
base.Open();
|
2024-07-21 14:48:13 +10:00
|
|
|
_menu = this.CreateWindow<WiresMenu>();
|
|
|
|
|
_menu.OnAction += PerformAction;
|
2019-09-01 22:15:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|