Esempio n. 1
0
        void Awake()
        {
            mBackBtn
            .OnClickAsOptional()
            .Repeat()
            .Subscribe(_ => BackToLogin());

            RegistConfirm();
        }
Esempio n. 2
0
        void Awake()
        {
            mSignUpBtn
            .OnClickAsOptional()
            .Repeat()
            .Subscribe(_ => {
                this.gameObject.SetActive(false);
                mSignUpPage.gameObject.SetActive(true);
            });

            RegistLogin();
        }
Esempio n. 3
0
        void RegistConfirm()
        {
            mConfirmBtn
            .OnClickAsOptional()

            .SelectMany(_ => {
                if (mPasswordFld.text != mPasswordConfirmFld.text)
                {
                    throw new System.Exception("missmatch password and confirm password. please check that a both is matched.");
                }

                return(DC.CNetwork.s.platform.account.Authentication());
            })
            .SelectMany(err => {
                if ("ok" == err)
                {
                    var signup_param = new Sas.Data.AccountSignupParam();
                    var email        = new System.Security.SecureString();
                    mAccountIDFld.text.ToList().ForEach(c => email.AppendChar(c));
                    signup_param.email = email;

                    var password = new System.Security.SecureString();
                    mPasswordFld.text.ToList().ForEach(c => password.AppendChar(c));
                    signup_param.password = password;

                    return(DC.CNetwork.s.platform.account.SignUp(signup_param));
                }
                else
                {
                    throw new Sas.Exception(Sas.ERRNO.MESSAGE.ToErrCode(), "make sure that authentication.");
                }
            })
            .Repeat()
            .Subscribe(ret => {
                CModal.Make("", "Wellcome to Dot chat!!").onHandleBtn += (CPopup arg1, string arg2) => arg1.Close();
                BackToLogin();
            },
                       err => {
                if (!CNetwork.s.ContainHandleErr(err))
                {
                    if (string.IsNullOrEmpty(err.Message))
                    {
                        CModal.Make("", err.ToErrstrOfSas()).onHandleBtn += (CPopup arg1, string arg2) => arg1.Close();
                    }
                    else
                    {
                        CModal.Make("", err.Message).onHandleBtn += (CPopup arg1, string arg2) => arg1.Close();
                    }
                }
                RegistConfirm();
            });
        }
Esempio n. 4
0
        void RegistLogin()
        {
            mLoginBtn
            .OnClickAsOptional()
            .SelectMany(_ => {
                return(DC.CNetwork.s.platform.account.Authentication());
            })
            .SelectMany(err => {
                if ("ok" == err)
                {
                    var login_param = new Sas.Data.AccountLoginParam();
                    var email       = new System.Security.SecureString();
                    mAccountIDFld.text.ToList().ForEach(c => email.AppendChar(c));
                    login_param.email = email;

                    var password = new System.Security.SecureString();
                    mPasswordFld.text.ToList().ForEach(c => password.AppendChar(c));
                    login_param.password = password;

                    return(DC.CNetwork.s.platform.account.Login(login_param));
                }
                else
                {
                    throw new Sas.Exception(Sas.ERRNO.MESSAGE.ToErrCode(), "make sure that authentication.");
                }
            })
            .SelectMany(_ => DC.CNetwork.s.platform.account.AccessOpen())
            .SelectMany(_ => DC.CNetwork.s.platform.account.DumpAutoLogin(Config.acccount_file_name))
            .Repeat()
            .Subscribe(ret => {
                UnityEngine.SceneManagement.SceneManager.LoadScene("Dotchatti");
//                        CModal.Make ("", "success").onHandleBtn += (CPopup arg1, string arg2) => arg1.Close ();
            },
                       err => {
                if (!CNetwork.s.ContainHandleErr(err))
                {
                    if (string.IsNullOrEmpty(err.Message))
                    {
                        CModal.Make("", err.ToErrstrOfSas()).onHandleBtn += (CPopup arg1, string arg2) => arg1.Close();
                    }
                    else
                    {
                        CModal.Make("", err.Message).onHandleBtn += (CPopup arg1, string arg2) => arg1.Close();
                    }
                }
                RegistLogin();
            });
        }
Esempio n. 5
0
        void AttachMatchBtn()
        {
            if (mBtnLastMatch != null)
            {
                mBtnLastMatch.enabled = false;
            }

            if (this.current_chat_id != 0)
            {
                AttachRecommand(this.current_chat_id);
                this.current_chat_id = 0;
            }

            // to delay 1 frame
            Sas.SasUtil.StartRx()
            .Delay(new System.TimeSpan(1))
            .SelectMany(_ => {
                AttachNotice("for starting, please click the matching button");
                var prefab    = Resources.Load <UnityEngine.UI.Button> ("Prefabs/btn_chat_one");
                mBtnLastMatch = Instantiate(prefab, mContents);
                mContents.GetComponent <DC.CTalkContents> ().Add(mBtnLastMatch);
                return(mBtnLastMatch.OnClickAsOptional());
            })
            .Catch <UniRx.Unit, System.Exception> (err => {
                AttachMatchBtn();
                throw err;
                return(Sas.SasUtil.StartRx().Select(_ => UniRx.Unit.Default));
            })
            .First()
            .Do(__ => {
                mBtnLastMatch.enabled = false;
                Connect();
            })
            .Subscribe(_ => {
            },
                       err => {
                Debug.LogError(err);
                if (mBtnLastMatch != null)
                {
                    mBtnLastMatch.enabled = true;
                }
            });
        }