mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:42:54 +08:00
Reduce code repetition for sleep logic
This commit is contained in:
parent
67650831bd
commit
1a6381bcbb
@ -132,11 +132,7 @@ namespace osu.Game
|
||||
|
||||
foreach (var id in beatmapSetIds)
|
||||
{
|
||||
while (localUserPlayInfo?.IsPlaying.Value == true)
|
||||
{
|
||||
Logger.Log("Background processing sleeping due to active gameplay...");
|
||||
Thread.Sleep(TimeToSleepDuringGameplay);
|
||||
}
|
||||
sleepIfRequired();
|
||||
|
||||
realmAccess.Run(r =>
|
||||
{
|
||||
@ -177,11 +173,7 @@ namespace osu.Game
|
||||
|
||||
foreach (var id in scoreIds)
|
||||
{
|
||||
while (localUserPlayInfo?.IsPlaying.Value == true)
|
||||
{
|
||||
Logger.Log("Background processing sleeping due to active gameplay...");
|
||||
Thread.Sleep(TimeToSleepDuringGameplay);
|
||||
}
|
||||
sleepIfRequired();
|
||||
|
||||
try
|
||||
{
|
||||
@ -229,7 +221,9 @@ namespace osu.Game
|
||||
|
||||
ProgressNotification? notification = null;
|
||||
|
||||
if (scoreIds.Count > 0)
|
||||
if (scoreIds.Count == 0)
|
||||
return;
|
||||
|
||||
notificationOverlay?.Post(notification = new ProgressNotification { State = ProgressNotificationState.Active });
|
||||
|
||||
int count = 0;
|
||||
@ -237,11 +231,7 @@ namespace osu.Game
|
||||
|
||||
foreach (var id in scoreIds)
|
||||
{
|
||||
while (localUserPlayInfo?.IsPlaying.Value == true)
|
||||
{
|
||||
Logger.Log("Background processing sleeping due to active gameplay...");
|
||||
Thread.Sleep(TimeToSleepDuringGameplay);
|
||||
}
|
||||
sleepIfRequired();
|
||||
|
||||
try
|
||||
{
|
||||
@ -286,5 +276,14 @@ namespace osu.Game
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sleepIfRequired()
|
||||
{
|
||||
while (localUserPlayInfo?.IsPlaying.Value == true)
|
||||
{
|
||||
Logger.Log("Background processing sleeping due to active gameplay...");
|
||||
Thread.Sleep(TimeToSleepDuringGameplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user