Rename variable to make more sense

It needs to be explicitly stated that the users in this list are related
to the *joined* room. Especially since it's sharing its variable name
with `SpectatorStreamingClient` where it has the opposite meaning (is a
list of *globally* playing players).
This commit is contained in:
Dean Herbert
2020-12-29 14:27:33 +09:00
parent 6aeb7ece66
commit e3a41f6118
5 changed files with 15 additions and 15 deletions

View File

@ -61,9 +61,9 @@ namespace osu.Game.Online.Multiplayer
public MultiplayerRoom? Room { get; private set; }
/// <summary>
/// The users currently in gameplay.
/// The users in the joined <see cref="Room"/> which are currently in gameplay.
/// </summary>
public readonly BindableList<int> PlayingUsers = new BindableList<int>();
public readonly BindableList<int> CurrentMatchPlayingUserIds = new BindableList<int>();
[Resolved]
private UserLookupCache userLookupCache { get; set; } = null!;
@ -133,7 +133,7 @@ namespace osu.Game.Online.Multiplayer
apiRoom = null;
Room = null;
PlayingUsers.Clear();
CurrentMatchPlayingUserIds.Clear();
RoomUpdated?.Invoke();
}, false);
@ -254,7 +254,7 @@ namespace osu.Game.Online.Multiplayer
return;
Room.Users.Remove(user);
PlayingUsers.Remove(user.UserID);
CurrentMatchPlayingUserIds.Remove(user.UserID);
RoomUpdated?.Invoke();
}, false);
@ -454,22 +454,22 @@ namespace osu.Game.Online.Multiplayer
}
/// <summary>
/// For the provided user ID, update whether the user is included in <see cref="PlayingUsers"/>.
/// For the provided user ID, update whether the user is included in <see cref="CurrentMatchPlayingUserIds"/>.
/// </summary>
/// <param name="userId">The user's ID.</param>
/// <param name="state">The new state of the user.</param>
private void updateUserPlayingState(int userId, MultiplayerUserState state)
{
bool wasPlaying = PlayingUsers.Contains(userId);
bool wasPlaying = CurrentMatchPlayingUserIds.Contains(userId);
bool isPlaying = state >= MultiplayerUserState.WaitingForLoad && state <= MultiplayerUserState.FinishedPlay;
if (isPlaying == wasPlaying)
return;
if (isPlaying)
PlayingUsers.Add(userId);
CurrentMatchPlayingUserIds.Add(userId);
else
PlayingUsers.Remove(userId);
CurrentMatchPlayingUserIds.Remove(userId);
}
}
}