You can now cancel the timer (recall)
This commit is contained in:
@@ -20,7 +20,7 @@ namespace Content.Client.Command
|
||||
|
||||
private CommunicationsConsoleBoundUserInterface Owner { get; set; }
|
||||
private readonly CancellationTokenSource _timerCancelTokenSource = new CancellationTokenSource();
|
||||
|
||||
private readonly Button _emergencyShuttleButton;
|
||||
private readonly RichTextLabel _countdownLabel;
|
||||
|
||||
public CommunicationsConsoleMenu(CommunicationsConsoleBoundUserInterface owner)
|
||||
@@ -31,14 +31,13 @@ namespace Content.Client.Command
|
||||
Owner = owner;
|
||||
|
||||
_countdownLabel = new RichTextLabel(){CustomMinimumSize = new Vector2(0, 200)};
|
||||
var emergencyShuttleButton = new Button() {Text = _localizationManager.GetString("Call emergency shuttle")};
|
||||
|
||||
emergencyShuttleButton.OnPressed += (e) => Owner.CallShuttle();
|
||||
_emergencyShuttleButton = new Button();
|
||||
_emergencyShuttleButton.OnPressed += (e) => Owner.EmergencyShuttleButtonPressed();
|
||||
|
||||
var vbox = new VBoxContainer() {SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand};
|
||||
|
||||
vbox.AddChild(_countdownLabel);
|
||||
vbox.AddChild(emergencyShuttleButton);
|
||||
vbox.AddChild(_emergencyShuttleButton);
|
||||
|
||||
var hbox = new HBoxContainer() {SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand};
|
||||
hbox.AddChild(new Control(){CustomMinimumSize = new Vector2(100,0), SizeFlagsHorizontal = SizeFlags.FillExpand});
|
||||
@@ -56,9 +55,11 @@ namespace Content.Client.Command
|
||||
if (!Owner.CountdownStarted)
|
||||
{
|
||||
_countdownLabel.SetMessage("");
|
||||
_emergencyShuttleButton.Text = _localizationManager.GetString("Call emergency shuttle");
|
||||
return;
|
||||
}
|
||||
|
||||
_emergencyShuttleButton.Text = _localizationManager.GetString("Recall emergency shuttle");
|
||||
_countdownLabel.SetMessage($"Time remaining\n{Owner.Countdown.ToString()}s");
|
||||
}
|
||||
|
||||
|
||||
@@ -33,11 +33,24 @@ namespace Content.Client.GameObjects.Components.Command
|
||||
_menu.OpenCentered();
|
||||
}
|
||||
|
||||
public void EmergencyShuttleButtonPressed()
|
||||
{
|
||||
if(CountdownStarted)
|
||||
RecallShuttle();
|
||||
else
|
||||
CallShuttle();
|
||||
}
|
||||
|
||||
public void CallShuttle()
|
||||
{
|
||||
SendMessage(new CommunicationsConsoleCallEmergencyShuttleMessage());
|
||||
}
|
||||
|
||||
public void RecallShuttle()
|
||||
{
|
||||
SendMessage(new CommunicationsConsoleRecallEmergencyShuttleMessage());
|
||||
}
|
||||
|
||||
protected override void ReceiveMessage(BoundUserInterfaceMessage message)
|
||||
{
|
||||
switch (message)
|
||||
|
||||
@@ -49,6 +49,10 @@ namespace Content.Server.GameObjects.Components.Command
|
||||
case CommunicationsConsoleCallEmergencyShuttleMessage _:
|
||||
RoundEndSystem.RequestRoundEnd();
|
||||
break;
|
||||
|
||||
case CommunicationsConsoleRecallEmergencyShuttleMessage _:
|
||||
RoundEndSystem.CancelRoundEndCountdown();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,11 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
|
||||
public void CancelRoundEndCountdown()
|
||||
{
|
||||
if (!IsRoundEndCountdownStarted)
|
||||
return;
|
||||
|
||||
IsRoundEndCountdownStarted = false;
|
||||
|
||||
_roundEndCancellationTokenSource.Cancel();
|
||||
_roundEndCancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
|
||||
@@ -33,6 +33,14 @@ namespace Content.Shared.GameObjects.Components.Command
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class CommunicationsConsoleRecallEmergencyShuttleMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public CommunicationsConsoleRecallEmergencyShuttleMessage()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum CommunicationsConsoleUiKey
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user