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

Pages: [1]
1
NGUI 3 Support / Re: Scrollable text Area
« on: April 16, 2014, 02:12:37 AM »
Thank's

In general i prefer avoid to modify directly your code, to avoid reimplementing changes at every ngui updates. I hope that in future NGUI release mCaret  will'be accessible.
For now I'm accessing caret in this way
  1.         UITexture findCaret ()[
  2.                 {
  3.                                 UITexture caretTexture = null;
  4.                                 UITexture[] cs = label.GetComponentsInChildren<UITexture> ();
  5.                                 foreach (UITexture c in cs) {
  6.                                                 if (c.name == "Input Caret") {                         
  7.                                                                 caretTexture = c;
  8.                                                                 break;
  9.                                                 }                      
  10.                                 }
  11.                                 return caretTexture;
  12.                 }
  13.  
And get caret limit
  1.  
  2.                 void CalcCaretLimit(UITexture caret)
  3.                 {
  4.                                 MaxCaretX = float.MinValue;
  5.                                 MinCaretX = float.MaxValue;
  6.                                 MaxCaretY = float.MaxValue;
  7.                                 MinCaretY = float.MinValue;                    
  8.                                 foreach (Vector3 v in caret.geometry.verts) {                                          
  9.                                                 if (v.x > MaxCaretX) {
  10.                                                                 MaxCaretX = v.x;
  11.                                                 }
  12.                                                 if (v.x < MinCaretX) {
  13.                                                                 MinCaretX = v.x;
  14.                                                 }
  15.                                                 if (v.y > MinCaretY) {
  16.                                                                 MinCaretY = v.y;
  17.                                                 }
  18.                                                 if (v.y < MaxCaretY) {
  19.                                                                 MaxCaretY = v.y;
  20.                                                 }
  21.                                 }                                      
  22.                 }      
  23.  
Calculate ScrollView  limit

  1.  
  2. void CalcScrollViewLimit ()
  3.                 {                                              
  4.                         minclipX = scrollViewPanel.clipOffset.x - initialOffsetX;
  5.                         maxClipX = (minclipX + scrollViewPanel.finalClipRegion.z);
  6.                         minclipY = scrollViewPanel.clipOffset.y - initialOffsetY;
  7.                         maxClipY = minclipY + (scrollViewPanel.finalClipRegion.w * -1);
  8.                 }
  9.  
At every key press I execute this method.
  1.  
  2.         void UpdateScroll ()
  3.                 {                              
  4.                                 UITexture caret = findCaret ();
  5.                                 CalcCaretLimit (caret);                
  6.                                 if (MaxCaretX != float.MinValue) {                                     
  7.                                                 CalcScrollViewLimit ();                                
  8.                                                 if (MaxCaretX > minclipX && MaxCaretX < maxClipX) {
  9.                                                         // inside scroll area
  10.                                                 } else {
  11.                                                                 if (MaxCaretX > maxClipX) {                                                            
  12.                                                                                 scroll.MoveRelative (new Vector3 ((maxClipX) - MaxCaretX, 0, 0));
  13.                                                                 } else if (MinCaretX < minclipX) {
  14.                                                                                 scroll.MoveRelative (new Vector3 (minclipX - MinCaretX, 0, 0));
  15.                                                                 }
  16.                                                 }
  17.                                                 if (MaxCaretY > minclipY && MaxCaretY < maxClipY) {    
  18.                                                         // inside scroll area
  19.                                                 } else {                                                               
  20.                                                                 if (MaxCaretY < maxClipY) {                                                            
  21.                                                                                 scroll.MoveRelative (new Vector3 (0, maxClipY - MaxCaretY, 0));
  22.                                                                 } else if (MinCaretY > minclipY) {
  23.                                                                                 scroll.MoveRelative (new Vector3 (0, minclipY - MinCaretY, 0));
  24.                                                                 }
  25.                                                 }
  26.                                 }
  27.                                 scroll.UpdateScrollbars (true);
  28.                 }
  29.  
I simply look if caret is outside bounds area, and i move scroll for the difference between  bounds area limit and cursor position.It's quite rudimental, but seems it works. Is it in your roadmap implements this kind of component in future NGUI release?

2
NGUI 3 Support / Re: Scrollable text Area
« on: April 08, 2014, 02:24:06 AM »
Thank's Aren,

This solution work fine, but i have a problem.
When I'm editing text, and text row length became greater than scrollView width, i need a system that automatically scroll horizontal scrollBar up to caret position.
I thought to force horizontal.value =1 after onChange event, but it works only if append text.

Solution could be know the localPosition of caret, ad tell to ScrollView to scroll at this position,if position is not in the scrollView bounds.If that is the right way, what I have to do to know caret localPosition?.


3
NGUI 3 Support / Scrollable text Area
« on: April 07, 2014, 02:00:12 AM »
Hi All,

Is it possibile in NGUI make an UIInput Text with horizontal e vertical  scrollbars for inserting a long text by user?.

4
NGUI 3 Support / Re: PopUpList
« on: January 29, 2014, 03:01:27 AM »
I have recently updated my NGUI version and , obviously , the update has overwritten my changes in UIPopList.cs
Is there a way to obtain the same result  without change UIPopList.cs  script?

Thanks.

5
NGUI 3 Support / PopUpList
« on: January 09, 2014, 04:15:09 AM »
Hi all,

I'm using UIPopUpList with some item (item1,item2,item3).
I have the necessity to show popup with the value set to empty, the first time that I show this control.
I set UIPopUpList.value="" and works fine, but the when i click on popup to make a choice,  Highlight sprite is shown outside item list area.
I have looked UIPopUpList.cs code at Onclick method, and I understand that happen because empty value doesn't  matches any values in item list.

TO solve this I have modified script in  this way

// Move the selection here if this is the right label            
   if (mSelectedItem == s || i==0)
      Highlight (lbl, true);

adding OR with i variable , I highlight the first item if there isn't  correspondence with popup value and popup list.

it is the correct way or is there another solution?


Thanks




6
NGUI 3 Support / Re: (!!!) Improving NGUI: Voice your opinion
« on: November 27, 2013, 12:06:20 PM »
In UIinput ,please  add text selection.
In Textarea, use enter key for a new line (instead of control-enter).
Possibility ,in  UIPopupList ,  to change selection using index instead of only with value.
UIPanel has centered pivot point only, i think that would be useful to change pivot point ,like widget, in order to easily resizing with the parent contanier
Prevent , in UIDraggable object, drag outside of the screen.

Thanks

7
NGUI 3 Support / Panel stretch
« on: November 13, 2013, 08:21:04 AM »
Hi all,

I'm using ngui UITable script for make an icon grid.
UIGrid is inside a draggable clip panel  that is contained into a sprite window.
Sprite window has pivot point in upper left positon end draggable panel in the center.
When I try to resize window, i need to strech draggable panel bounds into sprite window.
How can i solve this ? i know than panel componet can't change his pivot point.

Thanks

Pages: [1]