- 277 名前:名前は開発中のものです。 mailto:sage [2017/06/12(月) 13:06:26.65 ID: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); } }
|

|