//////////
Search
Duplicate

7. Exit Matchmaking Lobby

태그

Lobby Exit API

Leave the matchmaking lobby with the SDK.LeaveLobby method.
using Stove.PCSDK.NET.Matchmaking; string lobby = this.lobby; SDK.LeaveLobby(lobby);
Plain Text
복사

Lobby Callback

If an error occurs while the SDK.LeaveLobby method is running, you can check the contents in error.result (error code) StovePCMatchmakingResult.
To receive a callback about leaving the lobby, you must register a delegate in advance.
It calls the OnLeaveLobby callback when I leave the lobby. It is also called back when it forces you to leave the lobby due to lobby kick/ban by the host or lobby deletion. For other users, it calls the OnUserLeave callback.
using Stove.PCSDK.NET.Matchmaking; // Register lobby exit delegate SDK.EventLeaveLobby += GameObj.OnLeaveLobby; // Leave the lobby private void OnLeaveLobby(StovePCMatchmakingError error, StovePCMatchmakingLeaveLobby leaveLobby) { StringBuilder sb = new StringBuilder(); // Unique Lobby ID sb.AppendFormat("lobby = {0}", lobby); // Reason code for user leaving (You can check the contents in `StovePCMatchmakingResult`) sb.AppendFormat("leaveCode = {0}", error.result); Debug.Log(sb.ToString()); // Reason for leaving the lobby switch(error.result) { // Leave the lobby by calling the API case StovePCMatchmakingResult.NO_ERROR: break; // the manager kicks case StovePCMatchmakingResult.USER_KICKED: break; // moderator van case StovePCMatchmakingResult.USER_BANNED: break; // Moderator deletes lobby case StovePCMatchmakingResult.USER_ROOM_DESTROYED: break; // Remove lobby from server case StovePCMatchmakingResult.USER_ROOM_SHUTDOWN: break; // Remove lobby due to operational issue case StovePCMatchmakingResult.ROOM_DELETED_AS_OPERATIONAL: break; } //Process game logic }
Plain Text
복사
You can check the contents of StovePCMatchmakingResult through error.result if it has kicked off you.