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 }
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", "")); }
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); } }
//-------∽-★-∽------∽-★-∽--------∽-★-∽数据操作∽-★-∽--------∽-★-∽------∽-★-∽--------// //-------∽-★-∽------∽-★-∽--------∽-★-∽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_); } }
public void SavePlatform(string platform) { EB.Debug.Log("SavePlatform: platform = {0}", platform); SecurePrefs.SetString("TencentPlatform", platform); }