void ReadJson() { path = Application.dataPath + "/ScoreRecords.json"; using (StreamReader r = new StreamReader(new FileStream(path, FileMode.OpenOrCreate))) { jsonstring = r.ReadLine(); if (jsonstring.Length > 0) { while (jsonstring != null) { BD_Score x = JsonUtility.FromJson <BD_Score>(jsonstring); classScore.Add(x); jsonstring = r.ReadLine(); } } } }
// Start is called before the first frame update void Start() { classScore = new List <BD_Score>(); bdScore = new BD_Score(); ReadJson(); scoreList.transform.localScale = new Vector3(0, 0, 0); inputNamePlayer.transform.localScale = new Vector3(0, 0, 0); placeholder.transform.localScale = new Vector3(0, 0, 0); textInput.transform.localScale = new Vector3(0, 0, 0); //inputNamePlayer = GameObject.FindGameObjectWithTag("inputNamePlayer"); Debug.Log("points 10 " + classScore[classScore.Count - 1].points); if (classScore.Count < 9) { Debug.Log("points 102 " + classScore[classScore.Count - 1].points); if (VictoryManager.score > classScore[classScore.Count - 1].points) { done = false; } } Debug.Log("points 104 " + classScore[classScore.Count - 1].points); if (!done) { Debug.Log("done " + done.ToString()); inputNamePlayer.transform.localScale = new Vector3(1, 1, 1); placeholder.transform.localScale = new Vector3(1, 1, 1); textInput.transform.localScale = new Vector3(1, 1, 1); inputNamePlayer.GetComponent <Animator>().SetBool("Open", true); } else { Debug.Log("lo ha cargado"); namesList(); } //scoresFile = PlayerPrefs.GetString("scores"); //Debug.Log("scoresfileinicial" + scoresFile); //bdScore = JsonUtility.FromJson<BD_Score>(scoresFile); }