34 lines
843 B
C#
34 lines
843 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class LuaUIHelperText : MonoBehaviour
|
|
{
|
|
public TextAsset[] texts;
|
|
|
|
Dictionary<string, string> dicText = new Dictionary<string, string>();
|
|
// 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;
|
|
}
|
|
}
|