示例#1
0
 public void LoadEnigmaDatas()
 {
     if (File.Exists(Application.persistentDataPath + "/enigmaData.dat"))
     {
         //get content of json string
         StreamReader file = new StreamReader(Application.persistentDataPath + "/enigmaData.dat");
         string       json = file.ReadToEnd();
         //deserialize json string and put its content in List of Enigme_Data
         List <Enigme_Data> loadedDatas = new List <Enigme_Data>();
         loadedDatas = JsonHelperList.FromJson <Enigme_Data>(json);
         file.Close();
         //save the loaded data in the DataControl
         enigmaDatas = loadedDatas;
     }
 }
示例#2
0
 public void Load()
 {
     if (File.Exists(Application.persistentDataPath + "/playerInfo.dat"))
     {
         //get content of json string
         StreamReader file = new StreamReader(Application.persistentDataPath + "/playerInfo.dat");
         string       json = file.ReadToEnd();
         //JsonUtility.FromJsonOverwrite(json, data);
         //deserialize json string and put its content in List of ScoreEnigme
         List <ScoreEnigme> loadedScores = new List <ScoreEnigme>();
         loadedScores = JsonHelperList.FromJson <ScoreEnigme>(json);
         file.Close();
         //save the loaded data in the DataControl
         save.scores = loadedScores;
     }
 }