1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-31 14:25:10 +08:00

Move bindings to LoadComplete()

This commit is contained in:
Bartłomiej Dach 2025-01-21 10:02:16 +01:00
parent 3c4bfc0a01
commit 0265a29000
No known key found for this signature in database

View File

@ -43,8 +43,14 @@ namespace osu.Game.Screens.Play.HUD
private FillFlowContainer<SpectatorListEntry> spectatorsFlow = null!;
private DrawablePool<SpectatorListEntry> pool = null!;
[Resolved]
private SpectatorClient client { get; set; } = null!;
[Resolved]
private GameplayState gameplayState { get; set; } = null!;
[BackgroundDependencyLoader]
private void load(OsuColour colours, SpectatorClient client, GameplayState gameplayState)
private void load(OsuColour colours)
{
AutoSizeAxes = Axes.Y;
@ -73,15 +79,15 @@ namespace osu.Game.Screens.Play.HUD
};
HeaderColour.Value = Header.Colour;
((IBindableList<SpectatorUser>)Spectators).BindTo(client.WatchingUsers);
((IBindable<LocalUserPlayingState>)UserPlayingState).BindTo(gameplayState.PlayingState);
}
protected override void LoadComplete()
{
base.LoadComplete();
((IBindableList<SpectatorUser>)Spectators).BindTo(client.WatchingUsers);
((IBindable<LocalUserPlayingState>)UserPlayingState).BindTo(gameplayState.PlayingState);
Spectators.BindCollectionChanged(onSpectatorsChanged, true);
UserPlayingState.BindValueChanged(_ => updateVisibility());