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

Cache IScrollingInfo at a HitObjectComposer level automatically

This commit is contained in:
Dean Herbert 2023-10-17 16:42:22 +09:00
parent 6f4a2b9889
commit d26d4b8b79
No known key found for this signature in database
4 changed files with 7 additions and 9 deletions

View File

@ -57,16 +57,9 @@ namespace osu.Game.Rulesets.Mania.Edit
protected override Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpacePosition) =>
Playfield.GetColumnByPosition(screenSpacePosition);
protected override DrawableRuleset<ManiaHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods)
{
protected override DrawableRuleset<ManiaHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods) =>
drawableRuleset = new DrawableManiaEditorRuleset(ruleset, beatmap, mods);
// This is the earliest we can cache the scrolling info to ourselves, before masks are added to the hierarchy and inject it
dependencies.CacheAs(drawableRuleset.ScrollingInfo);
return drawableRuleset;
}
protected override ComposeBlueprintContainer CreateBlueprintContainer()
=> new ManiaBlueprintContainer(this);

View File

@ -119,6 +119,9 @@ namespace osu.Game.Rulesets.Edit
return;
}
if (DrawableRuleset is IDrawableScrollingRuleset scrollingRuleset)
dependencies.CacheAs(scrollingRuleset.ScrollingInfo);
dependencies.CacheAs(Playfield);
InternalChildren = new Drawable[]

View File

@ -81,7 +81,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
/// </summary>
protected readonly SortedList<MultiplierControlPoint> ControlPoints = new SortedList<MultiplierControlPoint>(Comparer<MultiplierControlPoint>.Default);
protected IScrollingInfo ScrollingInfo => scrollingInfo;
public IScrollingInfo ScrollingInfo => scrollingInfo;
[Cached(Type = typeof(IScrollingInfo))]
private readonly LocalScrollingInfo scrollingInfo;

View File

@ -11,5 +11,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
public interface IDrawableScrollingRuleset
{
ScrollVisualisationMethod VisualisationMethod { get; }
IScrollingInfo ScrollingInfo { get; }
}
}