コード例 #1
0
    // Update is called once per frame
    public void Save()
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Open(Application.persistentDataPath + "/adaptiveInfo" + userName + ".dat", FileMode.Open);
        AdaptiveData    ad   = new AdaptiveData();

        ad.currLevel    = currLevel;
        ad.currSpeed    = currSpeed;
        ad.isStrictMode = isStrictMode;
        ad.noOfRestarts = noOfRestarts;
        ad.rateOfSpawn  = rateOfSpawn;
        ad.sideForce    = sideForce;
        ad.userName     = userName;
        bf.Serialize(file, ad);
        file.Close();
    }
コード例 #2
0
 public void Load()
 {
     if (File.Exists(Application.persistentDataPath + "/adaptiveInfo" + userName + ".dat"))
     {
         BinaryFormatter bf   = new BinaryFormatter();
         FileStream      file = File.Open(Application.persistentDataPath + "/adaptiveInfo" + userName + ".dat", FileMode.Open);
         AdaptiveData    ad   = (AdaptiveData)bf.Deserialize(file);
         file.Close();
         currLevel    = ad.currLevel;
         currSpeed    = ad.currSpeed;
         isStrictMode = ad.isStrictMode;
         noOfRestarts = ad.noOfRestarts;
         rateOfSpawn  = ad.rateOfSpawn;
         sideForce    = ad.sideForce;
         userName     = ad.userName;
     }
 }