1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 10:03:05 +08:00

Merge pull request #15100 from peppy/fix-multiplayer-sounds-during-gameplay

Fix multiplayer components updating when not alive
This commit is contained in:
Dan Balasescu 2021-10-14 23:44:03 +09:00 committed by GitHub
commit 79d9aa7383
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,15 +19,19 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
{ {
base.LoadComplete(); base.LoadComplete();
Client.RoomUpdated += OnRoomUpdated; Client.RoomUpdated += invokeOnRoomUpdated;
Client.UserLeft += invokeUserLeft;
Client.UserLeft += UserLeft; Client.UserKicked += invokeUserKicked;
Client.UserKicked += UserKicked; Client.UserJoined += invokeUserJoined;
Client.UserJoined += UserJoined;
OnRoomUpdated(); OnRoomUpdated();
} }
private void invokeOnRoomUpdated() => Scheduler.AddOnce(OnRoomUpdated);
private void invokeUserJoined(MultiplayerRoomUser user) => Scheduler.AddOnce(UserJoined, user);
private void invokeUserKicked(MultiplayerRoomUser user) => Scheduler.AddOnce(UserKicked, user);
private void invokeUserLeft(MultiplayerRoomUser user) => Scheduler.AddOnce(UserLeft, user);
/// <summary> /// <summary>
/// Invoked when a user has joined the room. /// Invoked when a user has joined the room.
/// </summary> /// </summary>
@ -63,10 +67,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
{ {
if (Client != null) if (Client != null)
{ {
Client.UserLeft -= UserLeft; Client.RoomUpdated -= invokeOnRoomUpdated;
Client.UserKicked -= UserKicked; Client.UserLeft -= invokeUserLeft;
Client.UserJoined -= UserJoined; Client.UserKicked -= invokeUserKicked;
Client.RoomUpdated -= OnRoomUpdated; Client.UserJoined -= invokeUserJoined;
} }
base.Dispose(isDisposing); base.Dispose(isDisposing);