Skip to main content

Friend Query Callback (GUAQuereyFriendObserver)

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

note

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

Function Definition

Method list for handling callback events

Callback EventCommon[Player Network SDK only][MSD only]
FriendBaseEventsQueryFriends*-
event OnResultHandler<GUAFriendResult> QuereyFriendEvents;

Code Example

// Add callback
UnionAdapterAPI.GetFriendService().QuereyFriendEvents += OnFriendQueryFriend;

// Remove callback
UnionAdapterAPI.GetFriendService().QuereyFriendEvents -= OnFriendQueryFriend;

// QuereyFriendEvents callback handling
private void OnFriendQueryFriend(GUAFriendResult friendRet)
{
string methodTag = "";
if (friendRet.MethodId == (int)GUAMethodID.GUA_FRIEND_QUERY_FRIENDS)
{
methodTag = "QueryFriends";
}
Debug.Log(methodTag + friendRet.ToString());
}