1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Disallow game to check for updates while gameplay is active

This commit is contained in:
Dean Herbert 2023-05-23 18:06:04 +09:00
parent ff5dde0ebe
commit 7cf50b1e18

View File

@ -9,6 +9,7 @@ using osu.Framework.Logging;
using osu.Game; using osu.Game;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Notifications;
using osu.Game.Screens.Play;
using Squirrel; using Squirrel;
using Squirrel.SimpleSplat; using Squirrel.SimpleSplat;
using LogLevel = Squirrel.SimpleSplat.LogLevel; using LogLevel = Squirrel.SimpleSplat.LogLevel;
@ -36,6 +37,9 @@ namespace osu.Desktop.Updater
[Resolved] [Resolved]
private OsuGameBase game { get; set; } = null!; private OsuGameBase game { get; set; } = null!;
[Resolved]
private ILocalUserPlayInfo? localUserInfo { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(INotificationOverlay notifications) private void load(INotificationOverlay notifications)
{ {
@ -55,6 +59,10 @@ namespace osu.Desktop.Updater
try try
{ {
// Avoid any kind of update checking while gameplay is running.
if (localUserInfo?.IsPlaying.Value == true)
return false;
updateManager ??= new GithubUpdateManager(@"https://github.com/ppy/osu", false, github_token, @"osulazer"); updateManager ??= new GithubUpdateManager(@"https://github.com/ppy/osu", false, github_token, @"osulazer");
var info = await updateManager.CheckForUpdate(!useDeltaPatching).ConfigureAwait(false); var info = await updateManager.CheckForUpdate(!useDeltaPatching).ConfigureAwait(false);