Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Joe @ ByDesign Games on May 09, 2012, 07:36:10 PM
-
UI dev here noticed UILabel goes blank whenever "[ Body ]" is used for .text, yet we've legitimate need to display such string.
Is there a way to display such string without UILabel going blank?
Also, is the list of restricted strings documented somewhere? Took 30min to track this down, ugh.
-
Turn off encoding on the label. 6 characters encased within square brackets is a special symbol.
-
Btw, if you're not using symbols (color encoding essentially), turn off encoding on those labels. Turning off that, and multi-line, will actually make your labels faster.
-
6 characters eh? Ahh that explains why [Body] works, but [ Body ] does not.
Turns out we don't need encoding for this UILabel, so the fix is in; though seems sort of an arbitrary restriction...
just saying! :)
-
It's just how you encode colors.
[RrGgBb]
-
hmm any reason # isn't used? as in [#RrGgBb]
-
Less characters. :P
-
:P
-
My thinking is:
"forcing users to never have 6 characters within brackets"
is more annoying / unnatural / bizarre than:
"forcing use of commonly accepted # character to specify colors within brackets"
Adding, the longer removing the 6 char limit and instead requiring # for color is put off, the harder it will be to fix later.
-
Or if nothing else, provide some way to encode a left square bracket and a function to do just that on a given string. I've had one or two cases where I wanted to embed some colors in a label, but also include text input by a user without allowing that portion of the text to change colors. I put off actually dealing with it, but it would be convenient if NGUI supported that.
-
Simple enough to do. Strip the symbols from the user-input text before merging it with your own symbol-supporting text.
NGUITools.StripSymbols
-
I noticed StripSymbols, but then I'm not displaying the text entered by the user, am I. :P I would want to preserve the brackets and any other random junk entered by the user.
-
Then you don't allow encoding there. :D