SDK Integration
Join a party
A party can be joined by calling the JoinParty()
. If the party does not exist when the function call is made, it will be created.
- C++
- C#
#include "FACEITGameClientSDK/Party/Party.h"
#include "FACEITGameClientSDK/Utility/StringHelpers.h"
void MyGameInstance::JoinParty(const char* partyID)
{
// Make a request to join a party with the provided party ID.
// Provide a response callback that is called once the request completes.
const FGCSDK_Party_ResultCode result = FGCSDK_Party_Join(partyID,
[](const FGCSDK_BasicWebRequestResponseInfo* response)
{
// The JoinParty response has been performed
// successfully.
if ( response->errorType == FGCSDK_REQ_NO_ERROR )
{
// The user successfully joined the party.
}
else
{
// Handle the error in an appropriate way
// (out of scope of this documentation).
Log("Failed to join party. Error: %s\n",
response->summary);
}
}
);
// If the result is not OK, the JoinParty request could not be started.
// This is usually due to some user error such as not having
// completed the authentication process yet.
if ( result != FGCSDK_PARTY_OK )
{
// Handle the error in an appropriate way
// (out of scope of this documentation).
Log("Failed to make party join request. Error: %s",
FGCSDK_ToString(&FGCSDK_Party_ResultCode_GetDescription, result).c_str());
}
}
using System;
using FACEITGameClientSDK;
public partial class MyGameClientInstance
{
public void JoinParty(string partyID)
{
// Make a request to join a party
Party.ResultCode joinPartyResult =
Party.JoinParty(partyID, (BasicWebRequestResponseInfo response) =>
{
// The JoinParty response has been performed successfully.
if ( response.ErrorType == WebServiceResponseCode.NoError )
{
// The user successfully joined the party.
}
else
{
// Handle the error in an appropriate way
// (out of scope of this documentation).
Console.WriteLine($"Failed to join party. Error: {response.Summary}");
}
});
// If the result is not OK, the JoinParty request could not be started.
// This is usually due to some user error such as not having
// completed the authentication process yet.
if ( joinPartyResult != Party.ResultCode.OK )
{
// Handle the error in an appropriate way
// (out of scope of this documentation).
Console.WriteLine("Failed to make party join request. Error: " +
Party.GetResultCodeDescription(joinPartyResult));
}
}
}
Leave a party
A party can be left by calling the LeaveParty()
. Once all members of the party leave, the party is destroyed.
- C++
- C#
#include "FACEITGameClientSDK/Party/Party.h"
#include "FACEITGameClientSDK/Utility/StringHelpers.h"
void MyGameInstance::LeaveParty(const char* partyID)
{
// Make a request to leave a party with the provided party ID.
// Provide a response callback that is called once the request completes.
const FGCSDK_Party_ResultCode result = FGCSDK_Party_Leave(partyID,
[](const FGCSDK_BasicWebRequestResponseInfo* response)
{
// The LeaveParty response has been performed
// successfully.
if ( response->errorType == FGCSDK_REQ_NO_ERROR )
{
// The user successfully left the party.
}
else
{
// Handle the error in an appropriate way
// (out of scope of this documentation).
Log("Failed to leave party. Error: %s\n",
response->summary);
}
}
);
// If the result is not OK, the LeaveParty request could not be started.
// This is usually due to some user error such as not having
// completed the authentication process yet.
if ( result != FGCSDK_PARTY_OK )
{
// Handle the error in an appropriate way
// (out of scope of this documentation).
Log("Failed to make party leave request. Error: %s",
FGCSDK_ToString(&FGCSDK_Party_ResultCode_GetDescription, result).c_str());
}
}
using FACEITGameClientSDK;
public partial class MyGameClientInstance
{
public void LeaveParty(string partyID)
{
// Make a request to leave a party
Party.ResultCode leavePartyResult =
Party.LeaveParty(partyID, (BasicWebRequestResponseInfo response) =>
{
// The LeaveParty response has been performed successfully.
if ( response.ErrorType == WebServiceResponseCode.NoError )
{
// The user successfully left the party.
}
else
{
// Handle the error in an appropriate way
// (out of scope of this documentation).
Console.WriteLine($"Failed to leave party. Error: {response.Summary}");
}
});
// If the result is not OK, the LeaveParty request could not be started.
// This is usually due to some user error such as not having
// completed the authentication process yet.
if ( leavePartyResult != Party.ResultCode.OK )
{
// Handle the error in an appropriate way
// (out of scope of this documentation).
Console.WriteLine("Failed to make party leave request. Error: " +
Party.GetResultCodeDescription(leavePartyResult));
}
}
}