Skip to main content

FriendBaseResultObserver

If you were looking for the method for use with Unity, see FriendBaseResultObserver for Unity SDK.

Register the callback of the Player Network SDK friend module, the game needs to process the callback function. For more information on the callback data structure, see BaseResult.

note

It is strongly recommended to perform registration in the startup function of the game application.

Function definition

C++ event handling (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 sample

C++ event handling (above V1.15)

//configure callback
FINTLFriendBaseEvent friendBaseEvent;
friendBaseEvent.AddUObject(this, &OnFriendBaseResult_Implementation);
UINTLSDKAPI::SetFriendBaseResultObserver(friendBaseEvent);
// Remove callbacks
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);
}