Пример #1
0
 public void AnonymousLoginClick()
 {
     AGConnectAuth.getInstance().signInAnonymously()
     .addOnSuccessListener(new HuaweiOnsuccessListener <SignInResult>((signresult) =>
     {
         PanelController.popupinstance.ShowInfo("Login in successfully");
         PanelController.userInfo.ParentPanel = this;
         PanelController.getInstance().OpenPanel(PanelController.userInfo);
     })).addOnFailureListener(new HuaweiOnFailureListener((e
                                                           ) =>
     {
         Error error   = new Error();
         error.message = e.toString();
         PanelController.popupinstance.ShowError(error);
     }));
 }
Пример #2
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);
            }
        }
Пример #3
0
        public void OnLoginClicked()
        {
            try
            {
                if (verifyCode.text.Trim() != "")
                {
                    credential =
                        EmailAuthProvider.credentialWithVerifyCode(email.text.Trim(), password.text.Trim(), verifyCode.text.Trim());
                }
                else
                {
                    credential =
                        EmailAuthProvider.credentialWithPassword(email.text, password.text);
                }

                if (credential.getProvider() == AGConnectAuthCredential.Email_Provider)
                {
                    AGConnectAuth.getInstance().signIn(credential)
                    .addOnSuccessListener(new HuaweiOnsuccessListener <SignInResult>((signresult) =>
                    {
                        UnityMainThread.instance.AddJob(() =>
                        {
                            PanelController.popupinstance.ShowInfo("Login in successfully");
                            PanelController.userInfo.ParentPanel = this;
                            PanelController.getInstance().OpenPanel(PanelController.userInfo);
                        });
                    })).addOnFailureListener(new HuaweiOnFailureListener((e
                                                                          ) =>
                    {
                        UnityMainThread.instance.AddJob(() =>
                        {
                            Error error   = new Error();
                            error.message = e.toString();
                            PanelController.popupinstance.ShowError(error);
                        });
                    }));
                }
            }
            catch (System.Exception e)
            {
                Error error = new Error();
                error.message = e.Message;
                PanelController.popupinstance.ShowError(error);
            }
        }
        public void OnSignUpButtonClick()
        {
            if (password.text != passwordConfirmation.text)
            {
                Error error = new Error();
                error.message = "两次输入的密码不一致";
                PanelController.popupinstance.ShowError(error);
                return;
            }

            try
            {
                PhoneUser phoneUser = new PhoneUser.Builder()
                                      .setCountryCode(regionText)
                                      .setPhoneNumber(emailorPhone.text)
                                      .setVerifyCode(verifyCode.text)
                                      .setPassword(password.text)
                                      .build();
                AGConnectAuth.getInstance().createUser(phoneUser)
                .addOnSuccessListener(new HuaweiOnsuccessListener <SignInResult>((signresult) =>
                {
                    UnityMainThread.instance.AddJob(() =>
                    {
                        PanelController.popupinstance.ShowInfo("sign up successfully!");
                        PanelController.userInfo.ParentPanel = this;
                        PanelController.getInstance().OpenPanel(PanelController.userInfo);
                    });
                })).addOnFailureListener(new HuaweiOnFailureListener((e
                                                                      ) =>
                {
                    UnityMainThread.instance.AddJob(() =>
                    {
                        Error error   = new Error();
                        error.message = e.toString();
                        PanelController.popupinstance.ShowError(error);
                    });
                }));
            }catch (System.Exception e) {
                Error error = new Error();
                error.message = e.Message;
                PanelController.popupinstance.ShowError(error);
            }
        }
Пример #5
0
        public void LogOutClick()
        {
            try
            {
                if (AGConnectAuth.getInstance() != null)
                {
                    AGConnectAuth.getInstance().signOut();
                    PanelController.popupinstance.ShowInfo("User has been sign out!");
                    PanelController.getInstance().OpenPanel(PanelController.getInstance().GetComponentInChildren <SignInPanel>());
                }
            } catch (System.Exception e)
            {
                Error error = new Error();
                error.message = e.Message;
                PanelController.popupinstance.ShowError(error);
            }

            PanelController.getInstance().OpenPanel(PanelController.getInstance().GetComponentInChildren <SignInPanel>());
        }
Пример #6
0
        public void OnSignUpClicked()
        {
            EmailUser emailUser = new EmailUser.Builder()
                                  .setEmail(emailorPhone.text)
                                  .setVerifyCode(verifyCode.text)
                                  .setPassword(password.text)
                                  .build();

            AGConnectAuth.getInstance().createUser(emailUser)
            .addOnSuccessListener(new HuaweiOnsuccessListener <SignInResult>((signresult) =>
            {
                PanelController.popupinstance.ShowInfo("sign up successfully!");
                PanelController.userInfo.ParentPanel = this;
                PanelController.getInstance().OpenPanel(PanelController.userInfo);
            })).addOnFailureListener(new HuaweiOnFailureListener((e
                                                                  ) =>
            {
                Error error   = new Error();
                error.message = "Login failed" + e.ToString();
                PanelController.popupinstance.ShowError(error);
            }));
        }
