【3Dゲームエンジン】Unity質問スレッド29at GAMEDEV
【3Dゲームエンジン】Unity質問スレッド29 - 暇つぶし2ch277:名前は開発中のものです。
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);
}
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch