Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - SamK

Pages: [1]
NGUI 3 Support / Reference Font Switching Btw Dynamic and BitMap Font
« on: January 19, 2015, 09:25:16 AM »
Im facing a problem in doing Localicazion. I have different fonts.
1) English
2) Chiense
3) etc
For the time beign they are two but can increase.
Im using English Bitmap Font for English and other languages and dynamic font for Chinese.
I want to switch between these two fonts. I have done this many times with atlas but With fonts it creating a problem.

I have tried two methods
1) Load RefFont From resources and change it
2) Place RefFont In scene Get it and do action.

Problem with 1 is All the Lables pointing to the RefFont (placed in resources folder)dont get affected. What i mean is what ever i do from code nothing happens. but when in change the font in RefFont i.e drag drop chiense or english font they change in the game.
2) Now All the lables are pointing to the refFont Placed in the scene. Reffont(Embedded) WHen i switch the font all my lables show blank.

What actually Happens is When ever i execute my following code. The Font(GameObject) type is changed from Reference to Bitmap dont know why this happens. And i couldnt find any way to change font type.
IF i manually Change the fonts type to reference (in the hiererchy while game is running) and Assign it chinese or english it works not through code.
Heres the code

  1. void SwitchFont(int lang)
  2.         {
  3.                 if(!font)
  4. //                      font = (Resources.Load("Fonts/RefFont") as GameObject).GetComponent<UIFont>();
  5.                         font = GameObject.FindGameObjectWithTag ("RefFont").GetComponent<UIFont> ();
  6.                 switch (lang)
  7.                 {
  8.                 case gLocale.LANG_ENGLISH:
  9.                         font.replacement = Resources.Load("Fonts/English Font") as UIFont;
  10.                         break;
  11.                 case gLocale.LANG_CHINESE:
  12.                         font.replacement = Resources.Load("Fonts/Chinese Font") as UIFont;
  13.                         break;
  14.                 case gLocale.LANG_FRENCH:
  15.                         break;
  16.                 }
  17.         }

Any Idea where im going wrong ? and how to tackle this problem ?

NGUI 3 Support / Noob Question Problem with anchors.
« on: June 03, 2014, 02:47:52 PM »
HI everybody,
I have this UI.
I want to make it modular. I have set the anchors to unified. and set the Aspect Ratio to free.
In UI root i have set the scaling to fixedsizeonmobile and set the manual hieght to 768 The screen which I designed the UI for and made slices . but i want i to work on multiple screens like i have a device Xperia U its res is 854 * 480. the UI is totally scattered.
The ref screens are attached.
As you can see the opponent button is out of shape. I want it to be like the first attachment all the time no matter which screen.
I have tried advanced anchoring and set the achors left right to each other still didnt worked   :(.
Any idea where im going wrong or whats the solution. would be very thankfull if you reply quickly. Need to fix this asap. I know it can be fixed im doing something wrong maybe.

BTW im using
UNity 4.3 and NGUI 3.5.7


Pages: [1]