1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 11:42:54 +08:00

Slight refactoring

This commit is contained in:
smoogipoo 2019-08-26 17:45:12 +09:00
parent fd4c6e08ca
commit d4a296f911
2 changed files with 13 additions and 9 deletions

View File

@ -98,12 +98,12 @@ namespace osu.Game.Rulesets.Mania.Replays
protected override HitObject GetNextObject(int currentIndex)
{
int desiredColumn = Beatmap.HitObjects[currentIndex++].Column;
int desiredColumn = Beatmap.HitObjects[currentIndex].Column;
for (; currentIndex < Beatmap.HitObjects.Count; currentIndex++)
for (int i = currentIndex + 1; i < Beatmap.HitObjects.Count; i++)
{
if (Beatmap.HitObjects[currentIndex].Column == desiredColumn)
return Beatmap.HitObjects[currentIndex];
if (Beatmap.HitObjects[i].Column == desiredColumn)
return Beatmap.HitObjects[i];
}
return null;

View File

@ -137,14 +137,18 @@ namespace osu.Game.Rulesets.Taiko.Replays
protected override HitObject GetNextObject(int currentIndex)
{
Type desiredType = Beatmap.HitObjects[currentIndex++].GetType();
Type desiredType = Beatmap.HitObjects[currentIndex].GetType();
for (; currentIndex < Beatmap.HitObjects.Count; currentIndex++)
for (int i = currentIndex + 1; i < Beatmap.HitObjects.Count; i++)
{
var currentObj = Beatmap.HitObjects[currentIndex];
var currentObj = Beatmap.HitObjects[i];
if (currentObj.GetType() == desiredType ||
currentObj is DrumRoll || currentObj is Swell) // Unpress all keys before DrumRoll or Swell
return Beatmap.HitObjects[currentIndex];
// Un-press all keys before a DrumRoll or Swell
currentObj is DrumRoll || currentObj is Swell)
{
return Beatmap.HitObjects[i];
}
}
return null;