public override bool Load(ISerializable target)
 {
     if (PlayerPrefs.HasKey(target.GetKey()))
     {
         var value = PlayerPrefs.GetString(target.GetKey());
         target.SetStringValue(value);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 2
0
        public override bool Load(ISerializable target)
        {
            var path = DataPathForFilename(target.GetKey());

            Debug.LogFormat("<color=#4169E1>Persistor</color> - Loading data from \"{0}\"", path);
            if (File.Exists(path))
            {
                try
                {
                    var textValue = File.ReadAllText(path);
                    target.SetStringValue(textValue);
                    return(true);
                }
                catch (IOException e)
                {
                    Debug.LogError(e);
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }