mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Merge branch 'master' into fix-match-screen-buttons-no-user
This commit is contained in:
@ -21,6 +21,7 @@ using osu.Game.Rulesets.Osu;
|
|||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Screens;
|
using osu.Game.Screens;
|
||||||
using osu.Game.Screens.OnlinePlay.Components;
|
using osu.Game.Screens.OnlinePlay.Components;
|
||||||
|
using osu.Game.Screens.OnlinePlay.Lounge;
|
||||||
using osu.Game.Screens.OnlinePlay.Match.Components;
|
using osu.Game.Screens.OnlinePlay.Match.Components;
|
||||||
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
||||||
using osu.Game.Screens.OnlinePlay.Multiplayer.Match;
|
using osu.Game.Screens.OnlinePlay.Multiplayer.Match;
|
||||||
@ -184,6 +185,26 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddUntilStep("play started", () => !multiplayerScreen.IsCurrentScreen());
|
AddUntilStep("play started", () => !multiplayerScreen.IsCurrentScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSubScreenExitedWhenDisconnectedFromMultiplayerServer()
|
||||||
|
{
|
||||||
|
createRoom(() => new Room
|
||||||
|
{
|
||||||
|
Name = { Value = "Test Room" },
|
||||||
|
Playlist =
|
||||||
|
{
|
||||||
|
new PlaylistItem
|
||||||
|
{
|
||||||
|
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.RulesetID == 0)).BeatmapInfo },
|
||||||
|
Ruleset = { Value = new OsuRuleset().RulesetInfo },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("disconnect", () => client.Disconnect());
|
||||||
|
AddUntilStep("back in lounge", () => this.ChildrenOfType<LoungeSubScreen>().FirstOrDefault()?.IsCurrentScreen() == true);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestLeaveNavigation()
|
public void TestLeaveNavigation()
|
||||||
{
|
{
|
||||||
|
@ -48,6 +48,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OngoingOperationTracker ongoingOperationTracker { get; set; }
|
private OngoingOperationTracker ongoingOperationTracker { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Bindable<Room> currentRoom { get; set; }
|
||||||
|
|
||||||
private MultiplayerMatchSettingsOverlay settingsOverlay;
|
private MultiplayerMatchSettingsOverlay settingsOverlay;
|
||||||
|
|
||||||
private readonly IBindable<bool> isConnected = new Bindable<bool>();
|
private readonly IBindable<bool> isConnected = new Bindable<bool>();
|
||||||
@ -273,6 +276,17 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
if (!connected.NewValue)
|
if (!connected.NewValue)
|
||||||
Schedule(this.Exit);
|
Schedule(this.Exit);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
currentRoom.BindValueChanged(room =>
|
||||||
|
{
|
||||||
|
if (room.NewValue == null)
|
||||||
|
{
|
||||||
|
// the room has gone away.
|
||||||
|
// this could mean something happened during the join process, or an external connection issue occurred.
|
||||||
|
// one specific scenario is where the underlying room is created, but the signalr server returns an error during the join process. this triggers a PartRoom operation (see https://github.com/ppy/osu/blob/7654df94f6f37b8382be7dfcb4f674e03bd35427/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerRoomManager.cs#L97)
|
||||||
|
Schedule(this.Exit);
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateMods()
|
protected override void UpdateMods()
|
||||||
@ -310,7 +324,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
if (client.Room == null)
|
// the room may not be left immediately after a disconnection due to async flow,
|
||||||
|
// so checking the IsConnected status is also required.
|
||||||
|
if (client.Room == null || !client.IsConnected.Value)
|
||||||
{
|
{
|
||||||
// room has not been created yet; exit immediately.
|
// room has not been created yet; exit immediately.
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
|
Reference in New Issue
Block a user