2021-09-19 10:18:58 -07:00
|
|
|
|
using Content.Client.Power.APC.UI;
|
2021-06-09 22:19:39 +02:00
|
|
|
|
using Content.Shared.APC;
|
2020-12-08 11:56:10 +01:00
|
|
|
|
using JetBrains.Annotations;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Client.GameObjects;
|
|
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-09-19 10:18:58 -07:00
|
|
|
|
using Robust.Shared.ViewVariables;
|
2018-08-31 08:52:48 +02:00
|
|
|
|
|
2021-07-04 18:11:52 +02:00
|
|
|
|
namespace Content.Client.Power.APC
|
2018-08-31 08:52:48 +02:00
|
|
|
|
{
|
2020-12-08 11:56:10 +01:00
|
|
|
|
[UsedImplicitly]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class ApcBoundUserInterface : BoundUserInterface
|
2018-08-31 08:52:48 +02:00
|
|
|
|
{
|
2021-09-19 10:18:58 -07:00
|
|
|
|
[ViewVariables] private ApcMenu? _menu;
|
2018-08-31 08:52:48 +02:00
|
|
|
|
|
|
|
|
|
|
protected override void Open()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Open();
|
|
|
|
|
|
|
2021-09-19 10:18:58 -07:00
|
|
|
|
_menu = new ApcMenu(this);
|
|
|
|
|
|
_menu.OnClose += Close;
|
|
|
|
|
|
_menu.OpenCentered();
|
2018-08-31 08:52:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ApcBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.UpdateState(state);
|
|
|
|
|
|
|
|
|
|
|
|
var castState = (ApcBoundInterfaceState) state;
|
2021-09-19 10:18:58 -07:00
|
|
|
|
_menu?.UpdateState(castState);
|
2019-05-27 18:15:13 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-09-19 10:18:58 -07:00
|
|
|
|
public void BreakerPressed()
|
2019-05-27 18:15:13 -04:00
|
|
|
|
{
|
2021-09-19 10:18:58 -07:00
|
|
|
|
SendMessage(new ApcToggleMainBreakerMessage());
|
2018-08-31 08:52:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void Dispose(bool disposing)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Dispose(disposing);
|
|
|
|
|
|
|
|
|
|
|
|
if (disposing)
|
|
|
|
|
|
{
|
2021-09-19 10:18:58 -07:00
|
|
|
|
_menu?.Dispose();
|
2019-05-15 12:31:54 -04:00
|
|
|
|
}
|
2018-08-31 08:52:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|