// Functions //---------------------------------------------------------------------------- private void Load() { _textSets.Clear(); TextAsset textAsset = AssetDatabase.LoadAssetAtPath <TextAsset>("Assets/Editor/AnyPortraitTool/Util/apLangPack.txt"); string[] strParseLines = textAsset.text.Split(new string[] { "\n" }, StringSplitOptions.None); string strCurParseLine = null; for (int i = 1; i < strParseLines.Length; i++) { //첫줄(index 0)은 빼고 읽는다. strCurParseLine = strParseLines[i].Replace("\r", ""); string[] strSubParseLine = strCurParseLine.Split(new string[] { "," }, StringSplitOptions.None); //Parse 순서 //0 : TEXT 타입 (string) - 파싱 안한다. //1 : TEXT 타입 (int) //2 : English (영어) //3 : Korean (한국어) //4 : French (프랑스어) //5 : German (독일어) //6 : Spanish (스페인어) //7 : Italian (이탈리아어) //8 : Danish (덴마크어) //9 : Japanese (일본어) //10 : Chinese_Traditional (중국어-번체) //11 : Chinese_Simplified (중국어-간체) if (strSubParseLine.Length < 12) { //Debug.LogError("인식할 수 없는 Text (" + i + " : " + strCurParseLine + ")"); continue; } try { string strTextType = strSubParseLine[0]; int index = (int.Parse(strSubParseLine[1])); TextSet newTextSet = new TextSet(index, strTextType); newTextSet.SetText(apEditor.LANGUAGE.English, strSubParseLine[2]); newTextSet.SetText(apEditor.LANGUAGE.Korean, strSubParseLine[3]); newTextSet.SetText(apEditor.LANGUAGE.French, strSubParseLine[4]); newTextSet.SetText(apEditor.LANGUAGE.German, strSubParseLine[5]); newTextSet.SetText(apEditor.LANGUAGE.Spanish, strSubParseLine[6]); newTextSet.SetText(apEditor.LANGUAGE.Italian, strSubParseLine[7]); newTextSet.SetText(apEditor.LANGUAGE.Danish, strSubParseLine[8]); newTextSet.SetText(apEditor.LANGUAGE.Japanese, strSubParseLine[9]); newTextSet.SetText(apEditor.LANGUAGE.Chinese_Traditional, strSubParseLine[10]); newTextSet.SetText(apEditor.LANGUAGE.Chinese_Simplified, strSubParseLine[11]); _textSets.Add(newTextSet); } catch (Exception ex) { Debug.LogError("Parsing 실패 (" + i + " : " + strCurParseLine + ")"); } } }
public void SetTextAsset(TextAsset textAsset) { if (_isLoaded) { return; } _textSets.Clear(); string[] strParseLines = textAsset.text.Split(new string[] { "\n" }, StringSplitOptions.None); string strCurParseLine = null; for (int i = 1; i < strParseLines.Length; i++) { //첫줄(index 0)은 빼고 읽는다. strCurParseLine = strParseLines[i].Replace("\r", ""); string[] strSubParseLine = strCurParseLine.Split(new string[] { "," }, StringSplitOptions.None); //Parse 순서 //0 : TEXT 타입 (string) - 파싱 안한다. //1 : TEXT 타입 (int) //2 : English (영어) //3 : Korean (한국어) //4 : French (프랑스어) //5 : German (독일어) //6 : Spanish (스페인어) //7 : Italian (이탈리아어) //8 : Danish (덴마크어) //9 : Japanese (일본어) //10 : Chinese_Traditional (중국어-번체) //11 : Chinese_Simplified (중국어-간체) if (strSubParseLine.Length < 12) { //Debug.LogError("인식할 수 없는 Text (" + i + " : " + strCurParseLine + ")"); continue; } try { TEXT textType = (TEXT)(int.Parse(strSubParseLine[1])); TextSet newTextSet = new TextSet(textType); newTextSet.SetText(apEditor.LANGUAGE.English, strSubParseLine[2]); newTextSet.SetText(apEditor.LANGUAGE.Korean, strSubParseLine[3]); newTextSet.SetText(apEditor.LANGUAGE.French, strSubParseLine[4]); newTextSet.SetText(apEditor.LANGUAGE.German, strSubParseLine[5]); newTextSet.SetText(apEditor.LANGUAGE.Spanish, strSubParseLine[6]); newTextSet.SetText(apEditor.LANGUAGE.Italian, strSubParseLine[7]); newTextSet.SetText(apEditor.LANGUAGE.Danish, strSubParseLine[8]); newTextSet.SetText(apEditor.LANGUAGE.Japanese, strSubParseLine[9]); newTextSet.SetText(apEditor.LANGUAGE.Chinese_Traditional, strSubParseLine[10]); newTextSet.SetText(apEditor.LANGUAGE.Chinese_Simplified, strSubParseLine[11]); _textSets.Add(textType, newTextSet); } catch (Exception ex) { Debug.LogError("Parsing 실패 (" + i + " : " + strCurParseLine + ")"); } } _isLoaded = true; }
void Awake() { ts.SetText(pc.GetPlayerLives()); }