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.


Messages - xushunwang

Pages: [1]
1
Hey,I'm a Chinese developer.So in my game I must use Chinese font.
I type  some words in the label like "远程武器攻击力+{0} : 命中率+{1:0.##%} : 闪避率+{2:0.##%}",and use dynamic font called "simsun".
I set the font size to 12 ,no  gradient and effect.

And in the NGUIText.cs / Update method,I add the code
  1. dynamicFont.material.mainTexture.wrapMode = TextureWrapMode.Clamp;
  2. dynamicFont.material.mainTexture.filterMode = FilterMode.Point;
  3.  

because I can't change the filterMode in the inspector.

It will display like this :


The Chinese are very clear but the English are blurry.I don't know why it happened like this.
When I install the font and use it in the photoshop,the words are all clear in that size.

You can download the font file here:http://www.fontpalace.com/font-download/SimSun/

2
NGUI 3 Support / Does ngui support muti-language ui ?
« on: June 16, 2014, 09:57:13 PM »
My game now support two language .

The UILabel in the ui must use different font.And their's fontsize,alignment,position effect are also different.

How can I do to make me easier to adjust different ui usingdifferent language.

3
NGUI 3 Support / How to keep aspect ratio when change to fullscreen
« on: June 09, 2014, 03:28:05 AM »
I create a new scene and click NGUI->Create->UITexture to add a texture.
Change UIRoot's scaling style to FixedSize and Manual Height to 384
The texture is 512*384 , the ratio is 4:3.


When i build and run it in window mode , it looks well.
But if I run it in fullscreen , I find the texture is stretch to fill the screen . the aspect ratio is not 4:3 any more, it change to 16:9!

I want it stretch based on height and keep aspect ratio like this picture :


4
NGUI 3 Support / Re: Three strange problems in pixel
« on: May 30, 2014, 02:38:31 AM »
Hey,I find a lot and finally find how to solve it.

It seems the "half pixel offset dx9" problem you said in the question:http://www.tasharen.com/forum/index.php?topic=8219.msg38954#msg38954

So I  check the optional "Use direct3d 11" on.Now they are all right!

But I don't want to use dx11 in my game because it may be bad for my performance.

Do you have any other ideas ?

5
NGUI 3 Support / Re: Three strange problems in pixel
« on: May 22, 2014, 09:05:56 PM »
No, I use Windows. What dimensions do you see in the "Stats" window?

It's 1024 * 768.
The background sprite is a sliced sprite.
The font is NGUI bitmap font.
My screen resolution is 1920 * 1080

6
NGUI 3 Support / Re: Three strange problems in pixel
« on: May 22, 2014, 02:21:22 AM »
No visible gaps on my end, but my console log is full of errors because you put UISprites and UITextures on the same object.

Make sure your game window's dimensions are dividable by two. Generally when you use Maximize on Play, they often aren't. Although if you forced it to 1024x768 they should be.

In any case, if you want to eliminate such issues when zooming in / out (non-pixel perfect sprites), then you should give your sprite a border by editing the sprite within the atlas and clicking the "Add a Clamped Border" button. Just keep in mind that this adds +2 to your sprite's dimensions, so your 40x40 sprites will now be 42x42. You should then use Advanced type rather than Simple (chosen on UISprite), with left, right, top and bottom set to Invisible.

It works! I can not see the gap any more .

But how to solve other two problems ? You can find them in fontPanel.

All the problems only appear in windows , are you using mac ?

7
NGUI 3 Support / Re: Three strange problems in pixel
« on: May 20, 2014, 09:51:20 PM »
I tried this but it's the same.I set all my texture type "GUI" and filter Mode Point and the grid sprite is 40*40 .

I suspect if it due to the atlas.If I use UITexture , they are fine, but if I use UISprite and get texture from the atlas , the problem happened.

Here is my test scene . You can see the gap problem inthe gridPanel and other two problems in fontPanel.

 

Please turn on the "Maximize on Play" in Game window and set the Resolution to Standalone(1024*768).And it seems only happened in windows:-[
In Mac OS or IOS it displayed well.

8
NGUI 3 Support / Re: Three strange problems in pixel
« on: May 20, 2014, 09:45:48 PM »
Such gap can be caused by either texture filtering or by using a sprite that has dimensions that are not dividable by 2.

The fix for the former is to add a border to your sprite by editing the sprite (click the Edit button). After giving it a border you can also use Advanced sprite drawing option and turning off everything except center.

I tried this but it's the same.I set all my texture type "GUI" and filter Mode Point and the grid sprite is 40*40 .

I suspect if it due to the atlas.If I use UITexture , they are fine, but if I use UISprite and get texture from the atlas , the problem happened.

Here is my test scene . You can see the gap problem inthe gridPanel and other two problems in fontPanel.

 
 

9
NGUI 3 Support / Re: Three strange problems in pixel
« on: May 19, 2014, 10:39:40 PM »
Hey , I upgrade my ngui to version 3.5.9 and I find it's the same !

I set UIRoot scalingStyle to fixedSize and manual Height 384.

It will happen  when I scale the game view to 1024*768.

one pixel gap in my map,see:gap_1.jpg

and I replace the grid sprite using another one in the same atlas,see:gap_2.jpg
there is no gap

10
NGUI 3 Support / Three strange problems in pixel
« on: May 07, 2014, 10:28:53 PM »
I'm using ngui 3.0.8 f1.
Sorry for that I don't know how to insert pictures in my text using my attachments

1、
I used a bitmap font in some labels but i find it have something wrong.

see:bitmap_font_1.jpg
see:bitmap_font_2.jpg

Words are not positioned the same in y axis in my pc.

But I found they are positioned right in mac .

see:bitmap_font_right.png

2、
My map are makd up of 5 * 8 grids.Every grid is 40 * 40 size.
I position them like this:

  1.  for (int row = 0; row < 5; row++)
  2.   {
  3.             for (int col = 0; col < 8; col++)
  4.             {
  5.  
  6.                 //generate grids
  7.  
  8.                 grid.transform.localPosition = new Vector3(startX + 40 * row , startY  + 40 * col , 0);
  9.             }
  10. }
  11.  
  12.  

In some resolution or pc(I'm not sure which affects) , It displayed well.

see:no_gap.jpg

But sometimes it displayed with gaps:

see:gap.jpg
3、
I used a sliced sprite in my game

see:sliced.jpg

But sometimes it displayed with some distortions at the edge of the sprite

see:distorted.jpg

sometimes it displayed well

see:no_distorted.jpg


 

11
I used this code , but it seems not work well.
I add this script and DragablePanel and clip in the same gameobject , am I right ? Or how to use it?

Pages: [1]