1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-08 03:12:57 +08:00

Refactor implementation to better match what already existed

This commit is contained in:
Dean Herbert 2020-03-06 18:00:17 +09:00
parent 0ccf691c97
commit a59c3d997d

View File

@ -157,10 +157,7 @@ namespace osu.Game.Screens.Play
addGameplayComponents(GameplayClockContainer, Beatmap.Value); addGameplayComponents(GameplayClockContainer, Beatmap.Value);
addOverlayComponents(GameplayClockContainer, Beatmap.Value); addOverlayComponents(GameplayClockContainer, Beatmap.Value);
DrawableRuleset.HasReplayLoaded.BindValueChanged(e => DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updatePauseOnFocusLostState(), true);
{
updatePauseOnFocusLostState(e.NewValue, BreakOverlay.IsBreakTime.Value);
}, true);
// bind clock into components that require it // bind clock into components that require it
DrawableRuleset.IsPaused.BindTo(GameplayClockContainer.IsPaused); DrawableRuleset.IsPaused.BindTo(GameplayClockContainer.IsPaused);
@ -232,7 +229,11 @@ namespace osu.Game.Screens.Play
IsPaused = { BindTarget = GameplayClockContainer.IsPaused } IsPaused = { BindTarget = GameplayClockContainer.IsPaused }
}, },
PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } }, PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } },
KeyCounter = { AlwaysVisible = { BindTarget = DrawableRuleset.HasReplayLoaded }, IsCounting = false }, KeyCounter =
{
AlwaysVisible = { BindTarget = DrawableRuleset.HasReplayLoaded },
IsCounting = false
},
RequestSeek = GameplayClockContainer.Seek, RequestSeek = GameplayClockContainer.Seek,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre Origin = Anchor.Centre
@ -289,16 +290,16 @@ namespace osu.Game.Screens.Play
HealthProcessor.IsBreakTime.BindTo(BreakOverlay.IsBreakTime); HealthProcessor.IsBreakTime.BindTo(BreakOverlay.IsBreakTime);
} }
private void onBreakTimeChanged(ValueChangedEvent<bool> changeEvent) private void onBreakTimeChanged(ValueChangedEvent<bool> isBreakTime)
{ {
updatePauseOnFocusLostState(DrawableRuleset.HasReplayLoaded.Value, changeEvent.NewValue); updatePauseOnFocusLostState();
HUDOverlay.KeyCounter.IsCounting = !changeEvent.NewValue; HUDOverlay.KeyCounter.IsCounting = !isBreakTime.NewValue;
} }
private void updatePauseOnFocusLostState(bool replayLoaded, bool isBreakTime) => private void updatePauseOnFocusLostState() =>
HUDOverlay.HoldToQuit.PauseOnFocusLost = PauseOnFocusLost HUDOverlay.HoldToQuit.PauseOnFocusLost = PauseOnFocusLost
&& !replayLoaded && !DrawableRuleset.HasReplayLoaded.Value
&& !isBreakTime; && !BreakOverlay.IsBreakTime.Value;
private IBeatmap loadPlayableBeatmap() private IBeatmap loadPlayableBeatmap()
{ {