Skip to main content

GroupBaseResultObserver

If you were looking for the method for use with Unreal Engine, see GroupBaseResultObserver for Unreal Engine SDK.

Register the callback of the Player Network SDK Guild 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

// Add the INTLBaseResult callback to process callback 
public static void AddGroupBaseResultObserver(OnINTLResultHandler<INTLBaseResult> callback);
// Remove the INTLBaseResult callback
public static void RemoveGroupBaseResultObserver(OnINTLResultHandler<INTLBaseResult> callback);

Code sample

// Add callbacks
public void AddGroupObserver()
{
INTLAPI.AddGroupBaseResultObserver(OnGroupBaseEvent);
}

// Remove callbacks
public void RemoveFriendObserver()
{
INTLAPI.RemoveGroupBaseResultObserver(OnGroupBaseEvent);
}

// Process the INTLBaseResult callback
public void OnGroupBaseEvent(INTLBaseResult ret)
{
Debug.Log($"MethodID: {ret.MethodId}");

string methodTag = "";
if (ret.MethodId == (int)INTLMethodID.INTL_GROUP_SHOW_AGREEMENT_WINDOW)
{
methodTag = "ShowAgreementWindow";
} else if (ret.MethodId == (int)INTLMethodID.INTL_GROUP_SHOW_ROOM)
{
methodTag = "ShowRoom";
}
ShowLogInNewLine(methodTag + Tools.Instance.GetRetString(ret));
}