mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 05:22:54 +08:00
replace linq usage in Previous
and Next
with more direct computation
This commit is contained in:
parent
4b847b68a2
commit
901b82384d
@ -4,7 +4,6 @@
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Difficulty.Preprocessing
|
||||
@ -65,8 +64,16 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing
|
||||
EndTime = hitObject.GetEndTime() / clockRate;
|
||||
}
|
||||
|
||||
public DifficultyHitObject Previous(int backwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Index - (backwardsIndex + 1));
|
||||
public DifficultyHitObject Previous(int backwardsIndex)
|
||||
{
|
||||
int index = Index - (backwardsIndex + 1);
|
||||
return index >= 0 && index < difficultyHitObjects.Count ? difficultyHitObjects[index] : default;
|
||||
}
|
||||
|
||||
public DifficultyHitObject Next(int forwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Index + (forwardsIndex + 1));
|
||||
public DifficultyHitObject Next(int forwardsIndex)
|
||||
{
|
||||
int index = Index + (forwardsIndex + 1);
|
||||
return index >= 0 && index < difficultyHitObjects.Count ? difficultyHitObjects[index] : default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user