Updating progressBar.EndTime is more thread safe

This commit is contained in:
Jai Sharma 2017-06-23 18:24:46 +01:00
parent 62aae899fa
commit a327f49d68
2 changed files with 11 additions and 7 deletions

View File

@ -293,17 +293,22 @@ private void beatmapChanged(WorkingBeatmap beatmap)
current = beatmapBacking.Value;
updateProgressBar(current?.Track);
updateProgressBarLimit(current?.Track);
updateDisplay(beatmapBacking, direction);
queuedDirection = null;
}
private void updateProgressBar(Track t)
private void updateProgressBarLimit(Track t)
{
if (t?.IsLoaded ?? false)
progressBar.EndTime = t.Length;
else if (t != null)
if (t != null)
{
t.OnLoaded += loadedTrack => progressBar.EndTime = loadedTrack.Length;
if (t.IsLoaded)
{
progressBar.EndTime = t.Length;
t.OnLoaded = null;
}
}
}
private ScheduledDelegate pendingBeatmapSwitch;

View File

@ -12,7 +12,6 @@
using osu.Framework.Timing;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Screens.Play
{
public class SongProgress : OverlayContainer
@ -92,7 +91,7 @@ public SongProgress()
Alpha = 0,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
OnSeek = position => this.OnSeek?.Invoke(position),
OnSeek = position => OnSeek?.Invoke(position),
},
};
}