public static string SerializeDictStringInt(DictionaryOfStringAndInt dict) { IFormatter formatter = new BinaryFormatter(); MemoryStream stream = new MemoryStream(); formatter.Serialize(stream, dict); return(System.Convert.ToBase64String(stream.ToArray())); }
public static void ChangeUserProgress(string level, int stars) { DictionaryOfStringAndInt progress = GetUserProgess(); if (progress.ContainsKey(level)) { if (stars > progress[level]) { progress[level] = stars; } } UpdateUserProgress(progress); }
public static void UpdateUserProgress(DictionaryOfStringAndInt progress) { CustomPlayerPrefs.SetString("Progress", SerializeDictStringInt(progress)); CustomPlayerPrefs.Save(); }