Author Topic: UILabel  (Read 165529 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel
« Reply #45 on: March 10, 2014, 09:34:16 PM »
There have been third-party addons that make this possible, but base NGUI doesn't support embedding alignment changes.

blitzer

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 52
    • View Profile
Re: UILabel
« Reply #46 on: March 11, 2014, 02:05:37 AM »
I see, is that type of feature something that you think could be added someday? If not, would you happen to remember any of those addons that supported it by chance?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel
« Reply #47 on: March 11, 2014, 07:53:19 PM »
Eventually I will add native support for it. But for now -- http://www.tasharen.com/forum/index.php?topic=3695.0

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: UILabel
« Reply #48 on: March 28, 2014, 06:26:20 AM »
Intentional. Widget's color tint affects everything. Do something like this instead now:
  1. label.text = "[000000]Black [ff0000]Red";

Has this changed recently? I've used it quite a bit in 2.7 (etc), but can't get it to work in the latest version. The tag just gets ignored and the text remains white.

rtargosz

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: UILabel
« Reply #49 on: March 29, 2014, 09:26:38 AM »
Has this changed recently? I've used it quite a bit in 2.7 (etc), but can't get it to work in the latest version. The tag just gets ignored and the text remains white.

I think you need the termination sequence [-] like this:
[0000ff]Blue![-][00ff00]Green![-]

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel
« Reply #50 on: March 30, 2014, 07:56:14 AM »
This hasn't changed since early 3.0.X. Tint color is multiplied with the embedded color, but if the tint color is white like you mentioned, then tags should work as expected with or without the terminator ([-]).

Assuming the label has "BBCode" enabled.

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: UILabel
« Reply #51 on: April 01, 2014, 01:16:59 AM »
This hasn't changed since early 3.0.X. Tint color is multiplied with the embedded color, but if the tint color is white like you mentioned, then tags should work as expected with or without the terminator ([-]).

Assuming the label has "BBCode" enabled.

Hmm... yeah it's odd. I definitely have BBCode enabled on the label. It's part of a TextList - does that matter?

For example, I'm doing this in code:

  1. Feedback = GameObject.Find("Feedback").GetComponent<UITextList>();
  2. Feedback.Clear();
  3. Feedback.Add(string.Format("Welcome to location [77FF00]{0}[-].", Caption));
  4.  

And I see "Welcome to location Sandbox." on screen, but it's all white.

Sorry to keep referring to 2.7, but that's the version I've come from and the above type of code worked back then. Just trying to figure out what's changed so I can adapt :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel
« Reply #52 on: April 01, 2014, 10:55:06 AM »
Chat input script purposely strips the color tags. Line 44 of ChatInput.cs.

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: UILabel
« Reply #53 on: April 01, 2014, 07:16:50 PM »
Chat input script purposely strips the color tags. Line 44 of ChatInput.cs.

ChatInput.cs ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel
« Reply #54 on: April 03, 2014, 09:57:05 PM »
Yes, ChatInput: http://www.tasharen.com/ngui/docs/class_chat_input.html

That's what the chat window uses to submit text.

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: UILabel
« Reply #55 on: April 03, 2014, 09:58:32 PM »
Yes, ChatInput: http://www.tasharen.com/ngui/docs/class_chat_input.html

That's what the chat window uses to submit text.

Yeah, I tried to find that file in my Project but it doesn't exist. Is it maybe in the Example folders? I don't import those.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel
« Reply #56 on: April 03, 2014, 10:04:26 PM »
Yep, it's a part of the Examples folder.

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: UILabel
« Reply #57 on: April 06, 2014, 02:13:01 AM »
Okay - just going back to a simple example. I've created a UILabel. Using a bitmap font. Color tint is the default white. BBCode is enabled.

If I set the "Text" property on it to anything which includes tags - e.g. "[444444]Test", or "[444444]Test[FFFFFF]", etc - then it stays all white - i.e. the tags are ignored. If I try something like "Test" then it works.

Just can't get color tags to work like I used to.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel
« Reply #58 on: April 06, 2014, 03:05:07 AM »
Steps to repro?

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: UILabel
« Reply #59 on: April 06, 2014, 07:33:32 AM »
Steps to repro?

As I said - using a bitmap font, create a UILabel, BBCode is on by default, white tint is set by default, assign some text to the label that include a color tag and the color part gets ignored. The text is all white on the label.

If you switch off the BBCode checkbox, you can see the tag on the label - e.g. "[444444]Test" - and if you switch on the BBCode checkbox you just see the expected "Test", but all white.

Did this throughout 2.x NGUI, so definitely something different, just not sure if it's me or NGUI that's the problem.