Skip to main content

GUALoginResultObservers

[MSDK and Player Network SDK] Registers the callback of the Auth module, the game needs to process the callback function. For more information on the callback data structure, see GUALoginResult.

note

It is strongly recommended to perform registration in the startup function of the game application.

Function Definition

The list of methods used to process the callback events.

Callback EventCommon[Player Network SDK Only][MSDK Only]
LoginResultEventsLogin,
Bind,
AutoLogin,
SwitchUser,
QueryUserInfo,
LoginWithConfirmCode
Register,
LoginWithMappedChannel,
BuildMapWithLoggedinChannel,
QueryLegalDocumentsAcceptedVersion,
LoginWithPassword,
LoginWithVerifyCode
BindUI,
Check,
CheckLogin,
BindWithConfirmCode
event OnResultHandler<GUALoginResult> LoginResultEvents;

Code Sample

// Add callbacks
UnionAdapterAPI.GetAccountService().LoginResultEvents += OnLoginResultEvent;

// Remove callbacks
UnionAdapterAPI.GetAccountService().LoginResultEvents -= OnLoginResultEvent;

// LoginResultEvents callback
public void OnLoginResultEvent(GUALoginResult loginRet)
{
Debug.Log("OnLoginResultEvent");
string methodTag = "";
if (loginRet.MethodId == (int)GUAMethodID.GUA_ACCOUNT_LOGIN)
{
methodTag = "Login";
}
else if (loginRet.MethodId == (int)GUAMethodID.GUA_ACCOUNT_BIND)
{
methodTag = "Bind";
}
else if (loginRet.MethodId == (int)GUAMethodID.GUA_ACCOUNT_AUTOLOGIN)
{
methodTag = "AutoLogin";
}
else if (loginRet.MethodId == (int)GUAMethodID.GUA_ACCOUNT_SWITCH_USER)
{
methodTag = "SwitchUser";
}
else if (loginRet.MethodId == (int)GUAMethodID.GUA_ACCOUNT_QUERY_USER_INFO)
{
methodTag = "QueryUserInfo";
}
Debug.Log("OnLoginResultEvent start format json");
Debug.Log(methodTag + loginRet);
}