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:
parent
8a9a6c733c
commit
74ab036f3e
@ -376,7 +376,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
|
||||
protected override void OnFree()
|
||||
{
|
||||
slidingSample.Samples = null;
|
||||
slidingSample.ClearSamples();
|
||||
base.OnFree();
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -119,7 +119,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
base.OnFree();
|
||||
|
||||
spinningSample.Samples = null;
|
||||
spinningSample.ClearSamples();
|
||||
}
|
||||
|
||||
protected override void LoadSamples()
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user