mirror of https://github.com/ppy/osu
Apply review suggestions.
This commit is contained in:
parent
25ebb8619d
commit
242a035f7e
|
@ -14,11 +14,11 @@ public class TestSceneOverlayActivation : OsuPlayerTestScene
|
|||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,10 @@ public class Player : ScreenWithBeatmapBackground
|
|||
|
||||
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 @@ private void load(AudioManager audio, OsuConfigManager config)
|
|||
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 @@ private void onBreakTimeChanged(ValueChangedEvent<bool> isBreakTime)
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue