Merge pull request #6556 from smoogipoo/fix-slider-stack-change

Fix sliders not moving with stacking changes
This commit is contained in:
Dean Herbert
2019-10-23 17:48:06 +09:00
committed by GitHub
6 changed files with 64 additions and 27 deletions

View File

@ -34,6 +34,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private readonly Slider slider;
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<SliderPath> pathBindable = new Bindable<SliderPath>();
@ -72,6 +73,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
config?.BindWith(OsuRulesetSetting.SnakingOutSliders, Body.SnakingOut);
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
stackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
scaleBindable.BindValueChanged(scale =>
{
updatePathRadius();
@ -79,6 +81,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
});
positionBindable.BindTo(HitObject.PositionBindable);
stackHeightBindable.BindTo(HitObject.StackHeightBindable);
scaleBindable.BindTo(HitObject.ScaleBindable);
pathBindable.BindTo(slider.PathBindable);

View File

@ -1,6 +1,7 @@
// 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.
using System.Linq;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
@ -98,6 +99,15 @@ namespace osu.Game.Rulesets.Osu.Objects
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)
{
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);

View File

@ -163,6 +163,7 @@ namespace osu.Game.Rulesets.Osu.Objects
{
StartTime = e.Time,
Position = Position,
StackHeight = StackHeight,
Samples = getNodeSamples(0),
SampleControlPoint = SampleControlPoint,
});
@ -176,6 +177,7 @@ namespace osu.Game.Rulesets.Osu.Objects
{
StartTime = e.Time,
Position = EndPosition,
StackHeight = StackHeight
});
break;