mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 10:22:56 +08:00
parent
187a025d36
commit
bb7618eb0c
@ -262,21 +262,13 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
public bool OnPressed(ManiaAction action)
|
public bool OnPressed(ManiaAction action)
|
||||||
{
|
{
|
||||||
// Play the sounds of the next hitobject
|
if (action != Action)
|
||||||
if (HitObjects.AliveObjects.Any())
|
return false;
|
||||||
{
|
|
||||||
// If there are alive hitobjects, we can abuse the fact that AliveObjects are sorted by time (see: Add())
|
|
||||||
HitObjects.AliveObjects.First().PlaySamples();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// If not, we do a slow search - we might want to do a BinarySearch here if this becomes problematic
|
|
||||||
// We fallback to LastOrDefault() if we're beyond the last note in the map
|
|
||||||
var hitObject = HitObjects.Objects.FirstOrDefault(h => h.HitObject.StartTime > Time.Current) ?? HitObjects.Objects.LastOrDefault();
|
|
||||||
hitObject?.PlaySamples();
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
var hitObject = HitObjects.Objects.LastOrDefault(h => h.HitObject.StartTime > Time.Current) ?? HitObjects.Objects.FirstOrDefault();
|
||||||
|
hitObject?.PlaySamples();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(ManiaAction action) => false;
|
public bool OnReleased(ManiaAction action) => false;
|
||||||
|
Loading…
Reference in New Issue
Block a user