SwitchTeam
Switches to the specified team (if allowed.)
Sends LOBBY_MEMBER_UPDATED to all lobby members, with copy of member data
Service | Operation |
---|---|
lobby | SWITCH_TEAM |
Method Parameters
Parameter | Description |
---|---|
lobbyId | Id of chosen lobby. |
toTeamCode | Specified team code. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string lobbyId = "55555:4v4:19";
string toTeamCode = "blue";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};
_bc.LobbyService.SwitchTeam(lobbyId, toTeamCode, successCallback, failureCallback);
const char *lobbyId = "55555:4v4:19";
const char *toTeamCode = "blue";
_bc->getLobbyService()->switchTeam(lobbyId, toTeamCode, this);
NSString *lobbyId = @"55555:4v4:19";
NSString *toTeamCode = @"blue";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc lobbyService] switchTeam:lobbyId
toTeamCode:toTeamCode
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String lobbyId = "55555:4v4:19";
String toTeamCode = "blue";
this; // implements IServerCallback
_bc.getLobbyService().switchTeam(lobbyId, toTeamCode, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var lobbyId = "55555:4v4:19";
var toTeamCode = "blue";
_bc.lobby.switchTeam(lobbyId, toTeamCode, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var lobbyId = "55555:4v4:19";
var toTeamCode = "blue";
ServerResponse result = await _bc.lobbyService.switchTeam(lobbyId:lobbyId, toTeamCode:toTeamCode);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var lobbyId = "55555:4v4:19";
var toTeamCode = "blue";
var lobbyProxy = bridge.getLobbyServiceProxy();
var postResult = lobbyProxy.switchTeam(lobbyId, toTeamCode);
if (postResult.status == 200) {
// Success!
}
{
"service": "lobby",
"operation": "SWITCH_TEAM",
"data": {
"lobbyId": "55555:4v4:19",
"toTeamCode": "blue"
}
}
JSON Response
{
"status": 200,
"data": {}
}
Common Error Code
Status Codes
Code | Name | Description |
---|---|---|
40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature |