지원 프로그램
home
슬기로운 데모생활
home

10. Start Matchmaking Lobby Game

태그

Lobby Game Start API

The SDK.StartGame method notifies the matchmaking server and all users that the lobby is about to start a game.
using Stove.PCSDK.NET.Matchmaking; string lobby = this.lobby; SDK.StartGame(lobby, "", 0);
Plain Text
복사
Only the moderator can call. When a user other than the moderator calls it, it calls back an error. In Server IP and Port, enter the address of the game server to be linked in the client. If there is no game server to be connected, enter an empty value. You cannot enter the lobby after the game has started.

Lobby Game Start Callback

If an error occurs while the SDK.StartGame method is running, you can check the contents in error.result (error code) StovePCMatchmakingResult.
To receive a callback for starting a lobby game, you must register a delegate in advance. It calls the StartGame callback for all users in the lobby.
using Stove.PCSDK.NET.Matchmaking; // Register the lobby game start delegate SDK.EventStartGame += GameObj.OnStartGame; // start lobby game private void OnStartGame(StovePCMatchmakingError error, StovePCMatchmakingStartGame startGame) { // Process game logic such as moving scenes if (error.result == StovePCMatchmakingResult.NO_ERROR) { } // error handling else { StringBuilder sb = new StringBuilder(); // error code sb.AppendFormat(" - fail code : {0}", error.result); // If there is a specific error sb.AppendFormat(" - fail message : {0}", error.message); Debug.Log(sb.ToString()); } } > You should periodically call the RunCallback method because the lobby can receive notification of the start of the game. ### 11) End matchmaking lobby game #### Lobby Game Closing API The `SDK.EndGame` method notifies the matchmaking server and all users that the lobby ends the game. ``` cs using Stove.PCSDK.NET.Matchmaking; string lobby = this.lobby; SDK.EndGame(lobby, "", 0);
Plain Text
복사
Only the moderator can call. When a user other than the moderator calls it, it calls back an error. In Server IP and Port, enter the address of the game server to be linked in the client. If there is no game server to be connected, enter an empty value. After the game is over, it automatically deletes the lobby.

Lobby Game End Callback

If an error occurs while the SDK.EndGame method is running, you can check the contents in error.result (error code) StovePCMatchmakingResult.
To receive a callback for the end of the lobby game, you must register a delegate in advance.
The EndGame callback is called for all users in the lobby.
All users in the lobby will call the OnLeaveLobby callback.
using Stove.PCSDK.NET.Matchmaking; // Register the lobby game start delegate SDK.EventEndGame += GameObj.OnEndGame; // end the lobby game private void OnEndGame(StovePCMatchmakingError error, StovePCMatchmakingEndGame endGame) { // Process game logic such as moving scenes if (error.result == StovePCMatchmakingResult.NO_ERROR) { } // error handling else { StringBuilder sb = new StringBuilder(); // error code sb.AppendFormat(" - fail code : {0}", error.result); // If there is a specific error sb.AppendFormat(" - fail message : {0}", error.message); Debug.Log(sb.ToString()); } }
Plain Text
복사
You should periodically call the RunCallback method because the lobby can receive game end notifications.