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
1 changed files with 8 additions and 0 deletions

View File

@ -9,6 +9,7 @@
using osu.Game;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Screens.Play;
using Squirrel;
using Squirrel.SimpleSplat;
using LogLevel = Squirrel.SimpleSplat.LogLevel;
@ -36,6 +37,9 @@ public partial class SquirrelUpdateManager : UpdateManager
[Resolved]
private OsuGameBase game { get; set; } = null!;
[Resolved]
private ILocalUserPlayInfo? localUserInfo { get; set; }
[BackgroundDependencyLoader]
private void load(INotificationOverlay notifications)
{
@ -55,6 +59,10 @@ private async Task<bool> checkForUpdateAsync(bool useDeltaPatching = true, Updat
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");
var info = await updateManager.CheckForUpdate(!useDeltaPatching).ConfigureAwait(false);