コード例 #1
0
 public void loadMoarData()
 {
     if (File.Exists(Application.persistentDataPath + "/save001.dat"))
     {
         BinaryFormatter formatter = new BinaryFormatter();
         FileStream      file      = File.Open(Application.persistentDataPath + "/save001.dat", FileMode.Open);
         MoarSaveData    data      = (MoarSaveData)formatter.Deserialize(file);
         obtainedGifts = data.obtainedGifts;
         file.Close();
     }
 }
コード例 #2
0
    public void saveMoarData()
    {
        BinaryFormatter formatter = new BinaryFormatter();
        FileStream      file      = File.Open(Application.persistentDataPath + "/save001.dat", FileMode.Create);

        MoarSaveData data = new MoarSaveData();

        data.obtainedGifts = obtainedGifts;

        formatter.Serialize(file, data);
        file.Close();
    }