From dceb562be7520950ef43ad64386727bc82f8e2ba Mon Sep 17 00:00:00 2001 From: Brandon Hu <103440971+Brandon-Huu@users.noreply.github.com> Date: Fri, 2 Aug 2024 01:20:36 +0000 Subject: [PATCH] add(TransferAmountWindow): QoL stuff (#30464) * ugh --- .../UI/TransferAmountBoundUserInterface.cs | 8 ++++++++ .../Chemistry/UI/TransferAmountWindow.xaml | 4 ++++ .../Chemistry/UI/TransferAmountWindow.xaml.cs | 20 +++++++++++++++++++ .../solution-transfer-component.ftl | 3 +++ 4 files changed, 35 insertions(+) diff --git a/Content.Client/Chemistry/UI/TransferAmountBoundUserInterface.cs b/Content.Client/Chemistry/UI/TransferAmountBoundUserInterface.cs index f1cb27a62a..1bc1c0dba9 100644 --- a/Content.Client/Chemistry/UI/TransferAmountBoundUserInterface.cs +++ b/Content.Client/Chemistry/UI/TransferAmountBoundUserInterface.cs @@ -1,4 +1,5 @@ using Content.Shared.Chemistry; +using Content.Shared.Chemistry.Components; using Content.Shared.FixedPoint; using JetBrains.Annotations; using Robust.Client.GameObjects; @@ -9,11 +10,15 @@ namespace Content.Client.Chemistry.UI [UsedImplicitly] public sealed class TransferAmountBoundUserInterface : BoundUserInterface { + private IEntityManager _entManager; + private EntityUid _owner; [ViewVariables] private TransferAmountWindow? _window; public TransferAmountBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) { + _owner = owner; + _entManager = IoCManager.Resolve(); } protected override void Open() @@ -21,6 +26,9 @@ namespace Content.Client.Chemistry.UI base.Open(); _window = this.CreateWindow(); + if (_entManager.TryGetComponent(_owner, out var comp)) + _window.SetBounds(comp.MinimumTransferAmount.Int(), comp.MaximumTransferAmount.Int()); + _window.ApplyButton.OnPressed += _ => { if (int.TryParse(_window.AmountLineEdit.Text, out var i)) diff --git a/Content.Client/Chemistry/UI/TransferAmountWindow.xaml b/Content.Client/Chemistry/UI/TransferAmountWindow.xaml index 3d787c69c1..c73d86b10f 100644 --- a/Content.Client/Chemistry/UI/TransferAmountWindow.xaml +++ b/Content.Client/Chemistry/UI/TransferAmountWindow.xaml @@ -6,6 +6,10 @@ + +