mirror of
https://github.com/osukey/osukey.git
synced 2025-05-02 20:27:27 +09:00
Move scheduler call to inside method itself for added safety
This commit is contained in:
parent
29e8e5ab94
commit
cfe3218239
@ -101,7 +101,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
beatmapDifficulty?.UnbindAll();
|
beatmapDifficulty?.UnbindAll();
|
||||||
beatmapDifficulty = difficultyManager.GetBindableDifficulty(beatmap.BeatmapInfo, cancellationSource.Token);
|
beatmapDifficulty = difficultyManager.GetBindableDifficulty(beatmap.BeatmapInfo, cancellationSource.Token);
|
||||||
beatmapDifficulty.BindValueChanged(_ => Schedule(updateDisplay));
|
beatmapDifficulty.BindValueChanged(_ => updateDisplay());
|
||||||
|
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
}
|
}
|
||||||
@ -113,33 +113,38 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
void removeOldInfo()
|
Scheduler.AddOnce(perform);
|
||||||
{
|
|
||||||
State.Value = beatmap == null ? Visibility.Hidden : Visibility.Visible;
|
|
||||||
|
|
||||||
Info?.FadeOut(250);
|
void perform()
|
||||||
Info?.Expire();
|
{
|
||||||
Info = null;
|
void removeOldInfo()
|
||||||
|
{
|
||||||
|
State.Value = beatmap == null ? Visibility.Hidden : Visibility.Visible;
|
||||||
|
|
||||||
|
Info?.FadeOut(250);
|
||||||
|
Info?.Expire();
|
||||||
|
Info = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (beatmap == null)
|
||||||
|
{
|
||||||
|
removeOldInfo();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadComponentAsync(loadingInfo = new BufferedWedgeInfo(beatmap, ruleset.Value, beatmapDifficulty.Value)
|
||||||
|
{
|
||||||
|
Shear = -Shear,
|
||||||
|
Depth = Info?.Depth + 1 ?? 0
|
||||||
|
}, loaded =>
|
||||||
|
{
|
||||||
|
// ensure we are the most recent loaded wedge.
|
||||||
|
if (loaded != loadingInfo) return;
|
||||||
|
|
||||||
|
removeOldInfo();
|
||||||
|
Add(Info = loaded);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (beatmap == null)
|
|
||||||
{
|
|
||||||
removeOldInfo();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadComponentAsync(loadingInfo = new BufferedWedgeInfo(beatmap, ruleset.Value, beatmapDifficulty.Value)
|
|
||||||
{
|
|
||||||
Shear = -Shear,
|
|
||||||
Depth = Info?.Depth + 1 ?? 0
|
|
||||||
}, loaded =>
|
|
||||||
{
|
|
||||||
// ensure we are the most recent loaded wedge.
|
|
||||||
if (loaded != loadingInfo) return;
|
|
||||||
|
|
||||||
removeOldInfo();
|
|
||||||
Add(Info = loaded);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user