Ejemplo n.º 1
0
    public void SaveSolvedLevels(int[] levels, int[,] moves)
    {
        BinaryFormatter binaryFormatter = new BinaryFormatter();
        FileStream      file            = File.Create(Application.persistentDataPath + "/solvedLevelSettings.dat");
        SolvedLevels    data            = new SolvedLevels();

        data.solvedLevels  = levels;
        data.numberOfMoves = moves;

        binaryFormatter.Serialize(file, data);
        file.Close();
    }
Ejemplo n.º 2
0
    public int[] LoadSolvedLevels()
    {
        if (File.Exists(Application.persistentDataPath + "/solvedLevelSettings.dat"))
        {
            BinaryFormatter binaryFormatter = new BinaryFormatter();
            FileStream      file            = File.Open(Application.persistentDataPath + "/solvedLevelSettings.dat", FileMode.Open);
            SolvedLevels    data            = (SolvedLevels)binaryFormatter.Deserialize(file);
            file.Close();

            return(data.solvedLevels);
        }
        else
        {
            return(new int[4] {
                0, 0, 0, 0
            });
        }
    }