Cleaner BoundUserInterfaces (#17736)

This commit is contained in:
TemporalOroboros
2023-07-08 09:02:17 -07:00
committed by GitHub
parent 55b4fb1649
commit 3ac4cf85db
137 changed files with 1069 additions and 972 deletions

View File

@@ -2,7 +2,6 @@
using Content.Shared.Atmos.Piping.Binary.Components;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
namespace Content.Client.Atmos.UI
{
@@ -12,11 +11,13 @@ namespace Content.Client.Atmos.UI
[UsedImplicitly]
public sealed class GasVolumePumpBoundUserInterface : BoundUserInterface
{
private GasVolumePumpWindow? _window;
[ViewVariables]
private const float MaxTransferRate = Atmospherics.MaxTransferRate;
public GasVolumePumpBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
[ViewVariables]
private GasVolumePumpWindow? _window;
public GasVolumePumpBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
@@ -26,7 +27,7 @@ namespace Content.Client.Atmos.UI
_window = new GasVolumePumpWindow();
if(State != null)
if (State != null)
UpdateState(State);
_window.OpenCentered();
@@ -45,8 +46,9 @@ namespace Content.Client.Atmos.UI
private void OnPumpTransferRatePressed(string value)
{
float rate = float.TryParse(value, out var parsed) ? parsed : 0f;
if (rate > MaxTransferRate) rate = MaxTransferRate;
var rate = float.TryParse(value, out var parsed) ? parsed : 0f;
if (rate > MaxTransferRate)
rate = MaxTransferRate;
SendMessage(new GasVolumePumpChangeTransferRateMessage(rate));
}