Fix judgement processors provided to mods while not completely loaded

This commit is contained in:
Salman Ahmed 2021-08-01 19:16:30 +03:00
parent 48b95ae250
commit ac930b8918
3 changed files with 12 additions and 6 deletions

View File

@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Mods
public interface IApplicableToHealthProcessor : IApplicableMod
{
/// <summary>
/// Provide a <see cref="HealthProcessor"/> to a mod. Called once on initialisation of a play instance.
/// Provides a ready <see cref="HealthProcessor"/> to a mod. Called once on initialisation of a play instance.
/// </summary>
void ApplyToHealthProcessor(HealthProcessor healthProcessor);
}

View File

@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Mods
public interface IApplicableToScoreProcessor : IApplicableMod
{
/// <summary>
/// Provide a <see cref="ScoreProcessor"/> to a mod. Called once on initialisation of a play instance.
/// Provides a loaded <see cref="ScoreProcessor"/> to a mod. Called once on initialisation of a play instance.
/// </summary>
void ApplyToScoreProcessor(ScoreProcessor scoreProcessor);

View File

@ -297,11 +297,17 @@ namespace osu.Game.Screens.Play
ScoreProcessor.HasCompleted.BindValueChanged(scoreCompletionChanged);
HealthProcessor.Failed += onFail;
ScoreProcessor.OnLoadComplete += _ =>
{
foreach (var mod in Mods.Value.OfType<IApplicableToScoreProcessor>())
mod.ApplyToScoreProcessor(ScoreProcessor);
};
HealthProcessor.OnLoadComplete += _ =>
{
foreach (var mod in Mods.Value.OfType<IApplicableToHealthProcessor>())
mod.ApplyToHealthProcessor(HealthProcessor);
};
IsBreakTime.BindTo(breakTracker.IsBreakTime);
IsBreakTime.BindValueChanged(onBreakTimeChanged, true);