AuthAccountResultObserver
Registers the callback of the Player Network SDK custom account module, the game needs to process the callback function. For more information on the callback data structure, see AccountResult.
note
It is strongly recommended to perform registration in the startup function of the game application.
Function definition
// Add the INTLAccountResult callback to process callback
public static void AddAccountResultObserver(OnINTLResultHandler<INTLAccountResult> callback);
// Remove the INTLAccountResult callback
public static void RemoveAccountResultObserver(OnINTLResultHandler<INTLAccountResult> callback);
Code sample
// Add callbacks
public void AddAuthObserver()
{
INTLAPI.AddAccountResultObserver(OnAuthAccountResultEvent);
}
// Remove callbacks
public void RemoveAuthObserver()
{
INTLAPI.RemoveAccountResultObserver(OnAuthAccountResultEvent);
}
// Process the INTLAccountResult callback
public void OnAuthAccountResultEvent(INTLAccountResult ret)
{
Debug.Log($"MethodID: {ret.MethodId}");
Debug.Log("OnAuthAccountResultEvent in Login");
string methodTag = "";
if (accountRet.MethodId == (int)INTLMethodID.INTL_AUTH_REQUEST_VERIFY_CODE)
{
methodTag = "RequestVerifyCode";
}
else if (accountRet.MethodId == (int)INTLMethodID.INTL_AUTH_RESET_PASSWORD)
{
// Correspond to ResetPasswordWithVerifyCode、ResetPasswordWithOldPassword
methodTag = "ResetPassword";
}
else if (accountRet.MethodId == (int)INTLMethodID.INTL_AUTH_MODIFY_ACCOUNT)
{
// Correspond to ModifyAccountWithVerifyCode、ModifyAccountWithPassword、ModifyAccountWithLoginState
methodTag = "ModifyAccount";
}
else if (accountRet.MethodId == (int)INTLMethodID.INTL_AUTH_QUERY_REGISTER_STATUS)
{
methodTag = "QueryRegisterStatus";
}
else if (accountRet.MethodId == (int)INTLMethodID.INTL_AUTH_QUERY_VERIFY_CODE_STATUS)
{
methodTag = "QueryVerifyCodeStatus";
}
else if (accountRet.MethodId == (int)INTLMethodID.INTL_AUTH_QUERY_IS_RECEIVE_EMAIL)
{
methodTag = "QueryIsReceiveEmail";
}
else if (accountRet.MethodId == (int)INTLMethodID.INTL_AUTH_REGISTER)
{
methodTag = "Register";
}
else if (accountRet.MethodId == (int)INTLMethodID.INTL_AUTH_MODIFY_PROFILE)
{
methodTag = "ModifyProfile";
}
m_sample.ShowLogInNewLine(methodTag + Tools.Instance.GetRetString(accountRet));
}