1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 09:42:55 +08:00

Refactoring

This commit is contained in:
Desconocidosmh 2019-08-19 20:45:23 +02:00
parent 9bd844bf4d
commit 77e9e89fec
2 changed files with 6 additions and 6 deletions

View File

@ -81,14 +81,14 @@ namespace osu.Game.Rulesets.Mania.Replays
for (int i = 0; i < Beatmap.HitObjects.Count; i++) for (int i = 0; i < Beatmap.HitObjects.Count; i++)
{ {
var currentObject = Beatmap.HitObjects[i]; var currentObject = Beatmap.HitObjects[i];
var nextObjectInTheSameColumn = GetNextObject(i); var nextObjectInColumn = GetNextObject(i); // Get the next object that requires pressing the same button
double endTime = (currentObject as IHasEndTime)?.EndTime ?? currentObject.StartTime; double endTime = (currentObject as IHasEndTime)?.EndTime ?? currentObject.StartTime;
bool canDelayKeyUp = nextObjectInTheSameColumn == null || bool canDelayKeyUp = nextObjectInColumn == null ||
nextObjectInTheSameColumn.StartTime > endTime + RELEASE_DELAY; nextObjectInColumn.StartTime > endTime + RELEASE_DELAY;
double calculatedDelay = canDelayKeyUp ? RELEASE_DELAY : (nextObjectInTheSameColumn.StartTime - endTime) * 0.9; double calculatedDelay = canDelayKeyUp ? RELEASE_DELAY : (nextObjectInColumn.StartTime - endTime) * 0.9;
yield return new HitPoint { Time = currentObject.StartTime, Column = currentObject.Column }; yield return new HitPoint { Time = currentObject.StartTime, Column = currentObject.Column };

View File

@ -114,7 +114,7 @@ namespace osu.Game.Rulesets.Taiko.Replays
else else
throw new InvalidOperationException("Unknown hit object type."); throw new InvalidOperationException("Unknown hit object type.");
var nextHitObject = GetNextObject(i); var nextHitObject = GetNextObject(i); // Get the next object that requires pressing the same button
bool canDelayKeyUp = nextHitObject == null || nextHitObject.StartTime > endTime + KEY_UP_DELAY; bool canDelayKeyUp = nextHitObject == null || nextHitObject.StartTime > endTime + KEY_UP_DELAY;
@ -142,7 +142,7 @@ namespace osu.Game.Rulesets.Taiko.Replays
for (; currentIndex < Beatmap.HitObjects.Count; currentIndex++) for (; currentIndex < Beatmap.HitObjects.Count; currentIndex++)
{ {
var currentObj = Beatmap.HitObjects[currentIndex]; var currentObj = Beatmap.HitObjects[currentIndex];
if (currentObj.GetType().Equals(desiredType) || if (currentObj.GetType() == desiredType ||
currentObj is DrumRoll || currentObj is Swell) // Unpress all keys before DrumRoll or Swell currentObj is DrumRoll || currentObj is Swell) // Unpress all keys before DrumRoll or Swell
return Beatmap.HitObjects[currentIndex]; return Beatmap.HitObjects[currentIndex];
} }