// Use this for initialization private void Start() { LLD = new LoadLvlData(); lvlCollection = LLD.getLoad(); Convert(); Debug.Log("Progress Save Started."); }
private void SaveLvl(LvlCollection lCol) { using (StreamWriter stream = new StreamWriter(lvlPath)) // Считывает весь JSON в строку { string json = JsonUtility.ToJson(lCol); stream.Write(json); } Debug.Log("Levels saved: " + lCol.lvls.Length); }
private void LoadLvls() { using (StreamReader stream = new StreamReader(lvlPath)) // Считывает весь JSON в строку { string json = stream.ReadToEnd(); lvlCollection = JsonUtility.FromJson <LvlCollection>(json); } Debug.Log("Levels loaded: " + lvlCollection.lvls.Length); }
// Use this for initialization private void Start() { LLD = new LoadLvlData(); lvlCollection = LLD.getLoad(); //Получаем данные об уровнях for (int i = 1; i <= lvlCollection.lvls.Length - 1; i++) { // Проверяем, какие уровни пройдены, включаем нужные кнопки загрузки уровней if (lvlCollection.lvls[i].progress) { BLoadLvl[i].SetActive(true); } } }
public void Save(LvlCollection lCol) { SaveLvl(lCol); }