Skip to main content

AuthBaseResultObserver

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

Registers the callback of the Player Network SDK Auth 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, will be used to handle Logout callback
public static void AddAuthBaseResultObserver(OnINTLResultHandler<INTLBaseResult> callback);

// Remove the INTLBaseResult callback
public static void RemoveAuthBaseResultObserver(OnINTLResultHandler<INTLBaseResult> callback);

Code sample

// Add callbacks
public void AddAuthBaseObserver()
{
INTLAPI.AddAuthBaseResultObserver(OnAuthBaseResultEvent);
}

// Remove callbacks
public void RemoveAuthBaseObserver()
{
INTLAPI.RemoveAuthBaseResultObserver(OnAuthBaseResultEvent);
}

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

string methodTag = "";
if (ret.MethodId == (int)INTLMethodID.INTL_AUTH_LOGOUT)
{
methodTag = "Logout";
}
ShowLogInNewLine(methodTag + Tools.Instance.GetRetString(ret));
}