Ejemplo n.º 1
0
 //Load song fro, file
 public void loadSong(string name)
 {
     if (File.Exists(Application.persistentDataPath + "/" + name))
     {
         BinaryFormatter bf   = new BinaryFormatter();
         FileStream      file = File.Open(Application.persistentDataPath + "/" + name, FileMode.Open);
         allTheData      data = (allTheData)bf.Deserialize(file);
         file.Close();
         for (int i = 0; i < 150; i++)
         {
             dragSlots[i] = data.dragSlots[i];
             dropSlots[i] = data.dropSlots[i];
         }
     }
 }
Ejemplo n.º 2
0
    //Save song to file
    public void saveSong(string name)
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Open(Application.persistentDataPath + "/" + name, FileMode.Create);

        allTheData data = new allTheData();

        for (int i = 0; i < 150; i++)
        {
            data.dragSlots[i] = dragSlots[i];
            data.dropSlots[i] = dropSlots[i];
        }
        bf.Serialize(file, data);
        file.Close();
    }