mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 15:27:30 +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,19 +221,17 @@ namespace osu.Game
|
||||
|
||||
ProgressNotification? notification = null;
|
||||
|
||||
if (scoreIds.Count > 0)
|
||||
notificationOverlay?.Post(notification = new ProgressNotification { State = ProgressNotificationState.Active });
|
||||
if (scoreIds.Count == 0)
|
||||
return;
|
||||
|
||||
notificationOverlay?.Post(notification = new ProgressNotification { State = ProgressNotificationState.Active });
|
||||
|
||||
int count = 0;
|
||||
updateNotification();
|
||||
|
||||
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