17/06/12 13:06:26.65 BIdO4+Rx.net
uguiで一文字づつ表示するのにsubstringを使って表示させ、
個別に色文字を使うのに文字に含まれるHTMLを文字として表示しないように、
一文字づつ判定させて飛ばしてるんですがなにか効率のいい方法ないでしょうか
すごく汚いコードでお恥ずかしいんですが、アドバイスいただけたら嬉しいです。
public Text Comment; //UIに表示する文字
IEnumerator UpdateTextCoroutine(string text)
{
int counter = 0;
string tag = "";
while (counter <= text.Length)
{
if (text.Substring(0,counter).EndsWith("<"))
{
while (!text.Substring(0, counter).EndsWith(">"))
{
counter++;
}
tag = "</color>";
}
else
{
if (text.Substring(0, counter).Contains(tag)) tag = "";
Comment.text = text.Substring(0, counter)+ tag;
counter++;
}
yield return new WaitForSeconds(Interval);
}
}