mirror of
https://github.com/ppy/osu
synced 2025-01-12 17:19:38 +00:00
Leave the multiplayer channel when leaving multiplayer
This commit is contained in:
parent
11a9a4c773
commit
e6980688f6
@ -339,7 +339,7 @@ namespace osu.Game.Online.Chat
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Joins a channel if it has not already been joined.
|
||||
/// Joins a channel if it has not already been joined. Must be called from the update thread.
|
||||
/// </summary>
|
||||
/// <param name="channel">The channel to join.</param>
|
||||
/// <returns>The joined channel. Note that this may not match the parameter channel as it is a backed object.</returns>
|
||||
@ -399,7 +399,11 @@ namespace osu.Game.Online.Chat
|
||||
return channel;
|
||||
}
|
||||
|
||||
public void LeaveChannel(Channel channel)
|
||||
/// <summary>
|
||||
/// Leave the specified channel. Can be called from any thread.
|
||||
/// </summary>
|
||||
/// <param name="channel">The channel to leave.</param>
|
||||
public void LeaveChannel(Channel channel) => Schedule(() =>
|
||||
{
|
||||
if (channel == null) return;
|
||||
|
||||
@ -413,7 +417,7 @@ namespace osu.Game.Online.Chat
|
||||
api.Queue(new LeaveChannelRequest(channel));
|
||||
channel.Joined.Value = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
private long lastMessageId;
|
||||
|
||||
|
@ -38,5 +38,11 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
|
||||
|
||||
Channel.Value = channelManager?.JoinChannel(new Channel { Id = channelId.Value, Type = ChannelType.Multiplayer, Name = $"#lazermp_{roomId.Value}" });
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
channelManager?.LeaveChannel(Channel.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user