1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 16:25:32 +08:00

Apply review suggestions.

This commit is contained in:
Lucas A 2020-08-03 21:25:45 +02:00
parent 25ebb8619d
commit 242a035f7e
2 changed files with 17 additions and 12 deletions

View File

@ -14,11 +14,11 @@ namespace osu.Game.Tests.Visual.Gameplay
private OverlayTestPlayer testPlayer; private OverlayTestPlayer testPlayer;
[Resolved] [Resolved]
private OsuConfigManager mng { get; set; } private OsuConfigManager config { get; set; }
public override void SetUpSteps() public override void SetUpSteps()
{ {
AddStep("disable overlay activation during gameplay", () => mng.Set(OsuSetting.GameplayDisableOverlayActivation, true)); AddStep("disable overlay activation during gameplay", () => config.Set(OsuSetting.GameplayDisableOverlayActivation, true));
base.SetUpSteps(); base.SetUpSteps();
} }

View File

@ -90,7 +90,10 @@ namespace osu.Game.Screens.Play
private SkipOverlay skipOverlay; private SkipOverlay skipOverlay;
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.Disabled); /// <summary>
/// The current activation mode for overlays.
/// </summary>
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.UserTriggered);
protected ScoreProcessor ScoreProcessor { get; private set; } protected ScoreProcessor ScoreProcessor { get; private set; }
@ -208,15 +211,9 @@ namespace osu.Game.Screens.Play
if (game != null) if (game != null)
OverlayActivationMode.BindTo(game.OverlayActivationMode); OverlayActivationMode.BindTo(game.OverlayActivationMode);
gameplayOverlaysDisabled.ValueChanged += disabled => gameplayOverlaysDisabled.ValueChanged += disabled => updateOverlayActivationMode();
{ DrawableRuleset.IsPaused.BindValueChanged(_ => updateOverlayActivationMode());
if (DrawableRuleset.HasReplayLoaded.Value) DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updateOverlayActivationMode());
OverlayActivationMode.Value = OverlayActivation.UserTriggered;
else
OverlayActivationMode.Value = disabled.NewValue && !DrawableRuleset.IsPaused.Value ? OverlayActivation.Disabled : OverlayActivation.UserTriggered;
};
DrawableRuleset.IsPaused.BindValueChanged(_ => gameplayOverlaysDisabled.TriggerChange());
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => gameplayOverlaysDisabled.TriggerChange());
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updatePauseOnFocusLostState(), true); DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updatePauseOnFocusLostState(), true);
@ -362,6 +359,14 @@ namespace osu.Game.Screens.Play
HUDOverlay.KeyCounter.IsCounting = !isBreakTime.NewValue; HUDOverlay.KeyCounter.IsCounting = !isBreakTime.NewValue;
} }
private void updateOverlayActivationMode()
{
if (DrawableRuleset.HasReplayLoaded.Value)
OverlayActivationMode.Value = OverlayActivation.UserTriggered;
else
OverlayActivationMode.Value = gameplayOverlaysDisabled.Value && !DrawableRuleset.IsPaused.Value ? OverlayActivation.Disabled : OverlayActivation.UserTriggered;
}
private void updatePauseOnFocusLostState() => private void updatePauseOnFocusLostState() =>
HUDOverlay.HoldToQuit.PauseOnFocusLost = PauseOnFocusLost HUDOverlay.HoldToQuit.PauseOnFocusLost = PauseOnFocusLost
&& !DrawableRuleset.HasReplayLoaded.Value && !DrawableRuleset.HasReplayLoaded.Value