mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 20:12:57 +08:00
Updating progressBar.EndTime is more thread safe
This commit is contained in:
parent
62aae899fa
commit
a327f49d68
@ -293,17 +293,22 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
current = beatmapBacking.Value;
|
current = beatmapBacking.Value;
|
||||||
|
|
||||||
updateProgressBar(current?.Track);
|
updateProgressBarLimit(current?.Track);
|
||||||
updateDisplay(beatmapBacking, direction);
|
updateDisplay(beatmapBacking, direction);
|
||||||
queuedDirection = null;
|
queuedDirection = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateProgressBar(Track t)
|
private void updateProgressBarLimit(Track t)
|
||||||
{
|
{
|
||||||
if (t?.IsLoaded ?? false)
|
if (t != null)
|
||||||
progressBar.EndTime = t.Length;
|
{
|
||||||
else if (t != null)
|
|
||||||
t.OnLoaded += loadedTrack => progressBar.EndTime = loadedTrack.Length;
|
t.OnLoaded += loadedTrack => progressBar.EndTime = loadedTrack.Length;
|
||||||
|
if (t.IsLoaded)
|
||||||
|
{
|
||||||
|
progressBar.EndTime = t.Length;
|
||||||
|
t.OnLoaded = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScheduledDelegate pendingBeatmapSwitch;
|
private ScheduledDelegate pendingBeatmapSwitch;
|
||||||
|
@ -12,7 +12,6 @@ using System.Linq;
|
|||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class SongProgress : OverlayContainer
|
public class SongProgress : OverlayContainer
|
||||||
@ -92,7 +91,7 @@ namespace osu.Game.Screens.Play
|
|||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
OnSeek = position => this.OnSeek?.Invoke(position),
|
OnSeek = position => OnSeek?.Invoke(position),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user