Beispiel #1
0
        public void OnLoginClicked()
        {
            try
            {
                if (smsCode.text.Trim() == "")
                {
                    credential =
                        PhoneAuthProvider.credentialWithPassword("+86", phoneNumber.text.Trim(), password.text.Trim());
                }
                else
                {
                    credential =
                        PhoneAuthProvider.credentialWithVerifyCode("+86", phoneNumber.text.Trim(), password.text.Trim(),
                                                                   smsCode.text.Trim());
                }

                AGConnectAuth.getInstance().signIn(credential)
                .addOnSuccessListener(new HuaweiOnsuccessListener <SignInResult>((signresult) =>
                {
                    UnityMainThread.instance.AddJob(() =>
                    {
                        PanelController.popupinstance.ShowInfo("Login success!");
                        PanelController.userInfo.ParentPanel = this;
                        infoMessage.text = "login success!";
                        PanelController.getInstance().OpenPanel(PanelController.userInfo);
                    });
                })).addOnFailureListener(new HuaweiOnFailureListener((e
                                                                      ) =>
                {
                    UnityMainThread.instance.AddJob(() =>
                    {
                        Error error   = new Error();
                        error.message = e.toString();
                        PanelController.popupinstance.ShowError(error);
                        infoMessage.text = e.toString();
                    });
                }));
            }
            catch (System.Exception e)
            {
                Error error = new Error();
                error.message = e.Message;
                PanelController.popupinstance.ShowError(error);
            }
        }