Revert incorrect removal of `exitConfirmed` flag

Removing it meant that it was _literally impossible_ to exit
multiplayer.
This commit is contained in:
Bartłomiej Dach 2024-01-22 15:35:03 +01:00
parent 3dd18c777a
commit 9aa7c7f591
No known key found for this signature in database
1 changed files with 4 additions and 1 deletions

View File

@ -247,13 +247,15 @@ protected override void UpdateMods()
[Resolved(canBeNull: true)]
private IDialogOverlay dialogOverlay { get; set; }
private bool exitConfirmed;
public override bool OnExiting(ScreenExitEvent e)
{
// room has not been created yet or we're offline; exit immediately.
if (client.Room == null || !IsConnected)
return base.OnExiting(e);
if (dialogOverlay != null)
if (!exitConfirmed && dialogOverlay != null)
{
if (dialogOverlay.CurrentDialog is ConfirmDialog confirmDialog)
confirmDialog.PerformOkAction();
@ -261,6 +263,7 @@ public override bool OnExiting(ScreenExitEvent e)
{
dialogOverlay.Push(new ConfirmDialog("Are you sure you want to leave this multiplayer match?", () =>
{
exitConfirmed = true;
if (this.IsCurrentScreen())
this.Exit();
}));