mirror of
https://github.com/osukey/osukey.git
synced 2025-05-04 05:07:23 +09:00
Merge pull request #10803 from smoogipoo/nested-hitobject-pooling
Add nested hitobject pooling
This commit is contained in:
commit
df7032bc6c
@ -20,6 +20,7 @@ using osu.Game.Rulesets.Objects.Types;
|
|||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Drawables
|
namespace osu.Game.Rulesets.Objects.Drawables
|
||||||
@ -135,6 +136,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private HitObjectLifetimeEntry lifetimeEntry;
|
private HitObjectLifetimeEntry lifetimeEntry;
|
||||||
|
|
||||||
|
[Resolved(CanBeNull = true)]
|
||||||
|
private DrawableRuleset drawableRuleset { get; set; }
|
||||||
|
|
||||||
private Container<PausableSkinnableSound> samplesContainer;
|
private Container<PausableSkinnableSound> samplesContainer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -208,7 +212,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
|
|
||||||
foreach (var h in HitObject.NestedHitObjects)
|
foreach (var h in HitObject.NestedHitObjects)
|
||||||
{
|
{
|
||||||
var drawableNested = CreateNestedHitObject(h) ?? throw new InvalidOperationException($"{nameof(CreateNestedHitObject)} returned null for {h.GetType().ReadableName()}.");
|
var drawableNested = drawableRuleset?.GetPooledDrawableRepresentation(h)
|
||||||
|
?? CreateNestedHitObject(h)
|
||||||
|
?? throw new InvalidOperationException($"{nameof(CreateNestedHitObject)} returned null for {h.GetType().ReadableName()}.");
|
||||||
|
|
||||||
drawableNested.OnNewResult += onNewResult;
|
drawableNested.OnNewResult += onNewResult;
|
||||||
drawableNested.OnRevertResult += onRevertResult;
|
drawableNested.OnRevertResult += onRevertResult;
|
||||||
@ -216,6 +222,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
|
|
||||||
nestedHitObjects.Value.Add(drawableNested);
|
nestedHitObjects.Value.Add(drawableNested);
|
||||||
AddNestedHitObject(drawableNested);
|
AddNestedHitObject(drawableNested);
|
||||||
|
|
||||||
|
drawableNested.OnParentReceived(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
StartTimeBindable.BindTo(HitObject.StartTimeBindable);
|
StartTimeBindable.BindTo(HitObject.StartTimeBindable);
|
||||||
@ -309,6 +317,14 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when this <see cref="DrawableHitObject"/> receives a new parenting <see cref="DrawableHitObject"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parent">The parenting <see cref="DrawableHitObject"/>.</param>
|
||||||
|
protected virtual void OnParentReceived(DrawableHitObject parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked by the base <see cref="DrawableHitObject"/> to populate samples, once on initial load and potentially again on any change to the samples collection.
|
/// Invoked by the base <see cref="DrawableHitObject"/> to populate samples, once on initial load and potentially again on any change to the samples collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user