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 - galuodo

Pages: [1] 2
1
NGUI 3 Support / Why positions seems so funny when used UIAnchor
« on: September 06, 2013, 05:16:36 AM »
When I set the position of a game object, it works well at first. However after I used UIAnchor so that the game can be fit other resolution, the positions have a large deviation after the resolution changed.
  1.         void Update () {
  2.                 ul.transform.position = sp.transform.position+ new Vector3(5,5,0);
  3.         }
  4.  

2
NGUI 3 Support / Does NGUI2.6.3 works fine on Unity4.1.5f
« on: August 09, 2013, 02:12:47 AM »
I update the unity from 4.0.0 to 4.1.5 and ngui from 2.6.2 to 2.6.3,

For too many reasons, we must use 2.6.3 with unity 4.1.5. However, I find the .setActive has some problems with UIImangeButton -- I set the active of a button to false, but the image still remains.

The left is the button whose active is true, and the right on whose active is false, however, the image still there.

3
NGUI 3 Support / Question about pixel - perfect in UILabel
« on: July 21, 2013, 10:36:20 PM »
I find texts sometimes show inappropriate. So I used Make pixel -perfect in the root node. However, some labels added 0.5 on local position x or y axis , others are not. As the result, most uilabel works well, however, rests display the text a little stretched. I manually add or remove the 0.5 on their local position then the problem solved. So I want to know however the pixel - perfect works, and what should I do to fix this problem.

4
NGUI 3 Support / UItexture does not display clear as UISprite
« on: July 03, 2013, 10:21:12 PM »
We former use UISprite to show big back ground so the atlas is very big, so we delete that image from atlas and use UITexture to display. However, no matter how I change the setting of the image and the shader of the texture, the quality is much lower than use uisprite.

So How can I make the UITexture has the same display qualty as UISprite? DO I miss something important?

5
NGUI 3 Support / Where is the New Sprite button?
« on: June 26, 2013, 02:36:33 AM »
I use 2.6.2, and cannot find New Sprite button in Inspector of Atlas, does it removed?

6
We former used Unity3D var 4.0.1, and game runs well, however after update to 4.1.3 or 4.1.5, we have a trouble.

Our project contains ngui and ex2d plugin, and ngui has it's own layer.

I have attached collides in order to screen the mouse event -- if i click a gui window, the player won't move. But now, when I click the window, not only the button change the sprite, but also the player moved. So I want to know how to solve this problem :)

7
NGUI 3 Support / new UIImageButton doesn't support UIForwardEvents
« on: June 13, 2013, 09:28:34 PM »
new UIImageButton which has disable state does not support forward.
for example, OnHover cannot make the target button change the sprite.

8
NGUI 3 Support / Two questions aobut 2.6.1
« on: May 05, 2013, 10:01:07 PM »
Now, I updated my NGUI to 2.6.1 var, dynamic font seems very exciting!!!However, there is a problem when I import package: IN line 116 UIAtlasMaker.cs, SystemInfo.maxTextureSize cannot be find( and my unity version is 4.0.0), so I change that to
  1. int maxSize = 4096;
, and i don't if it may lead to  further problems.

And when I import a TTF file, I find the filter cannot change, the text, therefore, is a little blur, so Is there any method to change the filter mode?

Thanks~~

9
NGUI 3 Support / Can greyscaled sprite be impliment now?
« on: May 03, 2013, 12:58:04 AM »
Greyscale sprites of items and skills are usually used in gui to indicate inactive, and create another image of greyscale will cost too much spaces. I tried to use a shader, but it will change the whole material in the atlas. So can I change a single sprite into grey or change the sprites under a panel into grey?

10
NGUI 3 Support / About edit gui in ngui new version
« on: April 22, 2013, 09:40:49 PM »
We used 2.1.6 to development our gui, and last week I tried to upgrade it to 2.5.1. Some new features like the selection window of sprite is useful, however I find some problems now.

First, NGUI has combined  four kinds of sprite into UISpirte, it is very simple to use, however when we create the shops or items, we used to use UIFilledSprtie and used NGUITOOL NGUITools.AddSprite to add new sprites,
  1.         private UISprite[] m_bagSprite = new UIFilledSprite[ConstPreference.Every_BagItem_Count];
  2.         m_bagSprite[i].type = UISprite.Type.Filled;
  3.         m_bagSprite[i] = NGUITools.AddSprite(anObj.gameObject, m_itemAtlas, "");
  4.  

it shows bug:
ArrayTypeMismatchException: Source array type cannot be assigned to destination array type.
(wrapper stelemref) object:stelemref (object,intptr,object)

So I change the code
  1. private UISprite[] m_bagSprite = new UISprite[ConstPreference.Every_BagItem_Count]
and the the type of the sprite to "Filled", the bug still there. So how can I use the filled sprite.

Second, seeing the image of sprite is very useful, however sometimes, when I want to add an Image Button, I really need to know the name of the sprite.Can the name of sprites displayed under the images?

