Skip to main content

Callback for Friend Module (FriendBaseResultObserver)

If you are using the Unity engine, please see Unity SDK's FriendBaseResultObserver.

Register the callback for the Player Network SDK friend module; the game needs to register the callback for handling.For more information about the callback data structure, please see BaseResult.

note

It is strongly recommended that games register during the application start-up function.

Function definition

C++ Event Handling Method (Above V1.15)

//Configure callback
void SetFriendBaseResultObserver(FINTLFriendBaseEvent& callback);
//Get callback
FINTLFriendBaseEvent& GetFriendBaseResultObserver();

Unreal Engine Event Handling

UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "INTLSDKObserver")
void OnFriendBaseResult(FINTLBaseResult ret);
virtual void OnFriendBaseResult_Implementation(FINTLBaseResult ret) {};

Code example

C++ Event Handling Method (Above V1.15)

//Configure callback
FINTLFriendBaseEvent friendBaseEvent;
friendBaseEvent.AddUObject(this, &OnFriendBaseResult_Implementation);
UINTLSDKAPI::SetFriendBaseResultObserver(friendBaseEvent);
//Clear callback
UINTLSDKAPI::GetFriendBaseResultObserver().Clear();
void OnFriendBaseResult_Implementation(FINTLBaseResult ret)
{
UE_LOG(LogTemp, Warning, TEXT("MethodID: %d"), ret.MethodId);
}

Unreal Engine Event Handling

void OnFriendBaseResult_Implementation(FINTLBaseResult ret)
{
UE_LOG(LogTemp, Warning, TEXT("MethodID: %d"), ret.MethodId);
}