bool LoadData()
 {
     if (PuzzleDataSaveLoad.instance.Load(SavingSo, fileName) != null)
     {
         SavingSo = PuzzleDataSaveLoad.instance.Load(SavingSo, fileName);
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public bool LoadPuzzleData()
 {
     //call savepuzzmanager with the name of file and pass the so
     if (PuzzleDataSaveLoad.instance.Load(SavingSo, fileName) != null)
     {
         SavingSo = PuzzleDataSaveLoad.instance.Load(SavingSo, fileName);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 3
0
    public void Save(PuzzleSaveSO theSO, string filename)
    {
        if (!Directory.Exists(Application.persistentDataPath + "/PuzzlesData"))
        {
            Directory.CreateDirectory(Application.persistentDataPath + "/PuzzlesData");
        }
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + string.Format("/PuzzlesData/{0}", filename));
        var             json = JsonUtility.ToJson(theSO);

        bf.Serialize(file, json);
        file.Close();
    }
Esempio n. 4
0
    public PuzzleSaveSO Load(PuzzleSaveSO theSO, string filename)
    {
        Debug.Log("load");
        BinaryFormatter b = new BinaryFormatter();

        if (File.Exists(Application.persistentDataPath + string.Format("/PuzzlesData/{0}", filename)))
        {
            FileStream fileLoad = File.Open(Application.persistentDataPath + string.Format("/PuzzlesData/{0}", filename), FileMode.Open);
            JsonUtility.FromJsonOverwrite((string)b.Deserialize(fileLoad), theSO);
            fileLoad.Close();
            return(theSO);
        }

        return(null);
    }