Add UI for setting solution transfer amount (#4074)
* basic eui and window * finish EUI, update defaults * unnecessary usings * convert to bounduserinterface * merge me up merge me up inside * Fix repeated define for component in prototype * impl swept UI suggestion * apply discord reviews * small changes
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.Chemistry.UI
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class TransferAmountBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
private TransferAmountWindow? _window;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
_window = new TransferAmountWindow();
|
||||
|
||||
_window.applyButton.OnPressed += _ =>
|
||||
{
|
||||
if (int.TryParse(_window.amountLineEdit.Text, out var i))
|
||||
{
|
||||
SendMessage(new TransferAmountSetValueMessage(ReagentUnit.New(i)));
|
||||
_window.Close();
|
||||
}
|
||||
};
|
||||
|
||||
_window.OpenCentered();
|
||||
}
|
||||
|
||||
public TransferAmountBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Content.Client/Chemistry/UI/TransferAmountWindow.xaml
Normal file
11
Content.Client/Chemistry/UI/TransferAmountWindow.xaml
Normal file
@@ -0,0 +1,11 @@
|
||||
<SS14Window xmlns="https://spacestation14.io"
|
||||
Title="{Loc 'ui-transfer-amount-title'}"
|
||||
Resizable="False">
|
||||
|
||||
<VBoxContainer SeparationOverride="4" CustomMinimumSize="240 80">
|
||||
<HBoxContainer>
|
||||
<LineEdit Name="AmountLineEdit" HorizontalExpand="True" PlaceHolder="{Loc 'ui-transfer-amount-line-edit-placeholder'}"/>
|
||||
</HBoxContainer>
|
||||
<Button Name="ApplyButton" Text="{Loc 'ui-transfer-amount-apply'}"/>
|
||||
</VBoxContainer>
|
||||
</SS14Window>
|
||||
19
Content.Client/Chemistry/UI/TransferAmountWindow.xaml.cs
Normal file
19
Content.Client/Chemistry/UI/TransferAmountWindow.xaml.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
namespace Content.Client.Chemistry.UI
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
public partial class TransferAmountWindow : SS14Window
|
||||
{
|
||||
public Button applyButton => ApplyButton;
|
||||
public LineEdit amountLineEdit => AmountLineEdit;
|
||||
|
||||
public TransferAmountWindow()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user