1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 04:13:00 +08:00

Add early check for room status before joining

This commit is contained in:
Salman Ahmed 2020-12-23 05:52:10 +03:00
parent 7751ef4f3e
commit 3aa2b22838

View File

@ -9,6 +9,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.RoomStatuses;
using osu.Game.Online.RealtimeMultiplayer; using osu.Game.Online.RealtimeMultiplayer;
using osu.Game.Screens.Multi.Components; 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); => base.CreateRoom(room, r => joinMultiplayerRoom(r, onSuccess, onError), onError);
public override void JoinRoom(Room room, Action<Room> onSuccess = null, Action<string> onError = null) 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() public override void PartRoom()
{ {