跳到主要内容

GUAAccountResultObservers

[Player Network SDK 和 MSDK 共有] 注册自建账号模块的回调,游戏需要对回调函数进行处理。更多关于回调数据结构,可以查看 GUAAccountResult

注意

强烈建议游戏在应用启动函数中进行注册。

函数定义

回调事件用于处理的方法列表

回调事件Common[仅限 Player Network SDK][仅限 MSD]
AccountEventsResetPassword,
QueryVerifyCodeStatus,
QueryRegisterStatus,
QueryReceiveEmail,
ModifyAccountWithPassword,
ModifyAccountWithVerifyCode
QueryCanBind,
QueryBindInfo,
QueryAccountProfile,
ModifyProfile,
QueryDataProtectionAcceptance,
ModifyDataProtectionAcceptance,
QueryUserNameStatus
CanBind
event OnResultHandler<GUAAccountResult> AccountEvents;

代码示例

// 增加回调
UnionAdapterAPI.GetAccountService().AccountEvents += OnAccountResultEvent;

// 移除回调
UnionAdapterAPI.GetAccountService().AccountEvents -= OnAccountResultEvent;

// AccountEvents 的回调处理
public void OnAccountResultEvent(GUAAccountResult accountRet)
{
Debug.Log("OnAuthAccountResultEvent in Login");
string methodTag = "";
if (accountRet.MethodId == (int)GUAMethodID.GUA_ACCOUNT_RESET_PASSWORD)
{
methodTag = "ResetPassword";
}
else if (accountRet.MethodId == (int)GUAMethodID.GUA_ACCOUNT_MODIFY_ACCOUNT)
{
methodTag = "ModifyAccount";
}
else if (accountRet.MethodId == (int)GUAMethodID.GUA_ACCOUNT_QUERY_REGISTER_STATUS)
{
methodTag = "QueryRegisterStatus";
}
else if (accountRet.MethodId == (int)GUAMethodID.GUA_ACCOUNT_QUERY_VERIFY_CODE_STATUS)
{
methodTag = "QueryVerifyCodeStatus";
}
else if (accountRet.MethodId == (int)GUAMethodID.GUA_ACCOUNT_QUERY_IS_RECEIVE_EMAIL)
{
methodTag = "QueryIsReceiveEmail";
}
Debug.Log("OnLoginResultEvent start format json");
Debug.Log(methodTag + loginRet);
}