1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 15:03:13 +08:00

remove other usages of hitobject SampleControlPoint

This commit is contained in:
OliBomby 2023-04-25 16:01:43 +02:00
parent a634617157
commit ebe1d852f5
5 changed files with 7 additions and 14 deletions

View File

@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Edit.Checks
yield break;
// Samples that allow themselves to be overridden by control points have a volume of 0.
int maxVolume = sampledHitObject.Samples.Max(sample => sample.Volume > 0 ? sample.Volume : sampledHitObject.SampleControlPoint.SampleVolume);
int maxVolume = sampledHitObject.Samples.Max(sample => sample.Volume);
double samplePlayTime = sampledHitObject.GetEndTime();
EdgeType edgeType = getEdgeAtTime(hitObject, samplePlayTime);

View File

@ -74,9 +74,9 @@ namespace osu.Game.Rulesets.Edit
/// <param name="commitStart">Whether this call is committing a value for HitObject.StartTime and continuing with further adjustments.</param>
protected void BeginPlacement(bool commitStart = false)
{
var nearestSampleControlPoint = beatmap.HitObjects.LastOrDefault(h => h.GetEndTime() < HitObject.StartTime)?.SampleControlPoint?.DeepClone() as SampleControlPoint;
HitObject.SampleControlPoint = nearestSampleControlPoint ?? new SampleControlPoint();
// 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);
HitObject.Samples.Add(lastHitNormal);
placementHandler.BeginPlacement(HitObject);
if (commitStart)

View File

@ -357,13 +357,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
if (samples.Length <= 0)
return;
if (HitObject.SampleControlPoint == null)
{
throw new InvalidOperationException($"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}."
+ $" This is an indication that {nameof(HitObject.ApplyDefaults)} has not been invoked on {this}.");
}
Samples.Samples = samples.Select(s => HitObject.SampleControlPoint.ApplyTo(s)).Cast<ISampleInfo>().ToArray();
Samples.Samples = samples.Cast<ISampleInfo>().ToArray();
}
private void onSamplesChanged(object sender, NotifyCollectionChangedEventArgs e) => LoadSamples();

View File

@ -52,7 +52,6 @@ namespace osu.Game.Rulesets.UI
return;
var samples = nextObject.Samples
.Select(s => nextObject.SampleControlPoint.ApplyTo(s))
.Cast<ISampleInfo>()
.ToArray();

View File

@ -293,10 +293,10 @@ namespace osu.Game.Rulesets.UI
{
// prepare sample pools ahead of time so we're not initialising at runtime.
foreach (var sample in hitObject.Samples)
prepareSamplePool(hitObject.SampleControlPoint.ApplyTo(sample));
prepareSamplePool(sample);
foreach (var sample in hitObject.AuxiliarySamples)
prepareSamplePool(hitObject.SampleControlPoint.ApplyTo(sample));
prepareSamplePool(sample);
foreach (var nestedObject in hitObject.NestedHitObjects)
preloadSamples(nestedObject);