public static void SaveStrings() { if (setting.disablePlayerPrefs) { SetStrings.Clear(); return; } StringBuilder lg = new StringBuilder(); lg.AppendLine("saved keys" + playerPrefKeys.Count); foreach (var a in SetStrings) { PlayerPrefs.SetString(a.Key.ToLower(), a.Value); lg.AppendLine(a.Key + "\t\t\t" + a.Value); } print("Save strings " + SetStrings.Count + "\n" + (Debug.isDebugBuild ? lg.ToString() : lg.Length.ToString())); SetStrings.Clear(); StringBuilder sb = new StringBuilder(); foreach (var a in playerPrefKeys) { sb.Append(a).Append(","); } var s = Convert.ToBase64String(GZipStream.CompressString(sb.ToString())); print(sb.Length + " vs " + s.Length); PlayerPrefs.SetString2(keysNew3, s); PlayerPrefs.Save(); }
//private static string url; private static IEnumerator DownloadCor(Action <string, bool> a, WWW w, string url) { //if (debugThis) //print("URL "+url); //if (PlayerPrefs.HasKey(url) && isDebug) //{ // if(debugThis) // print("Read Cache " + url + "\n" + PlayerPrefs.GetString(url)); // if (a != null) // a(PlayerPrefs.GetString(url), true); // yield break; //} bool hasCache = UnityEngine.PlayerPrefs.HasKey(url) && setting.wwwCache; //print(url+ " hasCache:" + hasCache); if (!hasCache) { yield return(w); } if (setting.delayLoading) { yield return(new WaitForSeconds(1)); } string trim; //if (debugThis) //print("Preparing Cache "+url); if (!hasCache && String.IsNullOrEmpty(w.error) && !((trim = w.text.Trim()).StartsWith("<") && trim.EndsWith(">")) && !setting.offline) { if (a != null) { //print("Write Cache " + url + " " + w.text); if (!Application.isWebPlayer) { PlayerPrefs.SetString2(url, w.text); } a(w.text, true); } } else { if (a != null) { print("Read Cache " + url + "\n" + UnityEngine.PlayerPrefs.GetString(url)); if (UnityEngine.PlayerPrefs.HasKey(url) && (android || setting.wwwCache)) { a(UnityEngine.PlayerPrefs.GetString(url), true); } else { a(w.error == null ? "Failed to Parse" + w.text : w.error, false); } } if (!hasCache) { Debug.LogWarning(w.error + w.url); } } }