Esempio n. 1
0
        /// <summary>Extract the records from DataStorage1 and Insert them to the DataStorage2.</summary>
        /// <returns>The Copied records.</returns>
        public object[] CopyDataFrom1To2()
        {
            var res = DataStorage1.ExtractRecords();

            DataStorage2.InsertRecords(res);
            return(res);
        }
    DataStorage1 Load()
    {
        //if(File.Exists(Application.persistentDataPath+"/dataStorage1.dat")){
        BinaryFormatter bf          = new BinaryFormatter();
        FileStream      file        = File.Open(Application.persistentDataPath + "/dataStorage1.dat", FileMode.Open);
        DataStorage1    dataStorage = (DataStorage1)bf.Deserialize(file);

        file.Close();
        return(dataStorage);
        //}else return new DataStorage1();
    }
Esempio n. 3
0
 void OnEnable()
 {
     //File.Delete(Application.persistentDataPath+"/dataStorage1.dat");
     liveDataStorage = Load();
     if (liveDataStorage.forceQuit)
     {
         liveDataStorage.nGamesRunned++;
     }
     enableTutorial.isOn = liveDataStorage.runTutorial;
     enableSounds.isOn   = liveDataStorage.playSounds;
     enableJoystick.isOn = liveDataStorage.controllType == ControllType.Joystick;
     highScore.text      = (liveDataStorage.highScore / 100f).ToString();
 }
 void Awake()
 {
     if (s_inst == null)
     {
         s_inst = this;
     }
     else
     {
         Destroy(s_inst);
         s_inst = this;
     }
     liveDataStorage = Load();
     SettingRightCigarette();
     AudioListener.pause = !liveDataStorage.playSounds;
 }
Esempio n. 5
0
 DataStorage1 Load()
 {
     if (File.Exists(Application.persistentDataPath + "/dataStorage1.dat"))
     {
         Debug.Log("FILE EXIST");
         BinaryFormatter bf          = new BinaryFormatter();
         FileStream      file        = File.Open(Application.persistentDataPath + "/dataStorage1.dat", FileMode.Open);
         DataStorage1    dataStorage = (DataStorage1)bf.Deserialize(file);
         if (Application.version != dataStorage.gameVersion)
         {
             dataStorage.NewGameUpdate(Application.version, csel.nClassesSkins);
         }
         file.Close();
         Debug.Log("DOBRO ODRADJENO");
         return(dataStorage);
     }
     else
     {
         Debug.Log("VRACAM OVO");
         Debug.Log(Application.version);
         return(new DataStorage1(Application.version, csel.nClassesSkins));
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Extract the records from DataStorage2 and
 /// Insert them to the DataStorage1.
 /// </summary>
 /// <returns>The Copied records.</returns>
 public object[] CopyDataFrom2To1()
 {
     object[] res = DataStorage2.ExtractRecords();
     DataStorage1.InsertRecords(res);
     return(res);
 }