mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
Merge pull request #11557 from peppy/leave-channel-on-exiting-multiplayer
Leave the multiplayer channel when leaving multiplayer
This commit is contained in:
@ -339,7 +339,7 @@ namespace osu.Game.Online.Chat
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
/// <param name="channel">The channel to join.</param>
|
/// <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>
|
/// <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;
|
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;
|
if (channel == null) return;
|
||||||
|
|
||||||
@ -413,7 +417,7 @@ namespace osu.Game.Online.Chat
|
|||||||
api.Queue(new LeaveChannelRequest(channel));
|
api.Queue(new LeaveChannelRequest(channel));
|
||||||
channel.Joined.Value = false;
|
channel.Joined.Value = false;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
private long lastMessageId;
|
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}" });
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user