2021-08-22 03:20:18 +10:00
|
|
|
using Content.Shared.Chemistry;
|
2021-11-03 16:48:03 -07:00
|
|
|
using Content.Shared.FixedPoint;
|
2021-07-25 00:53:53 -07:00
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
using Robust.Client.GameObjects;
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.Chemistry.UI
|
|
|
|
|
{
|
|
|
|
|
[UsedImplicitly]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class TransferAmountBoundUserInterface : BoundUserInterface
|
2021-07-25 00:53:53 -07:00
|
|
|
{
|
|
|
|
|
private TransferAmountWindow? _window;
|
|
|
|
|
|
|
|
|
|
protected override void Open()
|
|
|
|
|
{
|
|
|
|
|
base.Open();
|
|
|
|
|
_window = new TransferAmountWindow();
|
|
|
|
|
|
2021-10-28 14:23:17 +02:00
|
|
|
_window.ApplyButton.OnPressed += _ =>
|
2021-07-25 00:53:53 -07:00
|
|
|
{
|
2021-10-28 14:23:17 +02:00
|
|
|
if (int.TryParse(_window.AmountLineEdit.Text, out var i))
|
2021-07-25 00:53:53 -07:00
|
|
|
{
|
2021-11-03 16:48:03 -07:00
|
|
|
SendMessage(new TransferAmountSetValueMessage(FixedPoint2.New(i)));
|
2021-07-25 00:53:53 -07:00
|
|
|
_window.Close();
|
|
|
|
|
}
|
|
|
|
|
};
|
2021-08-22 03:20:18 +10:00
|
|
|
_window.OnClose += Close;
|
2021-07-25 00:53:53 -07:00
|
|
|
_window.OpenCentered();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TransferAmountBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
|
|
|
|
{
|
|
|
|
|
}
|
2021-11-26 16:37:18 +13:00
|
|
|
|
|
|
|
|
protected override void Dispose(bool disposing)
|
|
|
|
|
{
|
|
|
|
|
base.Dispose(disposing);
|
|
|
|
|
if (!disposing) return;
|
|
|
|
|
_window?.Dispose();
|
|
|
|
|
}
|
2021-07-25 00:53:53 -07:00
|
|
|
}
|
|
|
|
|
}
|