mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 12:22:57 +08:00
Confirm exiting a multiplayer match
This commit is contained in:
parent
7dce9b04fa
commit
cb4c3503a0
@ -15,6 +15,8 @@ using osu.Framework.Threading;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Screens.OnlinePlay.Components;
|
||||
using osu.Game.Screens.OnlinePlay.Match;
|
||||
@ -279,14 +281,36 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
Mods.Value = client.LocalUser.Mods.Select(m => m.ToMod(ruleset)).Concat(SelectedItem.Value.RequiredMods).ToList();
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private DialogOverlay dialogOverlay { get; set; }
|
||||
|
||||
private bool exitConfirmed;
|
||||
|
||||
public override bool OnBackButton()
|
||||
{
|
||||
if (client.Room != null && settingsOverlay.State.Value == Visibility.Visible)
|
||||
if (client.Room == null)
|
||||
{
|
||||
// room has not been created yet; exit immediately.
|
||||
return base.OnBackButton();
|
||||
}
|
||||
|
||||
if (settingsOverlay.State.Value == Visibility.Visible)
|
||||
{
|
||||
settingsOverlay.Hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!exitConfirmed)
|
||||
{
|
||||
dialogOverlay.Push(new ConfirmDialog("leave this multiplayer match", () =>
|
||||
{
|
||||
exitConfirmed = true;
|
||||
this.Exit();
|
||||
}));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnBackButton();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user