Skip to content

Commit

Permalink
Make states better defined
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Oct 1, 2024
1 parent f3a0827 commit fb45ca0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions osu.Game/Screens/Play/LocalUserPlayingStates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ namespace osu.Game.Screens.Play
public enum LocalUserPlayingStates
{
/// <summary>
/// The local player is not current in gameplay.
/// The local player is not current in gameplay. If watching a replay, gameplay always remains in this state.
/// </summary>
NotPlaying,

/// <summary>
/// The local player is in a break, paused, or failed or passed but still at the gameplay screen.
/// The local player is in a break, paused, or failed but still at the gameplay screen.
/// </summary>
Break,

Expand Down
8 changes: 4 additions & 4 deletions osu.Game/Screens/Play/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -508,16 +508,16 @@ private void onBreakTimeChanged(ValueChangedEvent<bool> isBreakTime)

private void updateGameplayState()
{
bool inGameplay = !DrawableRuleset.HasReplayLoaded.Value && !GameplayState.HasFailed;
bool inBreak = breakTracker.IsBreakTime.Value || DrawableRuleset.IsPaused.Value;
bool inGameplay = !DrawableRuleset.HasReplayLoaded.Value;
bool inBreak = breakTracker.IsBreakTime.Value || DrawableRuleset.IsPaused.Value || GameplayState.HasFailed;

if (inGameplay)
playingState.Value = inBreak ? LocalUserPlayingStates.Break : LocalUserPlayingStates.Playing;
else
playingState.Value = LocalUserPlayingStates.NotPlaying;

localUserPlaying.Value = playingState.Value != LocalUserPlayingStates.NotPlaying;
OverlayActivationMode.Value = playingState.Value != LocalUserPlayingStates.NotPlaying ? OverlayActivation.Disabled : OverlayActivation.UserTriggered;
localUserPlaying.Value = playingState.Value == LocalUserPlayingStates.Playing;
OverlayActivationMode.Value = playingState.Value == LocalUserPlayingStates.Playing ? OverlayActivation.Disabled : OverlayActivation.UserTriggered;
}

private void updateSampleDisabledState()
Expand Down

0 comments on commit fb45ca0

Please sign in to comment.