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

Pages: 1 2 3 [4] 5
46
NGUI 3 Support / Re: UIInput Validator
« on: April 18, 2013, 02:57:14 AM »
use the regular expression~~

47
NGUI 3 Support / Re: my chat window
« on: April 02, 2013, 11:55:02 AM »
I am about to write about the method I used to create my chat  window, the first one is how to make a real input field: http://www.tasharen.com/forum/index.php?topic=3628.0. However the fact is that most people need not to build a chat window through NGUI, so I will still post other to introduce how to make a change able and efficient hyperLink. Plz wait for me to finish my job.

48
@Nicki
"Consider using dynamic fonts
http://www.tasharen.com/forum/index.php?topic=2707.0
They should only load the chars you actually need, which should be significantly less."

Hey, thanks for the reply. I copied the font over to Unity. I am not able to drag it over in the Font Maker? The post doesn't tell you either (it only has the pictures which I didn't find to be very helpful). I can see the font in the inspector but I can't select it from my NGUI label. Any help?

Cheers.


@Galuodo: "try using point filter" - what's a point filter :) ? Thnx.


In material of font's, set filter: point, the default maybe bilinear or triliner

49
try using point filter

50
NGUI 3 Support / Re: How to make small text sharp?
« on: March 29, 2013, 02:20:40 AM »
filter mode : Point

51
If you need a mouse cursor navigation?
(I do not do this for the hyperlink thing, but i can offer some simple idea)
Add a collider and adjust the centre and the size fit the whole input area(not the clip area). If the mouse button pressed, it is easy to know the position where the cursor on the collider, and then the position on the label, last calculate the index of carat by using CalculatePrintedSize. And if you drag the mouse and near the rim, do the same thing as arrow key:).

I do not know how to select the word~ but I also have an idea~~

When mouse pressed, calculate the index of carat and retore it~, when dragging, calc the curr carat and but a UIFilledSprite behind the label to show the selection. Because of the clip of panel, we do not have to re-calc the size of the selection if the label scrolled.
When the mouse button released, store the index, and obtain the subString user select~~


I hope my method will help.pleas do not post or translate to Chinese Unity3d Forum!!!!!

I am learning English,so if you think this is useful, and if you find some grammar mistakes and odd expression, please tell me.

[2013-4-2 11:28]
now. I have to do a mail system, and to create a powerful input after the festival, and after that, there is a better chance to provide the code :)

52
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.

53
NGUI 3 Support / Re: UIInput navigation
« on: March 27, 2013, 05:16:17 AM »
I've finished the arrow navigation, but not mouse because input field allows users put hyperlink. but it is very easy.

54
NGUI 3 Support / Re: Drag and stretch chat window
« on: March 26, 2013, 10:05:12 PM »
you can refer to the example: calculates the maxLines after resize.
That is easy if you do not have a various line heights~~

55
Thank you.
UIForwardEvents is very convenient and thoughtful, however I have too many targets to forward, and I have to bound too many targets...... and modify the window will not easy.
I will use update() to detect whether the pointer is in the certain area. And forward events can be used in latter works~~

56
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 :)

57
NGUI 3 Support / Re: UITextList Scrollbar
« on: March 02, 2013, 12:26:09 AM »
scrollbar has it's delegate

58
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

59
I've solved it by using UIPanel's clipping. It is a great function ;D

60
Yeah - don't use that chat window. :) It's just a very basic example. Consider simply adding labels to a UITable. With a lineWidth property set you will get the word wrapping properly.

Thanks for your answers , however multi-labels will also encounter this problems for because of the height limitation which will remove the first line of the text which contains [ffffff].

 I have already implement a lot of functions through this method, multi-lines hyperline and size automatic adjusting dynamic emotions for example, So, I want find a expedient way. Can you give me any suggestion?

Pages: 1 2 3 [4] 5