Beispiel #1
0
        public static string SerializeDictStringInt(DictionaryOfStringAndInt dict)
        {
            IFormatter   formatter = new BinaryFormatter();
            MemoryStream stream    = new MemoryStream();

            formatter.Serialize(stream, dict);
            return(System.Convert.ToBase64String(stream.ToArray()));
        }
Beispiel #2
0
        public static void ChangeUserProgress(string level, int stars)
        {
            DictionaryOfStringAndInt progress = GetUserProgess();

            if (progress.ContainsKey(level))
            {
                if (stars > progress[level])
                {
                    progress[level] = stars;
                }
            }
            UpdateUserProgress(progress);
        }
Beispiel #3
0
 public static void UpdateUserProgress(DictionaryOfStringAndInt progress)
 {
     CustomPlayerPrefs.SetString("Progress", SerializeDictStringInt(progress));
     CustomPlayerPrefs.Save();
 }