private void ReadWordList(string fileName) { string[] lines = BetterStreamingAssets.ReadAllLines("/" + fileName + ".txt"); foreach (string word in lines) { wordList.Add(word); } }
// Start is called before the first frame update void Start() { BetterStreamingAssets.Initialize(); string filePath = System.IO.Path.Combine("term", "obj"); filePath = System.IO.Path.Combine(filePath, SceneManager.GetActiveScene().name + ".txt"); Debug.Log(filePath); string newText = ""; foreach (string item in BetterStreamingAssets.ReadAllLines(filePath)) { newText += item + "\n"; } text.text = newText; }
// Use this for initialization void Start() { BetterStreamingAssets.Initialize(); eventSystem = GetComponent <EventSystem>(); memoryPairing = GetComponent <MemoryPairing>(); //lastselect = new GameObject(); String filepath = "/Json/" + filename; Debug.Log("Reading cards " + filepath); var jsonText = BetterStreamingAssets.ReadAllLines(filepath); foreach (var line in jsonText) { CardPairClass cpc = JsonUtility.FromJson <CardPairClass>(line); CardClass cc1 = new CardClass(); CardClass cc2 = new CardClass(); cc1.cardText = cpc.textA; cc1.audioName = cpc.audioA; cc1.pairNumber = cpc.pairNumber; cc2.cardText = cpc.textB; cc2.audioName = cpc.audioB; cc2.pairNumber = cpc.pairNumber; cardsData.Add(cc1); cardsData.Add(cc2); } Shuffle <CardClass>(cardsData); Debug.Log("Finished loading cards."); int k = 0; for (int i = 0; i < rowCount; i++) { for (int j = 0; j < row1.Count; j++) { currRow = i; currColumn = j; try { StartCoroutine("loadAudio", cardsData[k]); } catch (Exception e) { } k++; } } }
public List <string> GetLangs() { List <string> mainLangs = new List <string>(); mainPaths.Clear(); m_allStreamingAssets = BetterStreamingAssets.GetFiles("/", "*", SearchOption.AllDirectories); foreach (string path in m_allStreamingAssets) { if (path.Contains("main")) { mainLangs.Add(BetterStreamingAssets.ReadAllLines(path)[0]); mainPaths.Add(path.Replace("main", "")); } } return(mainLangs); }
private void loadCards() { var jsonFiles = BetterStreamingAssets.GetFiles("Json").Where(x => Path.GetExtension(x) == ".json").ToList(); foreach (string level in jsonFiles) { Debug.Log("Found file"); Debug.Log("Reading " + level); var jsonText = BetterStreamingAssets.ReadAllLines(level); foreach (var line in jsonText) { CardPairClass cpc = JsonUtility.FromJson <CardPairClass>(line); cardsData.Add(cpc); } } SortCards(); Debug.Log("Finished loading cards."); }
public static void init() { if (!isInitialized) { if (!BetterStreamingAssets.FileExists(questionsPath)) { Debug.Log("Could not find questions file!"); throw new FileNotFoundException("Could not find questions file!"); } string[] questionsFile = BetterStreamingAssets.ReadAllLines(questionsPath); string[] csvQuestions = String.Join(";", questionsFile).Split('#'); List <Question> questionList = new List <Question>(); foreach (string questionString in csvQuestions) { questionList.Add(new Question(questionString)); } questionList.Shuffle(); questions = new Queue <Question>(questionList); isInitialized = true; } }
public static void Load() { BetterStreamingAssets.Initialize(); listaDados.Clear(); //path = Application.streamingAssetsPath + '/' + arquivo; var jsonText = BetterStreamingAssets.ReadAllLines(arquivo); foreach (var line in jsonText) { DadosJogo DadosJson = JsonUtility.FromJson <DadosJogo>(line); DadosJogo dados = new DadosJogo(); dados.pergunta = DadosJson.pergunta; dados.resposta = DadosJson.resposta; dados.r2 = DadosJson.r2; dados.r3 = DadosJson.r3; dados.r4 = DadosJson.r4; dados.dica = DadosJson.dica; dados.nivel = DadosJson.nivel; listaDados.Add(dados); } /*using (StreamReader sr = new StreamReader(path)) * { * while(sr.Peek() >= 0) * { * DadosJogo DadosJson = JsonUtility.FromJson<DadosJogo>(sr.ReadLine()); * DadosJogo dados = new DadosJogo(); * dados.pergunta = DadosJson.pergunta; * dados.resposta = DadosJson.resposta; * dados.r2 = DadosJson.r2; * dados.r3 = DadosJson.r3; * dados.r4 = DadosJson.r4; * dados.dica = DadosJson.dica; * dados.nivel = DadosJson.nivel; * listaDados.Add(dados); * } * }*/ }
public void LoadModel(string fileName) { string[] fileInLines = BetterStreamingAssets.ReadAllLines(fileName); int jointIndex = 0; int frameIndex = 0; foreach (string line in fileInLines) { frameIndex = 0; string[] rotations = line.Substring(1, line.Length - 3).Split(';');; // [(...);(...)] -> [(...), (...)] foreach (string rotation in rotations) { string[] values = rotation.Substring(1, rotation.Length - 2).Split(','); // (1,2,3,4) -> [1, 2, 3, 4] rotationModel[jointIndex, frameIndex] = new Quaternion(float.Parse(values[0]), float.Parse(values[1]), float.Parse(values[2]), float.Parse(values[3])); frameIndex++; } jointIndex++; } }
string[] GetUIext() { return(BetterStreamingAssets.ReadAllLines(mainPaths[selectedLang] + @"Text/UI")); }
string[] GetLevelText(string lvl) { return(BetterStreamingAssets.ReadAllLines(mainPaths[selectedLang] + @"Text/" + lvl)); }