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

Pages: [1]
1
NGUI 3 Support / Little polish on UIScrollView
« on: June 05, 2014, 10:26:41 AM »
Hi,

Just to submit a little polish proposition on UIScrollView, that I've just done myself for my needs; in case Momentum is chosen (with unrestricted movements), I think the scroll view should not stop immediately if the bound is met in one of the direction ; it should continue in the direction which still has space to move.

I did it very simply in RestrictWithinBounds with:

  1. if(Mathf.Abs(constraint.x) > 1f)
  2.         mMomentum.x = 0;
  3. if(Mathf.Abs(constraint.y) > 1f)
  4.         mMomentum.y = 0;
  5. if(Mathf.Abs(constraint.z) > 1f)
  6.         mMomentum.z = 0;

Instead of

  1. mMomentum = Vector3.zero;

I guess it's not totally clean, but it seems to work.

Another suggestion for MomentumAndSpring would be to allow the user to select the strenght of the force that prevent the user to drag the view too far from the bound (which is currently determined by a hard coded 0.5f).

2
NGUI 3 Support / ScrollView positionning
« on: April 25, 2014, 07:31:12 AM »
Hi,

I've met some posts about my problem, but could not figure out a solution...
The changes of the behaviour of panel offset when there is a scroll view causes me huge headaches. I just don't get the point of setting the offset automatically without possibility for us to change it.
I'm used to spawn dynamically objects in the scroll views, and I like for that to have my first object on position 0,0,0 and my scroll view's transform on 0,0,0 as well, so that I can easily spring it to its initial position. However, it does not seem to be possible anymore. If I try to change the center position of my panel so that my first object is on the right place, it changes the transform's position as well, so it's not on 0,0,0 anymore. I've tried everything I could without modifying ngui's code, but I'm out of options. I Just want to be able to place my first item wherever I want with its position and the panel's transform position to 0,0,0, and it does not seem to be possible.
What is the good way to do this? What is the purpose of setting the panel's offset automatically?

3
NGUI 3 Support / Dynamic font height
« on: December 11, 2013, 09:20:00 AM »
Hello,

A few days only after my last topic, here I am again!
I now have a problem with one particular dynamic font, which behaves strangely with NGUI.
To illustrate that:

- The problematic font:


- Another font:


It's probably the font's fault (since other dynamic fonts work), however this problem does no show up with Photoshop, Word or even with Unity's GUI Text, only with NGUI.
Any idea how I could solve it? I can send you the font if needed (but not attach it to this topic, since it's not a free font).

4
NGUI 3 Support / Tiled-sliced sprite ?
« on: December 09, 2013, 09:26:03 AM »
Hello !

I was considering implementing a tiled-sliced sprite (with constant borders and a center that is tiled), but then it will be annoying to keep my changes when updating ngui... Would it be possible to include such a feature in the release version?

5
NGUI 3 Support / UISprite not updated until press released
« on: November 21, 2013, 10:14:47 AM »
Hello,

I have a problem with a UIImageButton in a UIDraggablePanel.
When the finger goes out of the draggable panel, I cancel the drag and spawn like a copy of the selected object to be dragged with the finger; it works pretty fine overall, except one thing: the item that was dragged inside the draggable panel (which has a draggablePanelContent component and a UIImageButton one) will not turn back to its "normal" sprite when I think it should.
Here is the code I use to stop the panel from being dragged:

  1. Debug.Log("Stop scroll input!");
  2.         //The currentSelectedItem is the object with the finger on, with two UIButtonMessage, one UIImageButton and one UIDragPanelContent
  3.         currentSelectedItem.gameObject.SendMessage("OnPress", false);
  4.  
  5.         UICamera.currentTouch.pressed = null;
  6.         UICamera.currentTouch.dragged = null;
  7.         //Tried to add the refresh to solve my problem, without success
  8.         draggablePanel.panel.Refresh();

So here is what happens:
- I press this button => UIImageButton component receives the event and turn the sprite to the pressed state
- I drag it around a bit
- I take it out of the draggable panel (triggering the above code) => UIImageButton component receives the OnPress event with "false" and assigns the normal spriteName to its target (it is correctly assigned); however, in the game view (and on device), the sprite stays "pressed"
- I drag my copy around, the draggable panel does not follow anymore, but the button sprite remains pressed
- In editor, if I release the button anywhere, the sprite finally updates to its normal state, except if I release over the button itself (the hover sprite is the same as normal); in this particular case, the sprite remains "pressed" until I take the mouse out of the collider (wtf??).
- On device, when my finger releases the touch, the sprite simply remains "pressed" until I tap on it again.

Any idea about how to force the update of the button sprite after its value has been changed by UIImageButton component?

6
Hello,

I'm using the Max chars property on some of my UIInput fields, and it works great on editor, however on iOS (and maybe on Android, I haven't tested yet) it only cut the label when the user ends up writing.
It would be great that the user can't write more characters than the limit in the system keyboard.
I tried to change UIInput.cs, changing the order of the following two lines in the Update function :

  1.                                 if (mText != text) mKeyboard.text = mText;
  2.                                 UpdateLabel();

It almost worked, but the user can see the last character he types before it is removed because of the chars limit.
Would you have any idea of how to do this properly, without the user being able to see the additionnal character before it is removed?

7
NGUI 3 Support / Problem with NGUITools.SetActive
« on: October 09, 2012, 10:05:23 AM »
Hello !

So until now I used NGUITools.SetActive without any problem, everything worked perfectly, but I just encountered a problem which I cannot figure out...
I have a menu Panel which I activate on some event, a scrollView in it, and in this scroll view, two game objects for two sections.
The second one contains a "title" with a UISlicedSprite and a UILabel, and when I try to desactivate this one, there is nothing to do, it just keeps being here. I guess I call some functions in the wrong order, but I cannot find a solution.

Here is the simplified script attached to the parent panel:

  1.         void OnEnable()
  2.         {
  3.                 NGUITools.SetActive(gameObject, true); //Had to do this because I need the children to be activated for the next functions
  4.                 RemoveAllGames();
  5.                 LoadGames();
  6.         }
  7.  
  8.         void LoadGames()
  9.         {
  10.                 //Here I insert a lot of objects in the first section of the scrollView
  11.                
  12.                 //And now I handle the second section:
  13.                 if(trueCondition)
  14.                 {
  15.                         NGUITools.SetActive(SecondSectionOfTheScrollView, false);
  16.                 }
  17.         }
  18.  
And after that the second section stays active, no matter what...

Maybe it is because I call it from a "OnEnable" function, but I can't find another solution (because I need this view to be reloaded each time the panel becomes active)... Any idea?

8
NGUI 3 Support / Problems with UIDraggablePanel
« on: September 28, 2012, 11:05:34 AM »
Hello !

I've been looking for answers here for some times, but I'm wondering if I wouldn't have made a mistake somewhere, because I think my problems are not the normal behaviour of the scroll view.

There is two of them:

- Some of the items in my UIDraggablePanel are not hidden when out of the scrolling area. I think I did not have this problem at the beginning, but I can't remember anything I would have done to change that.
The title on top of the UIDraggablePanel disappears when dragging the panel up, but the next items do not... Some of them are created dynamically. Is there an option or something I could have changed without noticing that would cause that?

- I can't drag the scroll view when scrolling from a button. I've read in another topic that there is an option for this in the UICamera, and I've tried to set it to a very little value, but no matter how far I drag from the button, the scroll view does not move if I began in the collider of the button. Any idea on this?

Pages: [1]