mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Remove usage of Lazy<List<...>> for NestedHitObjects
This commit is contained in:
@ -56,8 +56,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
|
|
||||||
public virtual IEnumerable<HitSampleInfo> GetSamples() => HitObject.Samples;
|
public virtual IEnumerable<HitSampleInfo> GetSamples() => HitObject.Samples;
|
||||||
|
|
||||||
private readonly Lazy<List<DrawableHitObject>> nestedHitObjects = new Lazy<List<DrawableHitObject>>();
|
private readonly List<DrawableHitObject> nestedHitObjects = new List<DrawableHitObject>();
|
||||||
public IReadOnlyList<DrawableHitObject> NestedHitObjects => nestedHitObjects.IsValueCreated ? nestedHitObjects.Value : (IReadOnlyList<DrawableHitObject>)Array.Empty<DrawableHitObject>();
|
public IReadOnlyList<DrawableHitObject> NestedHitObjects => nestedHitObjects;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this object should handle any user input events.
|
/// Whether this object should handle any user input events.
|
||||||
@ -249,7 +249,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
// Must be done before the nested DHO is added to occur before the nested Apply()!
|
// Must be done before the nested DHO is added to occur before the nested Apply()!
|
||||||
drawableNested.ParentHitObject = this;
|
drawableNested.ParentHitObject = this;
|
||||||
|
|
||||||
nestedHitObjects.Value.Add(drawableNested);
|
nestedHitObjects.Add(drawableNested);
|
||||||
AddNestedHitObject(drawableNested);
|
AddNestedHitObject(drawableNested);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,19 +305,16 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
if (Samples != null)
|
if (Samples != null)
|
||||||
Samples.Samples = null;
|
Samples.Samples = null;
|
||||||
|
|
||||||
if (nestedHitObjects.IsValueCreated)
|
foreach (var obj in nestedHitObjects)
|
||||||
{
|
{
|
||||||
foreach (var obj in nestedHitObjects.Value)
|
obj.OnNewResult -= onNewResult;
|
||||||
{
|
obj.OnRevertResult -= onRevertResult;
|
||||||
obj.OnNewResult -= onNewResult;
|
obj.ApplyCustomUpdateState -= onApplyCustomUpdateState;
|
||||||
obj.OnRevertResult -= onRevertResult;
|
|
||||||
obj.ApplyCustomUpdateState -= onApplyCustomUpdateState;
|
|
||||||
}
|
|
||||||
|
|
||||||
nestedHitObjects.Value.Clear();
|
|
||||||
ClearNestedHitObjects();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nestedHitObjects.Clear();
|
||||||
|
ClearNestedHitObjects();
|
||||||
|
|
||||||
HitObject.DefaultsApplied -= onDefaultsApplied;
|
HitObject.DefaultsApplied -= onDefaultsApplied;
|
||||||
|
|
||||||
OnFree();
|
OnFree();
|
||||||
|
Reference in New Issue
Block a user