Author Topic: Feature Request: Color on UIFont script (in addition to UI Label)  (Read 2568 times)

bretfort

  • Guest
Hi Aren,

I am working on a game where I need to use a number of fonts, some of the fonts are similar only the color of the text is different. Currently we're doing it by applying tint on a label. But for that we have to iterate through every label and change color incase the UI design changes.

It'll be great a great add on if we get Color tint on UIFont script level, i.e. override the color on the label, and use prefab color instead. This way not only we can define a color in one place, but also it is possible to change the font/reference any time without worrying about how a certain label will look like with new font and the applied tint.

I have changed files with me, I tried using polymorphism but it is becoming difficult as I have to duplicate Editor script, then I had to duplicate NGUI editor tools script in the new folder as well. Moreover I had to explicitly cast UIFont to GAUIFont in many places (GA==myFile).

The change is small, I really do not want to put the change in NGUI class so that in future if somebody upgrades it with newer version, he'll lose my changes. Do you want me to send you code snippets, or changed files for review?

Regards,

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Feature Request: Color on UIFont script (in addition to UI Label)
« Reply #1 on: November 12, 2012, 10:35:07 AM »
Defining color on a data class like UIFont is a really bad design idea. It simply doesn't make sense to me.

This will all be possible with nested prefabs when the feature gets polished out -- you can have a prefab for your label with the color that you want, and simply reuse it in your UI. You will then be able to change the color on this prefab, affecting a large number of labels at once.

bretfort

  • Guest
Re: Feature Request: Color on UIFont script (in addition to UI Label)
« Reply #2 on: November 12, 2012, 10:40:41 AM »
Ha, why i didn't think of that :( i suppose too much at hand has affected my thinking process.


Thanks for the tip :)