static TextAsset SaveTextAsset(TextAsset textAsset, string path) { if (textAsset == null || textAsset.Equals(null)) { return(null); } File.WriteAllText(path, textAsset.text); AssetDatabase.Refresh(); return(AssetDatabase.LoadAssetAtPath <TextAsset>(path)); }
public static XmlDocument LoadXmlDocumentFromResources(string baseAssetsPath, string shortFileName) { string path = ConstructBaseAssetsPath(baseAssetsPath) + shortFileName; TextAsset xmlAsset = Resources.Load(path) as TextAsset; if (xmlAsset == null || xmlAsset.Equals(null)) { Debug.Log(string.Format("[Class = XmlDataParser, method = LoadXmlDocumentFromAssets] Couldn't load xmlAsset with asset path \'{0}\'", path)); return(null); } XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(xmlAsset.text); return(xmlDocument); }
//초기화------------------------------------------------------------------------------------------ void Start() { SC = GetComponent <SceneController>(); //대화창 PlayerPrefs.SetString("DIALOG", SC.GetActiveScene_num() + "_start"); SC.Load_Scene(14); string q_file_name = "quiz" + (SC.GetActiveScene_num() - 1) / 3; string c_file_name = "commentation" + (SC.GetActiveScene_num() - 1) / 3; //대사 파일 불러오기 TextAsset q_file = Resources.Load(LOCATION + q_file_name) as TextAsset; TextAsset c_file = Resources.Load(LOCATION + c_file_name) as TextAsset; #if DEV_TEST //파일 존재 여부 체크 if (q_file.Equals(null) || c_file.Equals(null)) { print("Error : 파일명을 다시 체크해주세요.\n 'Resource/dialog/' 경로에서 파일<" + q_file_name + ".txt>를 찾을 수 없습니다."); return; } #endif q_stringReader = new StringReader(q_file.text); c_stringReader = new StringReader(c_file.text); SetQuiz(); //정답 설정 switch (q_file_name) { case "quiz1": corrects = corrects1; break; case "quiz2": corrects = corrects2; break; case "quiz3": corrects = corrects3; break; } }