Merge pull request #10472 from LeNitrous/expose-player-isbreaktime

Expose BreakTracker.IsBreakTime in Player
This commit is contained in:
Dean Herbert 2020-10-11 22:36:24 +09:00 committed by GitHub
commit a246991c50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -89,6 +89,11 @@ public class Player : ScreenWithBeatmapBackground
public BreakOverlay BreakOverlay;
/// <summary>
/// Whether the gameplay is currently in a break.
/// </summary>
public readonly IBindable<bool> IsBreakTime = new BindableBool();
private BreakTracker breakTracker;
private SkipOverlay skipOverlay;
@ -226,7 +231,6 @@ private void load(AudioManager audio, OsuConfigManager config, OsuGame game)
DrawableRuleset.IsPaused.BindValueChanged(_ => updateGameplayState());
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updateGameplayState());
breakTracker.IsBreakTime.BindValueChanged(_ => updateGameplayState());
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updatePauseOnFocusLostState(), true);
@ -256,7 +260,8 @@ private void load(AudioManager audio, OsuConfigManager config, OsuGame game)
foreach (var mod in Mods.Value.OfType<IApplicableToHealthProcessor>())
mod.ApplyToHealthProcessor(HealthProcessor);
breakTracker.IsBreakTime.BindValueChanged(onBreakTimeChanged, true);
IsBreakTime.BindTo(breakTracker.IsBreakTime);
IsBreakTime.BindValueChanged(onBreakTimeChanged, true);
}
private Drawable createUnderlayComponents() =>
@ -354,6 +359,7 @@ private Drawable createUnderlayComponents() =>
private void onBreakTimeChanged(ValueChangedEvent<bool> isBreakTime)
{
updateGameplayState();
updatePauseOnFocusLostState();
HUDOverlay.KeyCounter.IsCounting = !isBreakTime.NewValue;
}