Revert "Remove some BUI boilerplate" (#30214)

Revert "Remove some BUI boilerplate (#28399)"

This reverts commit cbf329a82d.
This commit is contained in:
Nemanja
2024-07-20 20:42:27 -04:00
committed by GitHub
parent 6d664c9157
commit cb0ba66be3
137 changed files with 1755 additions and 1096 deletions

View File

@@ -1,6 +1,5 @@
using Content.Shared.MachineLinking;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Shared.Timing;
namespace Content.Client.MachineLinking.UI;
@@ -20,14 +19,19 @@ public sealed class SignalTimerBoundUserInterface : BoundUserInterface
{
base.Open();
_window = this.CreateWindow<SignalTimerWindow>();
_window.OnStartTimer += StartTimer;
_window = new SignalTimerWindow(this);
if (State != null)
UpdateState(State);
_window.OpenCentered();
_window.OnClose += Close;
_window.OnCurrentTextChanged += OnTextChanged;
_window.OnCurrentDelayMinutesChanged += OnDelayChanged;
_window.OnCurrentDelaySecondsChanged += OnDelayChanged;
}
public void StartTimer()
public void OnStartTimer()
{
SendMessage(new SignalTimerStartMessage());
}
@@ -44,6 +48,11 @@ public sealed class SignalTimerBoundUserInterface : BoundUserInterface
SendMessage(new SignalTimerDelayChangedMessage(_window.GetDelay()));
}
public TimeSpan GetCurrentTime()
{
return _gameTiming.CurTime;
}
/// <summary>
/// Update the UI state based on server-sent info
/// </summary>
@@ -63,4 +72,11 @@ public sealed class SignalTimerBoundUserInterface : BoundUserInterface
_window.SetTimerStarted(cast.TimerStarted);
_window.SetHasAccess(cast.HasAccess);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing) return;
_window?.Dispose();
}
}