Skip to main content

Callback of the Friend module (GUAFriendBaseResultObserver)

[MSDK & Player Network SDK] Register the callback of the Friend module. The game needs to register the callback for handling.For more information about the callback data structure, see GUABaseResult.

note

It is strongly recommended that games register in the application startup function.

Function Definition

List of methods for handling callback events

Callback EventCommon[Player Network SDK only][MSD only]
FriendBaseEventsSendMessage,
Share
*AddFriend
event OnResultHandler<GUABaseResult> FriendBaseEvents;

Code Example

// Add callback
UnionAdapterAPI.GetFriendService().FriendBaseEvents += OnFriendBaseEvent;

// Remove callback
UnionAdapterAPI.GetFriendService().FriendBaseEvents -= OnFriendBaseEvent;

// Handle FriendBaseEvents callback
private void OnFriendBaseEvent(GUABaseResult baseRet)
{
string methodTag = "";

if (baseRet.MethodId == (int)GUAMethodID.GUA_FRIEND_SHARE)
{
methodTag = "Share";
}
else if (baseRet.MethodId == (int)GUAMethodID.GUA_FRIEND_SEND_MESSAGE)
{
methodTag = "SendMessage";
}
Debug.Log.(methodTag + baseRet.ToString());
}