Add fallback case when EditorChangeHandler is not present (for tests)

This commit is contained in:
Dean Herbert 2020-10-02 16:21:50 +09:00
parent 501e02db09
commit b7c276093d

View File

@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Edit
Playfield.DisplayJudgements.Value = false;
}
[Resolved]
[Resolved(canBeNull: true)]
private IEditorChangeHandler changeHandler { get; set; }
protected override void LoadComplete()
@ -50,8 +50,15 @@ namespace osu.Game.Rulesets.Edit
beatmap.HitObjectAdded += addHitObject;
beatmap.HitObjectRemoved += removeHitObject;
// for now only regenerate replay on a finalised state change, not HitObjectUpdated.
changeHandler.OnStateChange += updateReplay;
if (changeHandler != null)
{
// for now only regenerate replay on a finalised state change, not HitObjectUpdated.
changeHandler.OnStateChange += updateReplay;
}
else
{
beatmap.HitObjectUpdated += _ => updateReplay();
}
}
private void updateReplay() => drawableRuleset.RegenerateAutoplay();