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

Add support for sliderwhistle

This commit is contained in:
smoogipoo 2021-04-08 20:19:41 +09:00
parent 1e23f671fa
commit 7713c8a45f
2 changed files with 10 additions and 3 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using JetBrains.Annotations; using JetBrains.Annotations;
using osuTK; using osuTK;
@ -110,13 +111,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
base.LoadSamples(); base.LoadSamples();
var firstSample = HitObject.Samples.FirstOrDefault(); var firstSample = HitObject.OriginalSamples.FirstOrDefault();
if (firstSample != null) 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();
} }
} }

View File

@ -81,6 +81,8 @@ namespace osu.Game.Rulesets.Osu.Objects
public List<IList<HitSampleInfo>> NodeSamples { get; set; } = new List<IList<HitSampleInfo>>(); public List<IList<HitSampleInfo>> NodeSamples { get; set; } = new List<IList<HitSampleInfo>>();
public IList<HitSampleInfo> OriginalSamples { get; private set; }
private int repeatCount; private int repeatCount;
public int RepeatCount public int RepeatCount
@ -147,6 +149,7 @@ namespace osu.Game.Rulesets.Osu.Objects
// 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. // 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. // 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). // 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(); Samples = this.GetNodeSamples(repeatCount + 1).ToArray();
} }