Callback for the friend module (FriendResultObserver)
Register the callback for the Player Network SDK friend module; the game needs to handle callback functionality.For more information on the callback data structure, see FriendResult.
note
It is strongly recommended that games register during the application start-up function.
Function definition
// Add INTLFriendResult callback
public static void AddFriendResultObserver(OnINTLResultHandler<INTLFriendResult> callback);
// Remove INTLFriendResult callback
public static void RemoveFriendResultObserver(OnINTLResultHandler<INTLFriendResult> callback);
Code sample
// Add callback
public void AddFriendObserver()
{
INTLAPI.AddFriendResultObserver(OnFriendEvent);
}
// Remove callback
public void RemoveFriendObserver()
{
INTLAPI.RemoveFriendResultObserver(OnFriendEvent);
}
// Callback processing for INTLFriendResult
public void OnFriendEvent(INTLFriendResult ret)
{
Debug.Log($"MethodID: {ret.MethodId}");
string methodTag = "";
if (ret.MethodId == (int)INTLMethodID.INTL_FRIEND_QUERY_FRIEND)
{
methodTag = "QueryFriends";
}
ShowLogInNewLine(methodTag + Tools.Instance.GetRetString(ret));
}