1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +08:00

Check for type conversion, mais the update recursive

This commit is contained in:
Hanamuke 2018-09-14 19:41:29 +02:00
parent a17200a66a
commit 347cb0a1b5

View File

@ -44,13 +44,24 @@ namespace osu.Game.Beatmaps
public virtual void PostProcess()
{
void UpdateNestedCombo(Rulesets.Objects.HitObject obj, int comboIndex, int indexInCurrentCombo)
{
if (obj is IHasComboInformation)
{
var objectComboInfo = (IHasComboInformation)obj;
objectComboInfo.ComboIndex = comboIndex;
objectComboInfo.IndexInCurrentCombo = indexInCurrentCombo;
foreach (var nestedObjet in obj.NestedHitObjects)
UpdateNestedCombo(nestedObjet, comboIndex, indexInCurrentCombo);
}
}
foreach (var hitObject in Beatmap.HitObjects)
{
var objectComboInfo = (IHasComboInformation)hitObject;
foreach (var obj in hitObject.NestedHitObjects.OfType<IHasComboInformation>())
if (hitObject is IHasComboInformation)
{
obj.IndexInCurrentCombo = objectComboInfo.IndexInCurrentCombo;
obj.ComboIndex = objectComboInfo.ComboIndex;
var objectComboInfo = (IHasComboInformation)hitObject;
foreach (var nested in hitObject.NestedHitObjects)
UpdateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo);
}
}
}