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); } }
public override bool Save(ISerializable value) { var path = DataPathForFilename(value.GetKey()); Debug.LogFormat("<color=#4169E1>Persistor</color> - Saving data to \"{0}\"", path); try { File.WriteAllText(path, value.GetStringValue()); return(true); } catch (IOException e) { Debug.LogError(e); return(false); } }
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); } }
public override bool Save(ISerializable value) { PlayerPrefs.SetString(value.GetKey(), value.GetStringValue()); PlayerPrefs.Save(); return(true); }