mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 22:18:52 +03:00
# Description _Upstream: space-wizards/space-station-14#30174_ This fixes mailing units so their UI works again alongside their sprites. It also adds a convenience feature to reset the destination on send since it can trip up players as it makes sense to put in an item _then_ choose a location. # Changelog 🆑 - fix: Mailing Unit UI is now fixed - fix: Mailing Units' no longer use the wrong sprite when charging - tweak: Mailing Units clear target on send or selecting the same target --------- Co-authored-by: themias <89101928+themias@users.noreply.github.com>
56 lines
1.8 KiB
C#
56 lines
1.8 KiB
C#
using Content.Shared.Disposal;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Client.Disposal.UI
|
|
{
|
|
/// <summary>
|
|
/// Client-side UI used to control a <see cref="MailingUnitComponent"/>
|
|
/// </summary>
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class MailingUnitWindow : DefaultWindow
|
|
{
|
|
public TimeSpan FullPressure;
|
|
|
|
public MailingUnitWindow()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Update the interface state for the disposals window.
|
|
/// </summary>
|
|
/// <returns>true if we should stop updating every frame.</returns>
|
|
public bool UpdateState(MailingUnitBoundUserInterfaceState state)
|
|
{
|
|
var disposalState = state.DisposalState;
|
|
|
|
Title = Loc.GetString("ui-mailing-unit-window-title", ("tag", state.Tag ?? " "));
|
|
UnitState.Text = disposalState.UnitState;
|
|
FullPressure = disposalState.FullPressureTime;
|
|
var pressureReached = PressureBar.UpdatePressure(disposalState.FullPressureTime);
|
|
Power.Pressed = disposalState.Powered;
|
|
Engage.Pressed = disposalState.Engaged;
|
|
|
|
//UnitTag.Text = state.Tag;
|
|
Target.Text = state.Target;
|
|
|
|
TargetListContainer.Clear();
|
|
foreach (var target in state.TargetList)
|
|
{
|
|
TargetListContainer.AddItem(target);
|
|
}
|
|
|
|
return !disposalState.Powered || pressureReached;
|
|
}
|
|
|
|
protected override void FrameUpdate(FrameEventArgs args)
|
|
{
|
|
base.FrameUpdate(args);
|
|
PressureBar.UpdatePressure(FullPressure);
|
|
}
|
|
}
|
|
}
|