mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Simplify method of marking players as playing in test scenes
This commit is contained in:
@ -62,7 +62,9 @@ namespace osu.Game.Online.Multiplayer
|
||||
/// <summary>
|
||||
/// The users in the joined <see cref="Room"/> which are participating in the current gameplay loop.
|
||||
/// </summary>
|
||||
public readonly BindableList<int> CurrentMatchPlayingUserIds = new BindableList<int>();
|
||||
public IBindableList<int> CurrentMatchPlayingUserIds => PlayingUserIds;
|
||||
|
||||
protected readonly BindableList<int> PlayingUserIds = new BindableList<int>();
|
||||
|
||||
public readonly Bindable<PlaylistItem?> CurrentMatchPlayingItem = new Bindable<PlaylistItem?>();
|
||||
|
||||
@ -179,7 +181,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
{
|
||||
APIRoom = null;
|
||||
Room = null;
|
||||
CurrentMatchPlayingUserIds.Clear();
|
||||
PlayingUserIds.Clear();
|
||||
|
||||
RoomUpdated?.Invoke();
|
||||
});
|
||||
@ -376,7 +378,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
return;
|
||||
|
||||
Room.Users.Remove(user);
|
||||
CurrentMatchPlayingUserIds.Remove(user.UserID);
|
||||
PlayingUserIds.Remove(user.UserID);
|
||||
|
||||
RoomUpdated?.Invoke();
|
||||
}, false);
|
||||
@ -659,16 +661,16 @@ namespace osu.Game.Online.Multiplayer
|
||||
/// <param name="state">The new state of the user.</param>
|
||||
private void updateUserPlayingState(int userId, MultiplayerUserState state)
|
||||
{
|
||||
bool wasPlaying = CurrentMatchPlayingUserIds.Contains(userId);
|
||||
bool wasPlaying = PlayingUserIds.Contains(userId);
|
||||
bool isPlaying = state >= MultiplayerUserState.WaitingForLoad && state <= MultiplayerUserState.FinishedPlay;
|
||||
|
||||
if (isPlaying == wasPlaying)
|
||||
return;
|
||||
|
||||
if (isPlaying)
|
||||
CurrentMatchPlayingUserIds.Add(userId);
|
||||
PlayingUserIds.Add(userId);
|
||||
else
|
||||
CurrentMatchPlayingUserIds.Remove(userId);
|
||||
PlayingUserIds.Remove(userId);
|
||||
}
|
||||
|
||||
private Task scheduleAsync(Action action, CancellationToken cancellationToken = default)
|
||||
|
Reference in New Issue
Block a user