Esempio n. 1
0
    public static void SaveDataStorage()
    {
        DataStorageSer  data       = new DataStorageSer();
        BinaryFormatter formatter  = new BinaryFormatter();
        string          path       = Application.persistentDataPath + "/dscbc.bin";
        FileStream      fileStream = new FileStream(path, FileMode.Create);

        formatter.Serialize(fileStream, data);
        fileStream.Close();
    }
Esempio n. 2
0
    public static void LoadDataStorage()
    {
        string path = Application.persistentDataPath + "/dscbc.bin";

        if (File.Exists(path))
        {
            BinaryFormatter formatter  = new BinaryFormatter();
            FileStream      fileStream = new FileStream(path, FileMode.Open);
            DataStorageSer  data       = formatter.Deserialize(fileStream) as DataStorageSer;
            fileStream.Close();
            IsTutorialCompleted = data.IsTutorialCompletedSer;
            CurrentLevel        = data.CurrentLevelSer;
            IsSoundOn           = data.IsSoundOnSer;
            HintsCount          = data.HintsCountSer;
        }
    }