mirror of https://github.com/ppy/osu
Add support for sliderwhistle
This commit is contained in:
parent
1e23f671fa
commit
7713c8a45f
|
@ -2,6 +2,7 @@
|
|||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osuTK;
|
||||
|
@ -110,13 +111,16 @@ protected override void LoadSamples()
|
|||
{
|
||||
base.LoadSamples();
|
||||
|
||||
var firstSample = HitObject.Samples.FirstOrDefault();
|
||||
var firstSample = HitObject.OriginalSamples.FirstOrDefault();
|
||||
|
||||
if (firstSample != null)
|
||||
{
|
||||
var clone = HitObject.SampleControlPoint.ApplyTo(firstSample).With("sliderslide");
|
||||
var samples = new List<ISampleInfo> { HitObject.SampleControlPoint.ApplyTo(firstSample).With("sliderslide") };
|
||||
|
||||
slidingSample.Samples = new ISampleInfo[] { clone };
|
||||
if (HitObject.OriginalSamples.Any(s => s.Name == HitSampleInfo.HIT_WHISTLE))
|
||||
samples.Add(HitObject.SampleControlPoint.ApplyTo(firstSample).With("sliderwhistle"));
|
||||
|
||||
slidingSample.Samples = samples.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,8 @@ public override Vector2 Position
|
|||
|
||||
public List<IList<HitSampleInfo>> NodeSamples { get; set; } = new List<IList<HitSampleInfo>>();
|
||||
|
||||
public IList<HitSampleInfo> OriginalSamples { get; private set; }
|
||||
|
||||
private int repeatCount;
|
||||
|
||||
public int RepeatCount
|
||||
|
@ -147,6 +149,7 @@ protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, B
|
|||
// The samples should be attached to the slider tail, however this can only be done after LegacyLastTick is removed otherwise they would play earlier than they're intended to.
|
||||
// For now, the samples are attached to and played by the slider itself at the correct end time.
|
||||
// ToArray call is required as GetNodeSamples may fallback to Samples itself (without it it will get cleared due to the list reference being live).
|
||||
OriginalSamples = Samples.ToList();
|
||||
Samples = this.GetNodeSamples(repeatCount + 1).ToArray();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue