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
1 changed files with 15 additions and 4 deletions

View File

@ -44,13 +44,24 @@ public virtual void PreProcess()
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);
}
}
}