mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 04:13:00 +08:00
Refactor BeatSyncContainer to handle zero length tracks
This commit is contained in:
parent
d73ef7c37e
commit
c1f52ef594
@ -59,9 +59,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
Track track = null;
|
Track track = null;
|
||||||
IBeatmap beatmap = null;
|
IBeatmap beatmap = null;
|
||||||
|
|
||||||
double currentTrackTime;
|
double currentTrackTime = 0;
|
||||||
TimingControlPoint timingPoint;
|
TimingControlPoint timingPoint = null;
|
||||||
EffectControlPoint effectPoint;
|
EffectControlPoint effectPoint = null;
|
||||||
|
|
||||||
if (Beatmap.Value.TrackLoaded && Beatmap.Value.BeatmapLoaded)
|
if (Beatmap.Value.TrackLoaded && Beatmap.Value.BeatmapLoaded)
|
||||||
{
|
{
|
||||||
@ -69,24 +69,18 @@ namespace osu.Game.Graphics.Containers
|
|||||||
beatmap = Beatmap.Value.Beatmap;
|
beatmap = Beatmap.Value.Beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (track != null && beatmap != null && track.IsRunning)
|
if (track != null && beatmap != null && track.IsRunning && track.Length > 0)
|
||||||
{
|
{
|
||||||
currentTrackTime = track.Length > 0 ? track.CurrentTime + EarlyActivationMilliseconds : Clock.CurrentTime;
|
currentTrackTime = track.CurrentTime + EarlyActivationMilliseconds;
|
||||||
|
|
||||||
timingPoint = beatmap.ControlPointInfo.TimingPointAt(currentTrackTime);
|
timingPoint = beatmap.ControlPointInfo.TimingPointAt(currentTrackTime);
|
||||||
effectPoint = beatmap.ControlPointInfo.EffectPointAt(currentTrackTime);
|
effectPoint = beatmap.ControlPointInfo.EffectPointAt(currentTrackTime);
|
||||||
|
|
||||||
if (timingPoint.BeatLength == 0)
|
|
||||||
{
|
|
||||||
IsBeatSyncedWithTrack = false;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IsBeatSyncedWithTrack = true;
|
IsBeatSyncedWithTrack = timingPoint?.BeatLength > 0;
|
||||||
}
|
|
||||||
else
|
if (timingPoint == null || !IsBeatSyncedWithTrack)
|
||||||
{
|
{
|
||||||
IsBeatSyncedWithTrack = false;
|
|
||||||
currentTrackTime = Clock.CurrentTime;
|
currentTrackTime = Clock.CurrentTime;
|
||||||
timingPoint = defaultTiming;
|
timingPoint = defaultTiming;
|
||||||
effectPoint = defaultEffect;
|
effectPoint = defaultEffect;
|
||||||
|
Loading…
Reference in New Issue
Block a user