Fix beat playing while paused

This commit is contained in:
Dean Herbert 2019-12-16 18:51:22 +09:00
parent c883c97bab
commit 0f9ff32cdc
2 changed files with 15 additions and 1 deletions

View File

@ -42,6 +42,8 @@ public class BeatSyncedContainer : Container
private EffectControlPoint defaultEffect;
private TrackAmplitudes defaultAmplitudes;
protected bool IsBeatSyncedWithTrack { get; private set; }
protected override void Update()
{
Track track = null;
@ -65,10 +67,16 @@ protected override void Update()
effectPoint = beatmap.ControlPointInfo.EffectPointAt(currentTrackTime);
if (timingPoint.BeatLength == 0)
{
IsBeatSyncedWithTrack = false;
return;
}
IsBeatSyncedWithTrack = true;
}
else
{
IsBeatSyncedWithTrack = false;
currentTrackTime = Clock.CurrentTime;
timingPoint = defaultTiming;
effectPoint = defaultEffect;

View File

@ -75,7 +75,13 @@ protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint,
{
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
if (beatIndex < firstBeat || !firstBeat.HasValue)
if (!IsBeatSyncedWithTrack)
{
firstBeat = null;
return;
}
if (!firstBeat.HasValue || beatIndex < firstBeat)
firstBeat = Math.Max(0, (beatIndex / 16 + 1) * 16);
if (beatIndex > firstBeat)