Station alert levels (#8226)
This commit is contained in:
@@ -19,6 +19,10 @@ namespace Content.Client.Communications.UI
|
||||
|
||||
public bool CountdownStarted { get; private set; }
|
||||
|
||||
public bool AlertLevelSelectable { get; private set; }
|
||||
|
||||
public string CurrentLevel { get; private set; } = default!;
|
||||
|
||||
public int Countdown => _expectedCountdownTime == null
|
||||
? 0 : Math.Max((int)_expectedCountdownTime.Value.Subtract(_gameTiming.CurTime).TotalSeconds, 0);
|
||||
private TimeSpan? _expectedCountdownTime;
|
||||
@@ -36,6 +40,15 @@ namespace Content.Client.Communications.UI
|
||||
_menu.OpenCentered();
|
||||
}
|
||||
|
||||
public void AlertLevelSelected(string level)
|
||||
{
|
||||
if (AlertLevelSelectable)
|
||||
{
|
||||
CurrentLevel = level;
|
||||
SendMessage(new CommunicationsConsoleSelectAlertLevelMessage(level));
|
||||
}
|
||||
}
|
||||
|
||||
public void EmergencyShuttleButtonPressed()
|
||||
{
|
||||
if (CountdownStarted)
|
||||
@@ -71,10 +84,14 @@ namespace Content.Client.Communications.UI
|
||||
CanCall = commsState.CanCall;
|
||||
_expectedCountdownTime = commsState.ExpectedCountdownEnd;
|
||||
CountdownStarted = commsState.CountdownStarted;
|
||||
AlertLevelSelectable = commsState.AlertLevels != null && !float.IsNaN(commsState.CurrentAlertDelay) && commsState.CurrentAlertDelay <= 0;
|
||||
CurrentLevel = commsState.CurrentAlert;
|
||||
|
||||
if (_menu != null)
|
||||
{
|
||||
_menu.UpdateCountdown();
|
||||
_menu.UpdateAlertLevels(commsState.AlertLevels, CurrentLevel);
|
||||
_menu.AlertLevelButton.Disabled = !AlertLevelSelectable;
|
||||
_menu.EmergencyShuttleButton.Disabled = !CanCall;
|
||||
_menu.AnnounceButton.Disabled = !CanAnnounce;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user