/// <summary> /// Lee las preguntas de un txt y las guarda en la memoria /// </summary> private void InitQuestion() { QuizSistem temp; TextAsset txt = new TextAsset(); string[] preguntasFase = new string[] { "Preguntas1", "PreguntasFase2", "PreguntasFase3" }; for (int k = 0; k < preguntasA.GetLength(0); k++) { txt = Resources.Load(preguntasFase[k]) as TextAsset; string[] str = txt.text.Split('\n'); for (int i = 0, j = 0; j < preguntasA.GetLength(1); i += 6, j++) { Debug.Log("str[" + i + "]= " + str[i]); temp = new QuizSistem(); temp.pregunta = str[i]; //Debug.Log(str[i + 1] + ":" + j); temp.rCorrecto = int.Parse(str[i + 1]); temp.r1 = str[i + 2]; temp.r2 = str[i + 3]; temp.r3 = str[i + 4]; temp.r4 = str[i + 5]; temp.ID = 0; // FALTA DEDUCIR LA K!!!!! preguntasA[k, j] = temp; } } }
private void InitQuestion() { TextAsset txt = Resources.Load("PreguntasFase1") as TextAsset; Debug.Log(txt); string[] str = txt.text.Split('\n'); // QuizSistem temp = new QuizSistem(); for (int k = 0; k < preguntasA.GetLength(0); k++) { for (int i = 0, j = 0; i < str.Length - 1; i += 6, j++) { //Debug.Log("str[" + i + "]= " + str[i]); QuizSistem temp = new QuizSistem(); temp.pregunta = str[i]; temp.rCorrecto = int.Parse(str[i + 1]); temp.r1 = str[i + 2]; temp.r2 = str[i + 3]; temp.r3 = str[i + 4]; temp.r4 = str[i + 5]; temp.ID = 0; // FALTA DEDUCIR LA K!!!!! preguntasA[k, j] = temp; } } }