mirror of
https://github.com/osukey/osukey.git
synced 2025-05-03 20:57:28 +09:00
Improve previous hitobject lookup efficient and correctness
This commit is contained in:
parent
7d7d402d4e
commit
e43f2c2c43
@ -44,6 +44,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
private Bindable<double> startTimeBindable = null!;
|
private Bindable<double> startTimeBindable = null!;
|
||||||
|
|
||||||
|
private HitObject? getPreviousHitObject() => beatmap.HitObjects.TakeWhile(h => h.StartTime <= startTimeBindable.Value).LastOrDefault();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IPlacementHandler placementHandler { get; set; } = null!;
|
private IPlacementHandler placementHandler { get; set; } = null!;
|
||||||
|
|
||||||
@ -84,7 +86,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
protected void BeginPlacement(bool commitStart = false)
|
protected void BeginPlacement(bool commitStart = false)
|
||||||
{
|
{
|
||||||
// Take the hitnormal sample of the last hit object
|
// Take the hitnormal sample of the last hit object
|
||||||
var lastHitNormal = beatmap.HitObjects.LastOrDefault(h => h.GetEndTime() < HitObject.StartTime)?.Samples?.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL);
|
var lastHitNormal = getPreviousHitObject()?.Samples?.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL);
|
||||||
if (lastHitNormal != null)
|
if (lastHitNormal != null)
|
||||||
HitObject.Samples[0] = lastHitNormal;
|
HitObject.Samples[0] = lastHitNormal;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user