1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 10:53:21 +08:00

Bind to playing state via GameplayState instead to fix more tests

This commit is contained in:
Bartłomiej Dach 2025-01-16 15:25:56 +01:00
parent 1f1e940ada
commit 5c799d733f
No known key found for this signature in database
3 changed files with 13 additions and 4 deletions

View File

@ -69,6 +69,11 @@ namespace osu.Game.Screens.Play
private readonly Bindable<JudgementResult> lastJudgementResult = new Bindable<JudgementResult>();
/// <summary>
/// The local user's playing state (whether actively playing, paused, or not playing due to watching a replay or similar).
/// </summary>
public IBindable<LocalUserPlayingState> Playing { get; } = new Bindable<LocalUserPlayingState>();
public GameplayState(
IBeatmap beatmap,
Ruleset ruleset,
@ -76,7 +81,8 @@ namespace osu.Game.Screens.Play
Score? score = null,
ScoreProcessor? scoreProcessor = null,
HealthProcessor? healthProcessor = null,
Storyboard? storyboard = null)
Storyboard? storyboard = null,
IBindable<LocalUserPlayingState>? localUserPlaying = null)
{
Beatmap = beatmap;
Ruleset = ruleset;
@ -92,6 +98,9 @@ namespace osu.Game.Screens.Play
ScoreProcessor = scoreProcessor ?? ruleset.CreateScoreProcessor();
HealthProcessor = healthProcessor ?? ruleset.CreateHealthProcessor(beatmap.HitObjects[0].StartTime);
Storyboard = storyboard ?? new Storyboard();
if (localUserPlaying != null)
Playing.BindTo(localUserPlaying);
}
/// <summary>

View File

@ -242,10 +242,10 @@ namespace osu.Game.Screens.Play.HUD
public bool UsesFixedAnchor { get; set; }
[BackgroundDependencyLoader]
private void load(SpectatorClient client, Player player)
private void load(SpectatorClient client, GameplayState gameplayState)
{
((IBindableList<SpectatorUser>)Spectators).BindTo(client.WatchingUsers);
((IBindable<LocalUserPlayingState>)UserPlayingState).BindTo(player.PlayingState);
((IBindable<LocalUserPlayingState>)UserPlayingState).BindTo(gameplayState.Playing);
}
}
}

View File

@ -261,7 +261,7 @@ namespace osu.Game.Screens.Play
Score.ScoreInfo.Ruleset = ruleset.RulesetInfo;
Score.ScoreInfo.Mods = gameplayMods;
dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, gameplayMods, Score, ScoreProcessor, HealthProcessor, Beatmap.Value.Storyboard));
dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, gameplayMods, Score, ScoreProcessor, HealthProcessor, Beatmap.Value.Storyboard, PlayingState));
var rulesetSkinProvider = new RulesetSkinProvidingContainer(ruleset, playableBeatmap, Beatmap.Value.Skin);
GameplayClockContainer.Add(new GameplayScrollWheelHandling());