public void TokenLoginTestFinishedCallBack(string param)
        {
            JSONNode             node             = JSON.Parse(param);
            GeneralLocalDataItem generalLocalData = Singleton <MiHoYoGameData> .Instance.GeneralLocalData;

            if (node["retcode"].AsInt >= 0)
            {
                base.AccountUid       = generalLocalData.Account.uid;
                base.AccountToken     = generalLocalData.Account.token;
                base.AccountExt       = generalLocalData.Account.ext;
                this.Name             = generalLocalData.Account.name;
                this.Email            = generalLocalData.Account.email;
                this.Mobile           = generalLocalData.Account.mobile;
                this.IsEmailVerify    = generalLocalData.Account.isEmailVerify;
                this.IsRealNameVerify = generalLocalData.Account.isRealNameVerify;
                Singleton <NotifyManager> .Instance.FireNotify(new Notify(NotifyTypes.MihoyoAccountLoginSuccess, null));

                if (base.IsAccountBind() && (!this.IsEmailVerify || !this.IsRealNameVerify))
                {
                    this.GetUserInfoByToken();
                }
            }
            else
            {
                generalLocalData.ClearLastLoginUser();
                Singleton <MiHoYoGameData> .Instance.SaveGeneralData();

                Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_MihoyoAccountTokenError", new object[0]), 2f), UIType.Any);

                this.LoginUI();
            }
        }
        public void TokenLoginTest()
        {
            GeneralLocalDataItem generalLocalData = Singleton <MiHoYoGameData> .Instance.GeneralLocalData;
            string url = string.Format(this.ORIGINAL_TOKEN_LOGIN_URL + "?uid={0}&token={1}", generalLocalData.Account.uid, generalLocalData.Account.token);

            Singleton <ApplicationManager> .Instance.StartCoroutine(Miscs.WWWRequestWithRetry(url, new Action <string>(this.TokenLoginTestFinishedCallBack), () => this.WWWTimeOut(new Action(this.TokenLoginTest)), 5f, 3, null, null));
        }
Example #3
0
 private void CheckVersionAndClearIfNeed()
 {
     if ((this._generalData != null) && (this._generalData.UserLocalDataVersion != LocalDataVersion.version))
     {
         DeleteAllData();
         this._generalData = new GeneralLocalDataItem();
         this._generalData.UserLocalDataVersion = LocalDataVersion.version;
         this.SaveGeneralData();
     }
 }
Example #4
0
 private void InitGeneralData()
 {
     this._generalData = new GeneralLocalDataItem();
     this.SaveGeneralData();
 }