Disposals refactor (#17803)

This commit is contained in:
metalgearsloth
2023-07-06 13:39:34 +10:00
committed by GitHub
parent 0790f31f21
commit 3eb93988e5
21 changed files with 1321 additions and 1261 deletions

View File

@@ -2,6 +2,7 @@ using Content.Shared.Disposal.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Timing;
using static Content.Shared.Disposal.Components.SharedDisposalUnitComponent;
namespace Content.Client.Disposal.UI
@@ -12,6 +13,8 @@ namespace Content.Client.Disposal.UI
[GenerateTypedNameReferences]
public sealed partial class DisposalUnitWindow : DefaultWindow
{
public TimeSpan FullPressure;
public DisposalUnitWindow()
{
IoCManager.InjectDependencies(this);
@@ -22,14 +25,19 @@ namespace Content.Client.Disposal.UI
/// Update the interface state for the disposals window.
/// </summary>
/// <returns>true if we should stop updating every frame.</returns>
public bool UpdateState(DisposalUnitBoundUserInterfaceState state)
public void UpdateState(DisposalUnitBoundUserInterfaceState state)
{
Title = state.UnitName;
UnitState.Text = state.UnitState;
Power.Pressed = state.Powered;
Engage.Pressed = state.Engaged;
FullPressure = state.FullPressureTime;
}
return !state.Powered || PressureBar.UpdatePressure(state.FullPressureTime);
protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
PressureBar.UpdatePressure(FullPressure);
}
}
}