Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: leegod on August 13, 2014, 12:48:04 AM

Title: How to pass string with color to UIText List?
Post by: leegod on August 13, 2014, 12:48:04 AM
So I want to make message windows.

Messages will have various color as its sort (battle message, event message, etc), so I want to pass string with color info to UITextList

but UITextList seems only give .Add(str) function. So color should be "[FF0000]msg" like this.

Isn't there another way to pass color info? like, textlist.Add(str, colorpicker);

Title: Re: How to pass string with color to UIText List?
Post by: ArenMook on August 13, 2014, 07:58:12 AM
Add("[ff0000]" + yourtext)? :P

Also note NGUIText.EncodeColor.

Add("[" + NGUIText.EncodeColor(Color.red) + "]" + yourText);
Title: Re: How to pass string with color to UIText List?
Post by: leegod on August 13, 2014, 09:24:06 PM
Also note NGUIText.EncodeColor.

Add("[" + NGUIText.EncodeColor(Color.red) + "]" + yourText);

oh Good solution! Thank!