2022-03-17 10:30:40 +13:00
|
|
|
using Content.Shared.Atmos.Components;
|
2020-10-27 20:53:44 +01:00
|
|
|
using JetBrains.Annotations;
|
2024-07-21 14:48:13 +10:00
|
|
|
using Robust.Client.GameObjects;
|
|
|
|
|
using Robust.Client.UserInterface;
|
2020-10-27 20:53:44 +01:00
|
|
|
|
2022-09-11 20:42:12 -07:00
|
|
|
namespace Content.Client.UserInterface.Systems.Atmos.GasTank
|
2020-10-27 20:53:44 +01:00
|
|
|
{
|
|
|
|
|
[UsedImplicitly]
|
2023-07-08 09:02:17 -07:00
|
|
|
public sealed class GasTankBoundUserInterface : BoundUserInterface
|
2020-10-27 20:53:44 +01:00
|
|
|
{
|
2023-07-08 09:02:17 -07:00
|
|
|
[ViewVariables]
|
|
|
|
|
private GasTankWindow? _window;
|
|
|
|
|
|
|
|
|
|
public GasTankBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
2020-10-27 20:53:44 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-21 14:48:13 +10:00
|
|
|
public void SetOutputPressure(float value)
|
2020-10-27 20:53:44 +01:00
|
|
|
{
|
2023-07-08 09:02:17 -07:00
|
|
|
SendMessage(new GasTankSetPressureMessage
|
|
|
|
|
{
|
|
|
|
|
Pressure = value
|
|
|
|
|
});
|
2020-10-27 20:53:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ToggleInternals()
|
|
|
|
|
{
|
|
|
|
|
SendMessage(new GasTankToggleInternalsMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Open()
|
|
|
|
|
{
|
|
|
|
|
base.Open();
|
2024-07-21 14:48:13 +10:00
|
|
|
_window = this.CreateWindow<GasTankWindow>();
|
|
|
|
|
_window.SetTitle(EntMan.GetComponent<MetaDataComponent>(Owner).EntityName);
|
|
|
|
|
_window.OnOutputPressure += SetOutputPressure;
|
|
|
|
|
_window.OnToggleInternals += ToggleInternals;
|
2020-10-27 20:53:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
|
|
|
{
|
|
|
|
|
base.UpdateState(state);
|
2021-03-10 14:48:29 +01:00
|
|
|
|
2022-03-17 10:30:40 +13:00
|
|
|
if (state is GasTankBoundUserInterfaceState cast)
|
|
|
|
|
_window?.UpdateState(cast);
|
2020-10-27 20:53:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Dispose(bool disposing)
|
|
|
|
|
{
|
|
|
|
|
base.Dispose(disposing);
|
|
|
|
|
|
2021-03-10 14:48:29 +01:00
|
|
|
_window?.Close();
|
2020-10-27 20:53:44 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|