1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 01:47:24 +08:00

Fix taiko autoplay sometimes missing (#7427)

Fix taiko autoplay sometimes missing
This commit is contained in:
Dean Herbert 2020-01-03 16:51:24 +09:00 committed by GitHub
commit a989f82f13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,41 +121,13 @@ namespace osu.Game.Rulesets.Taiko.Replays
var nextHitObject = GetNextObject(i); // Get the next object that requires pressing the same button
bool canDelayKeyUp = nextHitObject == null || nextHitObject.StartTime > endTime + KEY_UP_DELAY;
double calculatedDelay = canDelayKeyUp ? KEY_UP_DELAY : (nextHitObject.StartTime - endTime) * 0.9;
Frames.Add(new TaikoReplayFrame(endTime + calculatedDelay));
if (i < Beatmap.HitObjects.Count - 1)
{
double waitTime = Beatmap.HitObjects[i + 1].StartTime - 1000;
if (waitTime > endTime)
Frames.Add(new TaikoReplayFrame(waitTime));
}
hitButton = !hitButton;
}
return Replay;
}
protected override HitObject GetNextObject(int currentIndex)
{
Type desiredType = Beatmap.HitObjects[currentIndex].GetType();
for (int i = currentIndex + 1; i < Beatmap.HitObjects.Count; i++)
{
var currentObj = Beatmap.HitObjects[i];
if (currentObj.GetType() == desiredType ||
// Un-press all keys before a DrumRoll or Swell
currentObj is DrumRoll || currentObj is Swell)
{
return Beatmap.HitObjects[i];
}
}
return null;
}
}
}