예제 #1
0
 public void Load(Dictionary <string, int> currency)
 {
     if (currency != null)
     {
         if (File.Exists(FilePath))
         {
             using (var fileAccess = File.OpenRead(FilePath))
             {
                 converter.Deserialize(currency, fileAccess);
             }
         }
     }
 }
        public void Load(Dictionary <string, int> currency)
        {
            if (currency != null)
            {
                if (PlayerPrefs.HasKey(StorageName))
                {
                    var serializedCurrency = PlayerPrefs.GetString(StorageName);
                    if (string.IsNullOrEmpty(serializedCurrency))
                    {
                        return;
                    }

                    using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(serializedCurrency)))
                    {
                        ms.Seek(0, SeekOrigin.Begin);

                        converter.Deserialize(currency, ms);
                    }
                }
            }
        }