private void ReadData() { textData.Clear(); //string fileName = Application.dataPath + "/Resources/LTLocalization/localization.csv"; //FILE_PATH // string csvStr = ((TextAsset)Resources.Load(csvFilePath, typeof(TextAsset))).text; string csvStr = FileUtil.ReadStringAsset(csvFilePath); //Debug.Log(csvStr); LTCSVLoader loader = new LTCSVLoader(); // loader.ReadFile(fileName); loader.ReadMultiLine(csvStr); int languageIndex = loader.GetFirstIndexAtRow(GetLanguageAB(language), 0); if (-1 == languageIndex) { Debug.LogError("未读取到" + language + "任何数据,请检查配置表"); return; } int tempRow = loader.GetRow(); for (int i = 0; i < tempRow; ++i) { textData.Add(loader.GetValueAt(0, i), loader.GetValueAt(languageIndex, i)); } }
private void ReadData() { textData.Clear(); //string fileName = Application.dataPath + "/Resources/LTLocalization/localization.csv"; //FILE_PATH string csvStr = Encoding.UTF8.GetString(dataContent); //Debug.Log(csvStr); LTCSVLoader loader = new LTCSVLoader(); // loader.ReadFile(fileName); loader.ReadMultiLine(csvStr); int languageIndex = loader.GetFirstIndexAtRow(GetLanguageAB(language), 0); if (-1 == languageIndex) { Debug.LogError("未读取到" + language + "任何数据,请检查配置表"); return; } int tempRow = loader.GetRow(); for (int i = 0; i < tempRow; ++i) { textData.Add(loader.GetValueAt(0, i), loader.GetValueAt(languageIndex, i)); } }