The last problem, using the handle to directly modify th size of sprites in edit mode is cool, however our these sizes is alreadly decided, and sometime I want to change the position, I click the handles and change the sizes, it is very uncomfortable, can I disable those handles?



11
Now, I am completely finished my chat window, so I will share some of my work with you. The first one is the navigation. (my ngui version is about 2.1.4)

First you should know that English is as a foreign language for me, so there will be some grammar mistakes and inappropriate expressions.

And I cannot offer you my code for: 1 this is from my job, 2 my input box have so many other functions such as hyperlinks and flash carat, and 3 I haven’t get touch with Unity3D and NGUI unity this January, so my code is very bad :(. But, I will provide the way I implement this function.
Arrow Key navigation:

the First Step:
The original UIInput is used a method call GetEndOfLineThatFits
 in UIFont.cs. It cut the text and leave some last chars so that the string will not out range the input box, but if you need insert or remove a single character, you cannot use this way to cut the string. We need the UILabel in UIInput cantinas the whole string and display only parts of the string. This sounds a little hard, however fortunately, ngui provide a panel which can clip. OR, change the code in that method.

Add clip on the parents panel.

And give the string  processed value to string fit
Now, the surplus contents will not be observed, but the surplus words will not be shown. This will solved later.

the Second Step:

In the input script, author already appand the carater ‘|’ after the text, so we need add the local parameter indexOfCarat to store the position of carater. Then, modify the code in method UpdateLabel, let the carat char insert the right place. If we detected the right arrow key, we add the index, and sub the index if left key pressed.

Now, we can see the carat moving, but the now inputs still added after.

 The text for UpdateLabel the method needs modify. You need to control the value of this index to constrain the legal value.
We already have the position of carat which user want. So, the new char is not appand at the end but insert in the index of carat.


So, it’s nearly complete.~~ if the length is not very long , this input box works well. But if the length out ranged the size of the label in input box, or adjust the position of the carat too far, there will be an error: the carat misses.

the Third Step.
The reason is that the carat is out of the input box.

The way I used to fix this problem is to change the position of the label accrounding the carat. Before solve the problem, we should know a useful method is UIFont.cs: CalculatePrintedSize, which will return the pixel size of a given text in the specific font after multiplied by the font size. So what we should do is to try to keep the carat in to the input box.

Add a Vector2 to store the current position of the label(pivot of this is left, top left or bottom left), another two Vector2 to store the position of the input box(or the clip box) and the size of it.

How? A simple way is to keep the carat on the left side of the input box after pressed the left arrow key or backspace, and on the right side after right arrow and type a letter. This is my solution.





the Last Step:
Thus, after the carat moved left, we calculate the length of text before and the then added to the position of the label to judge whether the carat is on the right of the input box. If so, move the whole label right so that the carat just in the box and on the left side.


The green arrow show the value the label should move.
We using the same way to process when the carat move right.

After this step, we can use the key to navigation.

12
I am working on a chat window, and have many buttons and labels which has different scripts. However, after finished these functions, i was asked to set the whole background visible when curse into the whole window. So the first solution came into my mind is to attach a large collider in order to set the visible, but after response this event, others will not be responded. So how can I set this big collider so that other colliders under (have a large z axis) are able to receive mouse events. thanks:)
and forgive my pool English, please :)

13
NGUI 3 Support / my chat window
« on: March 01, 2013, 11:54:51 PM »
this is my chat window which allowed emotions and hyperlinks~
I cannot show the input box for the image is not my work.
in input box,users can use left/right arrow key to relocation the carat however because of the request of inputing hyperlink, i didn't allow mouse relocation, but with out such requirement, it will be very simple.

I dont know how to show images, so please download the attachment http://www.tasharen.com/forum/index.php?action=dlattach;topic=3311.0;attach=1502to view the result

14
NGUI 3 Support / Problem when using colored text in example 12(chat window)
« on: February 21, 2013, 03:11:42 AM »
I am trying to make a good chat window and encountered a problem about chrome text:

when using inputed many character, text will be wrapped so that it can fit the max width.
however, if the first line which contain the color info such as [FF00FF] is scrolled up, the rest character will become default color.

So is there any solution?

15
NGUI 3 Support / Chat Window with Image
« on: January 29, 2013, 03:44:02 AM »
In order to create a full function chat window, I want label can show little pictures for example :
Hi :) hello

However TextList in NGUI can only change the color of texts, but cannot add some other elements such as pictures or hyperlinks.

I tried to create a Sprite to show an image, and calculated the position to cover the text which represent image, but the height of a line cannot adjust for image bigger for characters.

I want to know is there any method to realize a chat window which allow users to insert happy faces  :) like this forum.

And there is another problem, in my font file, there are some large characters which as three times  as the rest, but in Label, they do not have enough space, other characters cover the extra places,  Can some one help to to deal this problem?

Please forgive my pool English. Thank you.

Pages: [1] 2