mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 11:42:56 +08:00
Merge branch 'master' into toggle-all-freemods
This commit is contained in:
commit
4057fcd70e
@ -23,6 +23,7 @@ using osu.Framework.Screens;
|
|||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
@ -76,6 +77,9 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private RulesetStore rulesets { get; set; }
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
protected OnlinePlayScreen ParentScreen { get; private set; }
|
protected OnlinePlayScreen ParentScreen { get; private set; }
|
||||||
|
|
||||||
@ -284,6 +288,8 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
|||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private IDialogOverlay dialogOverlay { get; set; }
|
private IDialogOverlay dialogOverlay { get; set; }
|
||||||
|
|
||||||
|
protected virtual bool IsConnected => api.State.Value == APIState.Online;
|
||||||
|
|
||||||
public override bool OnBackButton()
|
public override bool OnBackButton()
|
||||||
{
|
{
|
||||||
if (Room.RoomID.Value == null)
|
if (Room.RoomID.Value == null)
|
||||||
@ -356,7 +362,12 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
|||||||
if (ExitConfirmed)
|
if (ExitConfirmed)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (dialogOverlay == null || Room.RoomID.Value != null || Room.Playlist.Count == 0)
|
if (!IsConnected)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
bool hasUnsavedChanges = Room.RoomID.Value == null && Room.Playlist.Count > 0;
|
||||||
|
|
||||||
|
if (dialogOverlay == null || !hasUnsavedChanges)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// if the dialog is already displayed, block exiting until the user explicitly makes a decision.
|
// if the dialog is already displayed, block exiting until the user explicitly makes a decision.
|
||||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
// To work around this, temporarily remove the room and trigger an immediate listing poll.
|
// To work around this, temporarily remove the room and trigger an immediate listing poll.
|
||||||
if (e.Last is MultiplayerMatchSubScreen match)
|
if (e.Last is MultiplayerMatchSubScreen match)
|
||||||
{
|
{
|
||||||
RoomManager.RemoveRoom(match.Room);
|
RoomManager?.RemoveRoom(match.Room);
|
||||||
ListingPollingComponent.PollImmediately();
|
ListingPollingComponent.PollImmediately();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Online;
|
using osu.Game.Online;
|
||||||
using osu.Game.Online.API;
|
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
@ -50,9 +49,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private MultiplayerClient client { get; set; }
|
private MultiplayerClient client { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private IAPIProvider api { get; set; }
|
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private OsuGame game { get; set; }
|
private OsuGame game { get; set; }
|
||||||
|
|
||||||
@ -79,6 +75,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
handleRoomLost();
|
handleRoomLost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool IsConnected => base.IsConnected && client.IsConnected.Value;
|
||||||
|
|
||||||
protected override Drawable CreateMainContent() => new Container
|
protected override Drawable CreateMainContent() => new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -253,14 +251,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
private bool exitConfirmed;
|
private bool exitConfirmed;
|
||||||
|
|
||||||
public override bool OnExiting(ScreenExitEvent e)
|
public override bool OnExiting(ScreenExitEvent e)
|
||||||
{
|
|
||||||
// the room may not be left immediately after a disconnection due to async flow,
|
|
||||||
// so checking the MultiplayerClient / IAPIAccess statuses is also required.
|
|
||||||
if (client.Room == null || !client.IsConnected.Value || api.State.Value != APIState.Online)
|
|
||||||
{
|
{
|
||||||
// room has not been created yet or we're offline; exit immediately.
|
// room has not been created yet or we're offline; exit immediately.
|
||||||
|
if (client.Room == null || !IsConnected)
|
||||||
return base.OnExiting(e);
|
return base.OnExiting(e);
|
||||||
}
|
|
||||||
|
|
||||||
if (!exitConfirmed && dialogOverlay != null)
|
if (!exitConfirmed && dialogOverlay != null)
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
@ -15,8 +13,8 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
|
|
||||||
public virtual string ShortTitle => Title;
|
public virtual string ShortTitle => Title;
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved]
|
||||||
protected IRoomManager RoomManager { get; private set; }
|
protected IRoomManager? RoomManager { get; private set; }
|
||||||
|
|
||||||
protected OnlinePlaySubScreen()
|
protected OnlinePlaySubScreen()
|
||||||
{
|
{
|
||||||
|
@ -162,17 +162,20 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
|
|
||||||
realmWriteTask = realm.WriteAsync(r =>
|
realmWriteTask = realm.WriteAsync(r =>
|
||||||
{
|
{
|
||||||
var settings = r.Find<BeatmapInfo>(beatmap.Value.BeatmapInfo.ID)?.UserSettings;
|
var setInfo = r.Find<BeatmapSetInfo>(beatmap.Value.BeatmapSetInfo.ID);
|
||||||
|
|
||||||
if (settings == null) // only the case for tests.
|
if (setInfo == null) // only the case for tests.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Apply to all difficulties in a beatmap set for now (they generally always share timing).
|
||||||
|
foreach (var b in setInfo.Beatmaps)
|
||||||
|
{
|
||||||
|
BeatmapUserSettings settings = b.UserSettings;
|
||||||
double val = Current.Value;
|
double val = Current.Value;
|
||||||
|
|
||||||
if (settings.Offset == val)
|
if (settings.Offset != val)
|
||||||
return;
|
|
||||||
|
|
||||||
settings.Offset = val;
|
settings.Offset = val;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user