using System.Collections; using System.Collections.Generic; using UnityEngine; public class LuaUIHelperText : MonoBehaviour { public TextAsset[] texts; Dictionary dicText = new Dictionary(); // Start is called before the first frame update void Start() { for (int i = 0; i < texts.Length; i++) { if (dicText.ContainsKey(texts[i].name)) { continue; } dicText.Add(texts[i].name, texts[i].text); } } public string[] GetText(string strKey, string s) { if (dicText.ContainsKey(strKey)) { string strTemp = dicText[strKey].Replace("\n", ""); strTemp = strTemp.Replace("\r", ""); return strTemp.Split(s); } return null; } }