Fix mailing unit UI (#30174)
This commit is contained in:
@@ -2,6 +2,7 @@ using Content.Shared.Disposal;
|
|||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.Client.Disposal.UI
|
namespace Content.Client.Disposal.UI
|
||||||
{
|
{
|
||||||
@@ -11,6 +12,8 @@ namespace Content.Client.Disposal.UI
|
|||||||
[GenerateTypedNameReferences]
|
[GenerateTypedNameReferences]
|
||||||
public sealed partial class MailingUnitWindow : DefaultWindow
|
public sealed partial class MailingUnitWindow : DefaultWindow
|
||||||
{
|
{
|
||||||
|
public TimeSpan FullPressure;
|
||||||
|
|
||||||
public MailingUnitWindow()
|
public MailingUnitWindow()
|
||||||
{
|
{
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
@@ -26,6 +29,7 @@ namespace Content.Client.Disposal.UI
|
|||||||
|
|
||||||
Title = Loc.GetString("ui-mailing-unit-window-title", ("tag", state.Tag ?? " "));
|
Title = Loc.GetString("ui-mailing-unit-window-title", ("tag", state.Tag ?? " "));
|
||||||
UnitState.Text = disposalState.UnitState;
|
UnitState.Text = disposalState.UnitState;
|
||||||
|
FullPressure = disposalState.FullPressureTime;
|
||||||
var pressureReached = PressureBar.UpdatePressure(disposalState.FullPressureTime);
|
var pressureReached = PressureBar.UpdatePressure(disposalState.FullPressureTime);
|
||||||
Power.Pressed = disposalState.Powered;
|
Power.Pressed = disposalState.Powered;
|
||||||
Engage.Pressed = disposalState.Engaged;
|
Engage.Pressed = disposalState.Engaged;
|
||||||
@@ -42,9 +46,10 @@ namespace Content.Client.Disposal.UI
|
|||||||
return !disposalState.Powered || pressureReached;
|
return !disposalState.Powered || pressureReached;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdatePressure(TimeSpan stateFullPressureTime)
|
protected override void FrameUpdate(FrameEventArgs args)
|
||||||
{
|
{
|
||||||
return PressureBar.UpdatePressure(stateFullPressureTime);
|
base.FrameUpdate(args);
|
||||||
|
PressureBar.UpdatePressure(FullPressure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.Disposal;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.Disposal.Mailing;
|
namespace Content.Server.Disposal.Mailing;
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ public sealed class MailingUnitSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<MailingUnitComponent, DeviceNetworkPacketEvent>(OnPacketReceived);
|
SubscribeLocalEvent<MailingUnitComponent, DeviceNetworkPacketEvent>(OnPacketReceived);
|
||||||
SubscribeLocalEvent<MailingUnitComponent, BeforeDisposalFlushEvent>(OnBeforeFlush);
|
SubscribeLocalEvent<MailingUnitComponent, BeforeDisposalFlushEvent>(OnBeforeFlush);
|
||||||
SubscribeLocalEvent<MailingUnitComponent, ConfigurationSystem.ConfigurationUpdatedEvent>(OnConfigurationUpdated);
|
SubscribeLocalEvent<MailingUnitComponent, ConfigurationSystem.ConfigurationUpdatedEvent>(OnConfigurationUpdated);
|
||||||
SubscribeLocalEvent<MailingUnitComponent, ActivateInWorldEvent>(HandleActivate);
|
SubscribeLocalEvent<MailingUnitComponent, ActivateInWorldEvent>(HandleActivate, before: new[] { typeof(DisposalUnitSystem) });
|
||||||
SubscribeLocalEvent<MailingUnitComponent, DisposalUnitUIStateUpdatedEvent>(OnDisposalUnitUIStateChange);
|
SubscribeLocalEvent<MailingUnitComponent, DisposalUnitUIStateUpdatedEvent>(OnDisposalUnitUIStateChange);
|
||||||
SubscribeLocalEvent<MailingUnitComponent, TargetSelectedMessage>(OnTargetSelected);
|
SubscribeLocalEvent<MailingUnitComponent, TargetSelectedMessage>(OnTargetSelected);
|
||||||
}
|
}
|
||||||
@@ -179,7 +180,7 @@ public sealed class MailingUnitSystem : EntitySystem
|
|||||||
if (component.DisposalUnitInterfaceState == null)
|
if (component.DisposalUnitInterfaceState == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var state = new MailingUnitBoundUserInterfaceState(component.DisposalUnitInterfaceState, component.Target, component.TargetList, component.Tag);
|
var state = new MailingUnitBoundUserInterfaceState(component.DisposalUnitInterfaceState, component.Target, component.TargetList.ShallowClone(), component.Tag);
|
||||||
_userInterfaceSystem.SetUiState(uid, MailingUnitUiKey.Key, state);
|
_userInterfaceSystem.SetUiState(uid, MailingUnitUiKey.Key, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user