Files
wwdpublic/Content.Client/MachineLinking/UI/SignalTimerBoundUserInterface.cs
ilmenwe bfe577b9c7 Unused Varibles and Localization Fixes (#2424)
Removed all unused variables i could find, built and tested on a simple
upstart and clicking trough most systems.
Change Loc references to localization.

<!--
This is default collapsed, readers click to expand it and see all your
media
The PR media section can get very large at times, so this is a good way
to keep it clean
The title is written using HTML tags
The title must be within the <summary> tags or you won't see it
-->

<details><summary><h1>Media</h1></summary>
<p>

"using Robust.Shared.Prototypes;"
to
""

"[dependency] private readonly ISpriteComponent"
to
""

</p>
</details>

---

No CL this isn't player facing.

---------

Co-authored-by: ilmenwe <no@mail.com>
2025-07-12 02:20:02 +10:00

63 lines
1.8 KiB
C#

using Content.Shared.MachineLinking;
using Robust.Client.UserInterface;
namespace Content.Client.MachineLinking.UI;
public sealed class SignalTimerBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private SignalTimerWindow? _window;
public SignalTimerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_window = this.CreateWindow<SignalTimerWindow>();
_window.OnStartTimer += StartTimer;
_window.OnCurrentTextChanged += OnTextChanged;
_window.OnCurrentDelayMinutesChanged += OnDelayChanged;
_window.OnCurrentDelaySecondsChanged += OnDelayChanged;
}
public void StartTimer()
{
SendMessage(new SignalTimerStartMessage());
}
private void OnTextChanged(string newText)
{
SendMessage(new SignalTimerTextChangedMessage(newText));
}
private void OnDelayChanged(string newDelay)
{
if (_window == null)
return;
SendMessage(new SignalTimerDelayChangedMessage(_window.GetDelay()));
}
/// <summary>
/// Update the UI state based on server-sent info
/// </summary>
/// <param name="state"></param>
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (_window == null || state is not SignalTimerBoundUserInterfaceState cast)
return;
_window.SetCurrentText(cast.CurrentText);
_window.SetCurrentDelayMinutes(cast.CurrentDelayMinutes);
_window.SetCurrentDelaySeconds(cast.CurrentDelaySeconds);
_window.SetShowText(cast.ShowText);
_window.SetTriggerTime(cast.TriggerTime);
_window.SetTimerStarted(cast.TimerStarted);
_window.SetHasAccess(cast.HasAccess);
}
}