mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 13:22:55 +08:00
Add early check for room status before joining
This commit is contained in:
parent
7751ef4f3e
commit
3aa2b22838
@ -9,6 +9,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Multiplayer.RoomStatuses;
|
||||
using osu.Game.Online.RealtimeMultiplayer;
|
||||
using osu.Game.Screens.Multi.Components;
|
||||
|
||||
@ -41,7 +42,15 @@ namespace osu.Game.Screens.Multi.RealtimeMultiplayer
|
||||
=> base.CreateRoom(room, r => joinMultiplayerRoom(r, onSuccess, onError), onError);
|
||||
|
||||
public override void JoinRoom(Room room, Action<Room> onSuccess = null, Action<string> onError = null)
|
||||
=> base.JoinRoom(room, r => joinMultiplayerRoom(r, onSuccess, onError), onError);
|
||||
{
|
||||
if (room.Status.Value is RoomStatusEnded)
|
||||
{
|
||||
onError?.Invoke("Cannot join an ended room.");
|
||||
return;
|
||||
}
|
||||
|
||||
base.JoinRoom(room, r => joinMultiplayerRoom(r, onSuccess, onError), onError);
|
||||
}
|
||||
|
||||
public override void PartRoom()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user