Author Topic: Embed UISprite into UILabel as bbcode  (Read 2811 times)

Biggix

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 33
    • View Profile
Embed UISprite into UILabel as bbcode
« on: August 07, 2016, 12:57:58 PM »
Hi,

I need to embed a sprite from an existing atlas, into an UILabel string of characters (using atlased fonts), basically replacing one of the letters with a scaled sprite from other atlas (not the text one). These are not emoticons but in-game item images.

How could this be done?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Embed UISprite into UILabel as bbcode
« Reply #1 on: August 08, 2016, 05:52:24 PM »
Select the font and add the sprite as a symbol. This only works if the sprite is in the same atlas as the font.

There is no way to reference sprites or images that are not in the same atlas.

Biggix

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 33
    • View Profile
Re: Embed UISprite into UILabel as bbcode
« Reply #2 on: August 09, 2016, 03:53:50 AM »
Well thank you so much for another "blabla" reply. My question was exactly HOW TO ADD THE SPRITE FROM ANOTHER ATLAS. For gods sake I understand that there is no way to do it as of now. The question was, how to implement this.

In fact I just posted here to see how you are going to avoid the question again. The support for your product is non-existent. NGUI is not developing. No features are added despite hundreds of users requests. You do not seem to be a nice person at all. I never received a helpful reply on ANY question that I had.


« Last Edit: August 09, 2016, 03:59:53 AM by Biggix »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Embed UISprite into UILabel as bbcode
« Reply #3 on: August 09, 2016, 06:19:29 AM »
NGUI was written so that you can have only one material per widget due to each widget having only one OnFill function. What you are trying to do requires two materials per widget -- one to draw the text, and another to draw the sprite. This is why it's not something I can advise you on. You need two distinct widgets for that and there is no simple way of getting it to work short of redesigning NGUI's core functionality or some ugly hacks. The latter approach involves creating a custom widget that would print out the string like a label would, figure out the positions of all the glyphs -- then would fill the draw buffer replacing the glyphs with sprites.

Now as for your reply... If I'm not helping, I can just stop trying to answer your questions.