mirror of
https://github.com/ppy/osu.git
synced 2025-02-05 10:13:00 +08:00
Fix combo bindings not being bound to nested hitobjects
This commit is contained in:
parent
ea76dd6a9e
commit
45f2bcc440
@ -33,28 +33,6 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
|
|
||||||
public Vector2 StackedPositionAt(double t) => StackedPosition + this.CurvePositionAt(t);
|
public Vector2 StackedPositionAt(double t) => StackedPosition + this.CurvePositionAt(t);
|
||||||
|
|
||||||
public override int ComboIndex
|
|
||||||
{
|
|
||||||
get => base.ComboIndex;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
base.ComboIndex = value;
|
|
||||||
foreach (var n in NestedHitObjects.OfType<IHasComboInformation>())
|
|
||||||
n.ComboIndex = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int IndexInCurrentCombo
|
|
||||||
{
|
|
||||||
get => base.IndexInCurrentCombo;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
base.IndexInCurrentCombo = value;
|
|
||||||
foreach (var n in NestedHitObjects.OfType<IHasComboInformation>())
|
|
||||||
n.IndexInCurrentCombo = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly Bindable<SliderPath> PathBindable = new Bindable<SliderPath>();
|
public readonly Bindable<SliderPath> PathBindable = new Bindable<SliderPath>();
|
||||||
|
|
||||||
public SliderPath Path
|
public SliderPath Path
|
||||||
@ -192,8 +170,6 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
Position = Position,
|
Position = Position,
|
||||||
Samples = getNodeSamples(0),
|
Samples = getNodeSamples(0),
|
||||||
SampleControlPoint = SampleControlPoint,
|
SampleControlPoint = SampleControlPoint,
|
||||||
IndexInCurrentCombo = IndexInCurrentCombo,
|
|
||||||
ComboIndex = ComboIndex,
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -205,8 +181,6 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
StartTime = e.Time,
|
StartTime = e.Time,
|
||||||
Position = EndPosition,
|
Position = EndPosition,
|
||||||
IndexInCurrentCombo = IndexInCurrentCombo,
|
|
||||||
ComboIndex = ComboIndex,
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// 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 System.Linq;
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
@ -45,25 +44,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public virtual void PostProcess()
|
public virtual void PostProcess()
|
||||||
{
|
{
|
||||||
void updateNestedCombo(HitObject obj, int comboIndex, int indexInCurrentCombo)
|
|
||||||
{
|
|
||||||
if (obj is IHasComboInformation objectComboInfo)
|
|
||||||
{
|
|
||||||
objectComboInfo.ComboIndex = comboIndex;
|
|
||||||
objectComboInfo.IndexInCurrentCombo = indexInCurrentCombo;
|
|
||||||
foreach (var nestedObject in obj.NestedHitObjects)
|
|
||||||
updateNestedCombo(nestedObject, comboIndex, indexInCurrentCombo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var hitObject in Beatmap.HitObjects)
|
|
||||||
{
|
|
||||||
if (hitObject is IHasComboInformation objectComboInfo)
|
|
||||||
{
|
|
||||||
foreach (var nested in hitObject.NestedHitObjects)
|
|
||||||
updateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// 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.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
@ -82,6 +83,15 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
|
|
||||||
CreateNestedHitObjects();
|
CreateNestedHitObjects();
|
||||||
|
|
||||||
|
if (this is IHasComboInformation hasCombo)
|
||||||
|
{
|
||||||
|
foreach (var n in NestedHitObjects.OfType<IHasComboInformation>())
|
||||||
|
{
|
||||||
|
n.ComboIndexBindable.BindTo(hasCombo.ComboIndexBindable);
|
||||||
|
n.IndexInCurrentComboBindable.BindTo(hasCombo.IndexInCurrentComboBindable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nestedHitObjects.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime));
|
nestedHitObjects.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime));
|
||||||
|
|
||||||
foreach (var h in nestedHitObjects)
|
foreach (var h in nestedHitObjects)
|
||||||
|
Loading…
Reference in New Issue
Block a user