Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Abnaxus on May 07, 2013, 08:41:38 AM

Title: [Problem] Activate SpringPanel / RestrictWithinPanel dynamically.
Post by: Abnaxus on May 07, 2013, 08:41:38 AM
Hey again.

I've been trying many things for a moment now and I can't activate the RestrictWithinPanel from my DraggablePanel.

I mean, I'm dynamically scrolling my panel and I wish that if it goes too far, it comes back to the first/last element.
  1. void placeDragPanel()
  2.         {
  3.                 GameObject panel = GameObject.Find ("DragPanel");
  4.                
  5.                 Vector3 position = panel.transform.worldToLocalMatrix.MultiplyPoint3x4(transform.position);
  6.                 Vector3 pos = new Vector3(0, -position.y, 0);
  7.                
  8.                 SpringPanel.Begin(panel, pos, 5f);
  9.  
  10.                 //Here would be the repositionning if the contents aren't visible in the clip.
  11.         }

For the moment, I have to click on my Draggable Content for him to activate RestrictWithinPanel/SpringPanel.
And I'd like it to be "automatic" (dynamically).

Is there any way to do so ?

Thanks in advance.

Greetings,
Abnaxus.
Title: Re: Activate SpringPanel / RestrictWithinPanel dynamically.
Post by: ArenMook on May 07, 2013, 04:24:47 PM
There is no "automatic" for this, as your functionality is custom to begin with.
Title: Re: Activate SpringPanel / RestrictWithinPanel dynamically.
Post by: Abnaxus on May 13, 2013, 05:17:06 AM
What do you mean ?

When I'm scrolling manually with mouse, it comes back to the good position so the elements fills the panel.
And it seems like after a scroll, if needed, the script SpringPanel is launching.

So here, I'd just like my dynamic scroll to behave like a manual scroll.

Aren't you launching a function to know if the panel needs to be readjusted ? And then a function to launch the script SpringPanel ?
I'm just asking for these. :s
Title: Re: [Problem] Activate SpringPanel / RestrictWithinPanel dynamically.
Post by: ArenMook on May 13, 2013, 11:04:15 AM
How do you determine what's "too far" when it comes to your dragging? This is what I mean by "custom". Calling UIDraggablePanel's RestrictWithinBounds function is what tweens it into place if a tween is needed.
Title: Re: [Problem] Activate SpringPanel / RestrictWithinPanel dynamically.
Post by: Abnaxus on May 14, 2013, 03:18:11 AM
How do you determine what's "too far" when it comes to your dragging? This is what I mean by "custom".
I don't know, I was hoping your function does it. :(
All I do is switching grid element positions, then placing the panel position (using SpringPanel.Begin) on the current element.
But if it's the last, I'll have a blank fill just bottom to that element. :/

Calling UIDraggablePanel's RestrictWithinBounds function is what tweens it into place if a tween is needed.
Unfortunately, this doesn't do anything. :s