1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Refactor SkinnableSound.Samples to be non-nullable

This commit is contained in:
Dean Herbert 2023-01-27 19:32:30 +09:00
parent 8a9a6c733c
commit 74ab036f3e
5 changed files with 7 additions and 8 deletions

View File

@ -376,7 +376,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
protected override void OnFree()
{
slidingSample.Samples = null;
slidingSample.ClearSamples();
base.OnFree();
}
}

View File

@ -126,7 +126,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
PathVersion.UnbindFrom(HitObject.Path.Version);
slidingSample.Samples = null;
slidingSample?.ClearSamples();
}
protected override void LoadSamples()

View File

@ -119,7 +119,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
base.OnFree();
spinningSample.Samples = null;
spinningSample.ClearSamples();
}
protected override void LoadSamples()

View File

@ -303,8 +303,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
samplesBindable.CollectionChanged -= onSamplesChanged;
// Release the samples for other hitobjects to use.
if (Samples != null)
Samples.Samples = null;
Samples?.ClearSamples();
foreach (var obj in nestedHitObjects)
{

View File

@ -75,13 +75,11 @@ namespace osu.Game.Skinning
/// <summary>
/// The samples that should be played.
/// </summary>
public ISampleInfo[]? Samples
public ISampleInfo[] Samples
{
get => samples;
set
{
value ??= Array.Empty<ISampleInfo>();
if (samples == value)
return;
@ -92,6 +90,8 @@ namespace osu.Game.Skinning
}
}
public void ClearSamples() => Samples = Array.Empty<ISampleInfo>();
private bool looping;
/// <summary>