//------------------------------------------------------------------------- void _onUCenterRegister(UCenterResponseStatus status, AccountRegisterResponse response, UCenterError error) { EbLog.Note("ClientSampleApp._onUCenterRegister() UCenterResult=" + status); if (error != null) { EbLog.Note("ErrorCode=" + error.ErrorCode); EbLog.Note("ErrorMessage=" + error.Message); } }
private void RequestRegister() { SnipeCommunicator.Instance.CreateRequest(SnipeMessageTypes.AUTH_USER_REGISTER)?.RequestAuth(null, (error_code, response) => { int user_id = 0; if (error_code == "ok") { JustRegistered = true; string auth_login = response.SafeGetString("uid"); string auth_token = response.SafeGetString("password"); PlayerPrefs.SetString(SnipePrefs.AUTH_UID, auth_login); PlayerPrefs.SetString(SnipePrefs.AUTH_KEY, auth_token); user_id = response.SafeGetValue <int>("id"); Analytics.SetUserId(user_id.ToString()); Analytics.TrackEvent(Analytics.EVENT_ACCOUNT_REGISTERED, new SnipeObject() { ["user_id"] = user_id, }); SwitchToDefaultAuthProvider(); mCurrentProvider.RequestAuth(OnCurrentProviderAuthResult); BindAllProviders(false); } else { Analytics.TrackEvent(Analytics.EVENT_ACCOUNT_REGISTERATION_FAILED, new SnipeObject() { ["error_code"] = error_code, }); InvokeAuthFailCallback(error_code); } AccountRegisterResponse?.Invoke(error_code, user_id); }); }
//------------------------------------------------------------------------- void _onUCenterRegister(UCenterResponseStatus status, AccountRegisterResponse response, UCenterError error) { //UiHelper.DestroyWaiting(); if (status == UCenterResponseStatus.Success) { //FloatMsgInfo f_info; //f_info.msg = "帐号注册成功"; //f_info.color = Color.green; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); CoApp.CoNetMonitor.AccId = response.AccountId; CoApp.CoNetMonitor.Acc = response.AccountName; _requestLogin(response.AccountName, mPassword); //ClientLoginRequest login_request = new ClientLoginRequest(); //login_request.acc = CoApp.CoNetMonitor.Acc; //login_request.pwd = RegisterPwdCache; //EcEngine.Instance.CoUCenterSDK.login(login_request, _onUCenterLogin); //RegisterPwdCache = null; } else if (error != null) { if (error.ErrorCode == UCenterErrorCode.AccountRegisterFailedAlreadyExist) { //FloatMsgInfo f_info; //f_info.msg = "帐号注册失败,帐号已存在"; //f_info.color = Color.red; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); } else { //FloatMsgInfo f_info; //f_info.msg = "帐号注册失败"; //f_info.color = Color.red; //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info); } } }