mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using Content.Client.Items.UI;
|
|
using Content.Client.Message;
|
|
using Content.Client.Stylesheets;
|
|
using Content.Client.Trigger.Systems;
|
|
using Content.Shared.Trigger.Components;
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
namespace Content.Client.Trigger.UI;
|
|
|
|
/// <summary>
|
|
/// Displays timer delay information for <see cref="TimerTriggerComponent"/> from predicted client state.
|
|
/// </summary>
|
|
/// <seealso cref="TimerTriggerItemStatusSystem"/>
|
|
public sealed partial class TimerTriggerStatusControl : PollingItemStatusControl<TimerTriggerStatusControl.Data>
|
|
{
|
|
private readonly Entity<TimerTriggerComponent> _parent;
|
|
private readonly RichTextLabel _label;
|
|
|
|
public TimerTriggerStatusControl(
|
|
Entity<TimerTriggerComponent> parent)
|
|
{
|
|
_parent = parent;
|
|
_label = new RichTextLabel { StyleClasses = { StyleClass.ItemStatus } };
|
|
AddChild(_label);
|
|
}
|
|
|
|
protected override Data PollData()
|
|
{
|
|
return new Data(_parent.Comp.Delay);
|
|
}
|
|
|
|
protected override void Update(in Data data)
|
|
{
|
|
var markup = _parent.Comp.Examinable
|
|
? Loc.GetString("timer-trigger-status-delay", ("delay", data.Delay.TotalSeconds.ToString("F2")))
|
|
: Loc.GetString("timer-trigger-status-delay-unknown");
|
|
_label.SetMarkup(markup);
|
|
}
|
|
|
|
public readonly record struct Data(TimeSpan Delay);
|
|
}
|