mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:52:53 +08:00
Merge pull request #11256 from frenzibyte/disallow-joining-ended-realtime-room
Disallow joining ended rooms in realtime multiplayer
This commit is contained in:
commit
b632e44bac
@ -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,17 @@ 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);
|
||||
{
|
||||
// this is done here as a pre-check to avoid clicking on already closed rooms in the lounge from triggering a server join.
|
||||
// should probably be done at a higher level, but due to the current structure of things this is the easiest place for now.
|
||||
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