mirror of
https://github.com/ppy/osu
synced 2025-01-11 08:39:31 +00:00
Merge branch 'thread-safe-spectator-client' into fix-spectator-playing-state-5
This commit is contained in:
commit
e3284b976d
@ -182,10 +182,14 @@ namespace osu.Game.Online.Spectator
|
||||
|
||||
public void StopWatchingUser(int userId)
|
||||
{
|
||||
watchingUsers.Remove(userId);
|
||||
playingUserStates.Remove(userId);
|
||||
|
||||
StopWatchingUserInternal(userId);
|
||||
// This method is most commonly called via Dispose(), which is asynchronous.
|
||||
// Todo: This should not be a thing, but requires framework changes.
|
||||
Schedule(() =>
|
||||
{
|
||||
watchingUsers.Remove(userId);
|
||||
playingUserStates.Remove(userId);
|
||||
StopWatchingUserInternal(userId);
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract Task BeginPlayingInternal(SpectatorState state);
|
||||
|
@ -55,8 +55,6 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
foreach (var userId in playingUsers)
|
||||
{
|
||||
spectatorClient.WatchUser(userId);
|
||||
|
||||
// probably won't be required in the final implementation.
|
||||
var resolvedUser = userLookupCache.GetUserAsync(userId).Result;
|
||||
|
||||
@ -80,6 +78,8 @@ namespace osu.Game.Screens.Play.HUD
|
||||
// BindableList handles binding in a really bad way (Clear then AddRange) so we need to do this manually..
|
||||
foreach (int userId in playingUsers)
|
||||
{
|
||||
spectatorClient.WatchUser(userId);
|
||||
|
||||
if (!multiplayerClient.CurrentMatchPlayingUserIds.Contains(userId))
|
||||
usersChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, new[] { userId }));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user