Show path of juice stream in selection blueprint

This commit is contained in:
ekrctb
2021-07-06 16:46:12 +09:00
parent 7ef7c5148f
commit 0fa7716ced

View File

@ -3,7 +3,9 @@
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Caching;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Game.Rulesets.Catch.Edit.Blueprints.Components;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osuTK; using osuTK;
@ -17,9 +19,14 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints
private float minNestedX; private float minNestedX;
private float maxNestedX; private float maxNestedX;
private readonly ScrollingPath scrollingPath;
private readonly Cached pathCache = new Cached();
public JuiceStreamSelectionBlueprint(JuiceStream hitObject) public JuiceStreamSelectionBlueprint(JuiceStream hitObject)
: base(hitObject) : base(hitObject)
{ {
InternalChild = scrollingPath = new ScrollingPath();
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -29,7 +36,25 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints
computeObjectBounds(); computeObjectBounds();
} }
private void onDefaultsApplied(HitObject _) => computeObjectBounds(); protected override void Update()
{
base.Update();
if (!IsSelected) return;
scrollingPath.UpdatePositionFrom(HitObjectContainer, HitObject);
if (pathCache.IsValid) return;
scrollingPath.UpdatePathFrom(HitObjectContainer, HitObject);
pathCache.Validate();
}
private void onDefaultsApplied(HitObject _)
{
computeObjectBounds();
pathCache.Invalidate();
}
private void computeObjectBounds() private void computeObjectBounds()
{ {