private void OnSubmit(string accountId)
        {
#if USE_ACCOUNT_AUTH
            EB.Debug.Log("OnSubmit: accountId = {0}", accountId);

            if (string.IsNullOrEmpty(accountId))
            {
                if (mAuthCallback != null)
                {
                    mAuthCallback("Empty Account Id!", null);
                    mAuthCallback = null;
                }
            }
            else
            {
                if (mAuthCallback != null)
                {
                    mLoggedIn  = true;
                    mAccountId = accountId;
                    SecurePrefs.SetString("AccountId", mAccountId);

                    var data = new Hashtable();
                    data["accountId"] = mAccountId;
                    mAuthCallback(null, data);
                    mAuthCallback = null;
                }
            }
#endif
        }
Example #2
0
        static public void SaveAccountData(string phone, string password)
        {
            UserInfo userInfo = UserInfoList.Find(u => u.phone == phone);

            if (userInfo == null)
            {
                UserInfoList.Add(new UserInfo()
                {
                    phone    = phone,
                    password = password
                });
            }
            else
            {
                userInfo.password = password;
            }
            SecurePrefs.SetString("UserID", phone);
            SecurePrefs.SetString("UserPwd", password);

            string userInfos = SecurePrefs.GetString("UserInfoData", "");

            Debug.Log("store before UserInfoData:" + userInfos);
            Hashtable userHashtable = EB.JSON.Parse(userInfos) as Hashtable;

            if (userHashtable != null && userHashtable.ContainsKey(phone))
            {
                userHashtable.Remove(phone);
            }
            userHashtable = userHashtable ?? Johny.HashtablePool.Claim();
            userHashtable.Add(phone, password);
            SecurePrefs.SetString("UserInfoData", EB.JSON.Stringify(userHashtable));
            Debug.Log("store UserInfoData:" + SecurePrefs.GetString("UserInfoData", ""));
        }
Example #3
0
        public void Authenticate(bool silent, System.Action <string, object> callback)
        {
            if (silent)
            {
                if (mLoggedIn)
                {
                    var data = Johny.HashtablePool.Claim();
                    data["udid"] = mDeviceAuthId;
                    callback(null, data);
                }
                else
                {
                    callback(null, null);
                }
            }
            else
            {
                mLoggedIn = true;

                SecurePrefs.SetInt("DeviceLoggedIn", EB.Time.Now);
                SecurePrefs.SetString("DeviceAuthId", mDeviceAuthId);

                var data = Johny.HashtablePool.Claim();
                data["udid"] = mDeviceAuthId;
                callback(null, data);
            }
        }
Example #4
0
        //-------∽-★-∽------∽-★-∽--------∽-★-∽数据操作∽-★-∽--------∽-★-∽------∽-★-∽--------//

        //-------∽-★-∽------∽-★-∽--------∽-★-∽SETTER∽-★-∽--------∽-★-∽------∽-★-∽--------//

        /// <summary>
        /// 设置字符串
        /// </summary>
        /// <param name="key_"></param>
        /// <param name="value_"></param>
        public void SetString(string key_, string value_)
        {
            if (value_ != null)
            {
                key_ = TransKey(key_);
                SecurePrefs.SetString(key_, value_);
            }
            else
            {
                DeleteKey(key_);
            }
        }
Example #5
0
 public void SavePlatform(string platform)
 {
     EB.Debug.Log("SavePlatform: platform = {0}", platform);
     SecurePrefs.SetString("TencentPlatform", platform);
 }