1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 07:32:55 +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;
[Resolved]
private OsuConfigManager mng { get; set; }
private OsuConfigManager config { get; set; }
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();
}

View File

@ -90,7 +90,10 @@ namespace osu.Game.Screens.Play
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; }
@ -208,15 +211,9 @@ namespace osu.Game.Screens.Play
if (game != null)
OverlayActivationMode.BindTo(game.OverlayActivationMode);
gameplayOverlaysDisabled.ValueChanged += disabled =>
{
if (DrawableRuleset.HasReplayLoaded.Value)
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());
gameplayOverlaysDisabled.ValueChanged += disabled => updateOverlayActivationMode();
DrawableRuleset.IsPaused.BindValueChanged(_ => updateOverlayActivationMode());
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updateOverlayActivationMode());
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updatePauseOnFocusLostState(), true);
@ -362,6 +359,14 @@ namespace osu.Game.Screens.Play
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() =>
HUDOverlay.HoldToQuit.PauseOnFocusLost = PauseOnFocusLost
&& !DrawableRuleset.HasReplayLoaded.Value