Пример #7
0
 public void OnPhoneLoginClicked()
 {
     PanelController.getInstance()
     .OpenPanel(PanelController.getInstance().GetComponentInChildren <PhoneLoginNPanel>());
 }
Пример #8
0
 public void OnEmailLoginClicked()
 {
     PanelController.getInstance()
     .OpenPanel(PanelController.getInstance().GetComponentInChildren <EmailSignInPanel>());
 }
 public void Start()
 {
     panelController = this;
 }
Пример #10
0
        void Start()
        {
            UserNikeName.text    = "";
            UserEmail.text       = "";
            UserPhoneNumber.text = "";
            LogOut.onClick.AddListener(() => LogOutClick());
            modifyEmail.onClick.AddListener(() =>
            {
                if (UserEmail.text == "" || UserEmail.text == "Null")
                {
                    PanelController.popupinstance.ShowInfo("the email is Null, you can't modify it");
                    MessageInfo.text = "the email is Null, you can't modify it";
                    return;
                }

                OnModifyClick(true, false);
            });
            modifyPhone.onClick.AddListener(() =>
            {
                if (UserPhoneNumber.text == "" || UserPhoneNumber.text == "Null")
                {
                    PanelController.popupinstance.ShowInfo("the phone is Null, you can't modify it");
                    MessageInfo.text = "the phone is Null, you can't modify it";

                    return;
                }

                OnModifyClick(false, false);
            });
            modifyEmailPassword.onClick.AddListener(() =>
            {
                if (UserEmail.text == "" || UserEmail.text == "Null")
                {
                    PanelController.popupinstance.ShowInfo("the email is Null, you can't modify it");
                    MessageInfo.text = "the email is Null, you can't modify it";
                    return;
                }

                OnModifyClick(true, true);
            });
            modifyPhonePassword.onClick.AddListener(() =>
            {
                if (UserPhoneNumber.text == "" || UserPhoneNumber.text == "Null")
                {
                    PanelController.popupinstance.ShowInfo("the phone is Null, you can't modify it");
                    MessageInfo.text = "the phone is Null, you can't modify it";
                    return;
                }

                OnModifyClick(false, true);
            });
            deleteUser.onClick.AddListener(() =>
            {
                AGConnectAuth.getInstance().deleteUser();
                PanelController.popupinstance.ShowInfo("the user has been delete!");
                PanelController.getInstance()
                .OpenPanel(PanelController.getInstance().GetComponentInChildren <SignInPanel>());
            });

            Link.onClick.AddListener(() =>
            {
                PanelController.getInstance().GetComponentInChildren <LinkThirdParty>().ParentPanel = this;
                PanelController.getInstance()
                .OpenPanel(PanelController.getInstance().GetComponentInChildren <LinkThirdParty>());
            });
        }
Пример #11
0
 public void SignUpClicked()
 {
     PanelController.getInstance()
     .OpenPanel(PanelController.getInstance().GetComponentInChildren <PhoneSignUpPanel>());
 }
 public void OnModifyClick()
 {
     instance      = AGConnectAuth.getInstance();
     agConnectUser = instance.getCurrentUser();
     if (agConnectUser != null)
     {
         try
         {
             if (!isModifyPassword)
             {
                 if (isPhoneOrEmail)
                 {
                     modifyTask = agConnectUser
                                  .updateEmail(newemailorPhoneorpassword.text.Trim(), verifyCode.text.Trim());
                 }
                 else
                 {
                     modifyTask = agConnectUser
                                  .updatePhone("+86", newemailorPhoneorpassword.text.Trim(), verifyCode.text.Trim());
                 }
             }
             else
             {
                 modifyTask = agConnectUser.updatePassword(
                     newemailorPhoneorpassword.text.Trim(),
                     verifyCode.text.Trim(),
                     isPhoneOrEmail
                         ? AGConnectAuthCredential.Email_Provider
                         : AGConnectAuthCredential.Phone_Provider);
             }
             modifyTask.addOnSuccessListener(new HuaweiOnsuccessListener <SignInResult>((signresult) =>
             {
                 UnityMainThread.instance.AddJob(() =>
                 {
                     PanelController.popupinstance.ShowInfo("modify successfully!");
                     showMessage.text = "modify successfully!";
                     PanelController.getInstance().OpenPanel(PanelController.userInfo);
                 });
             })).addOnFailureListener(new HuaweiOnFailureListener((e
                                                                   ) =>
             {
                 UnityMainThread.instance.AddJob(() =>
                 {
                     Error error   = new Error();
                     error.message = e.toString();
                     PanelController.popupinstance.ShowError(error);
                     showMessage.text = e.toString();
                 });
             }));
         }
         catch (System.Exception e)
         {
             Error error = new Error();
             error.message    = e.Message;
             showMessage.text = e.Message;
             PanelController.popupinstance.ShowError(error);
         }
     }
     else
     {
         showMessage.text = "User is null!";
     }
 }
Пример #13
0
 public void OnLoginClicked(int provider)
 {
     DetailLogin.Provider = provider;
     PanelController.getInstance()
     .OpenPanel(PanelController.getInstance().GetComponentInChildren <DetailLogin>());
 }