mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Fix sliders not moving with stacking change
This commit is contained in:
@ -111,6 +111,21 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
AddStep("Distance Overflow 1 Repeat", () => SetContents(() => testDistanceOverflow(1)));
|
AddStep("Distance Overflow 1 Repeat", () => SetContents(() => testDistanceOverflow(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangeStackHeight()
|
||||||
|
{
|
||||||
|
DrawableSlider slider = null;
|
||||||
|
|
||||||
|
AddStep("create slider", () =>
|
||||||
|
{
|
||||||
|
slider = (DrawableSlider)createSlider(repeats: 1);
|
||||||
|
Add(slider);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("change stack height", () => slider.HitObject.StackHeight = 10);
|
||||||
|
AddAssert("body positioned correctly", () => slider.Position == slider.HitObject.StackedPosition);
|
||||||
|
}
|
||||||
|
|
||||||
private Drawable testSimpleBig(int repeats = 0) => createSlider(2, repeats: repeats);
|
private Drawable testSimpleBig(int repeats = 0) => createSlider(2, repeats: repeats);
|
||||||
|
|
||||||
private Drawable testSimpleBigLargeStackOffset(int repeats = 0) => createSlider(2, repeats: repeats, stackHeight: 10);
|
private Drawable testSimpleBigLargeStackOffset(int repeats = 0) => createSlider(2, repeats: repeats, stackHeight: 10);
|
||||||
|
@ -78,6 +78,13 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
checkPositions();
|
checkPositions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestStackedHitObject()
|
||||||
|
{
|
||||||
|
AddStep("set stacking", () => slider.StackHeight = 5);
|
||||||
|
checkPositions();
|
||||||
|
}
|
||||||
|
|
||||||
private void moveHitObject()
|
private void moveHitObject()
|
||||||
{
|
{
|
||||||
AddStep("move hitobject", () =>
|
AddStep("move hitobject", () =>
|
||||||
@ -88,7 +95,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
private void checkPositions()
|
private void checkPositions()
|
||||||
{
|
{
|
||||||
AddAssert("body positioned correctly", () => blueprint.BodyPiece.Position == slider.Position);
|
AddAssert("body positioned correctly", () => blueprint.BodyPiece.Position == slider.StackedPosition);
|
||||||
|
|
||||||
AddAssert("head positioned correctly",
|
AddAssert("head positioned correctly",
|
||||||
() => Precision.AlmostEquals(blueprint.HeadBlueprint.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.HeadCircle.ScreenSpaceDrawQuad.Centre));
|
() => Precision.AlmostEquals(blueprint.HeadBlueprint.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.HeadCircle.ScreenSpaceDrawQuad.Centre));
|
||||||
|
@ -31,6 +31,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
public readonly SliderBall Ball;
|
public readonly SliderBall Ball;
|
||||||
|
|
||||||
private readonly IBindable<Vector2> positionBindable = new Bindable<Vector2>();
|
private readonly IBindable<Vector2> positionBindable = new Bindable<Vector2>();
|
||||||
|
private readonly IBindable<int> stackHeightBindable = new Bindable<int>();
|
||||||
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||||
private readonly IBindable<SliderPath> pathBindable = new Bindable<SliderPath>();
|
private readonly IBindable<SliderPath> pathBindable = new Bindable<SliderPath>();
|
||||||
|
|
||||||
@ -108,6 +109,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
config?.BindWith(OsuRulesetSetting.SnakingOutSliders, Body.SnakingOut);
|
config?.BindWith(OsuRulesetSetting.SnakingOutSliders, Body.SnakingOut);
|
||||||
|
|
||||||
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
|
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
|
||||||
|
stackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
|
||||||
scaleBindable.BindValueChanged(scale =>
|
scaleBindable.BindValueChanged(scale =>
|
||||||
{
|
{
|
||||||
updatePathRadius();
|
updatePathRadius();
|
||||||
@ -115,6 +117,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
});
|
});
|
||||||
|
|
||||||
positionBindable.BindTo(HitObject.PositionBindable);
|
positionBindable.BindTo(HitObject.PositionBindable);
|
||||||
|
stackHeightBindable.BindTo(HitObject.StackHeightBindable);
|
||||||
scaleBindable.BindTo(HitObject.ScaleBindable);
|
scaleBindable.BindTo(HitObject.ScaleBindable);
|
||||||
pathBindable.BindTo(slider.PathBindable);
|
pathBindable.BindTo(slider.PathBindable);
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -98,6 +99,15 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
set => LastInComboBindable.Value = value;
|
set => LastInComboBindable.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected OsuHitObject()
|
||||||
|
{
|
||||||
|
StackHeightBindable.BindValueChanged(height =>
|
||||||
|
{
|
||||||
|
foreach (var nested in NestedHitObjects.OfType<OsuHitObject>())
|
||||||
|
nested.StackHeight = height.NewValue;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
||||||
{
|
{
|
||||||
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||||
|
@ -163,6 +163,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
StartTime = e.Time,
|
StartTime = e.Time,
|
||||||
Position = Position,
|
Position = Position,
|
||||||
|
StackHeight = StackHeight,
|
||||||
Samples = getNodeSamples(0),
|
Samples = getNodeSamples(0),
|
||||||
SampleControlPoint = SampleControlPoint,
|
SampleControlPoint = SampleControlPoint,
|
||||||
});
|
});
|
||||||
@ -176,6 +177,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
StartTime = e.Time,
|
StartTime = e.Time,
|
||||||
Position = EndPosition,
|
Position = EndPosition,
|
||||||
|
StackHeight = StackHeight
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user