Author Topic: Drag Panel Page  (Read 13921 times)

Alex

  • Guest
Drag Panel Page
« on: August 01, 2012, 11:14:58 AM »
Hi,
In my project i build a level selection so the players
can choose a specific level.
the levels is arranged in horizontal as follow:
1 2 3 10 11 12 19 20 21 ...
4 5 6 13 14 15 22 23 24 ...
7 8 9 16 17 18 25 26 27 ...

The hirarchy of my project is as follow:
*UI Root
**Camera
***Anchor
***Panel
****DragPanel  (UIPanel) and (UIDraggable Panel)
*****Items  (UIDrag Panel Contents)
******Item1
******Item2
******.....   

How can i create paging to the levels so when the user is
drag left/right he can only see the correct groups of levels
for example:
10 11 12
13 14 15
16 17 18

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Drag Panel Page
« Reply #1 on: August 01, 2012, 11:17:10 AM »
This may help:
http://www.tasharen.com/forum/index.php?topic=1052.msg5614#msg5614

The idea for what you're trying to do is the same, except that instead of OnClick you would be reacting to OnPress(false).

Alex

  • Guest
Re: Drag Panel Page
« Reply #2 on: August 01, 2012, 01:12:28 PM »
Hi,

Should i attach the "CenterOnObject" script to every items?
if so then i have a little problem since my items is generated on the fly.
any suggestions please?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Drag Panel Page
« Reply #3 on: August 01, 2012, 04:05:00 PM »
What is that a problem? It's just one extra line of code to add that script. Ideally you'd be doing this on a prefab, once.

The script needs to be on everything that has a collider that you want to react this way.

Alex

  • Guest
Re: Drag Panel Page
« Reply #4 on: August 02, 2012, 05:54:26 AM »
Hi,
I've attached the script to my Item prefab but it's not working.
i also set a reference to the dragpanel.
help please.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Drag Panel Page
« Reply #5 on: August 02, 2012, 08:53:47 AM »
The script example I posted there responds to OnClick(), so when you click on an item, assuming that item has a collider, it will move the draggable panel to center it on that object.

Alex

  • Guest
Re: Drag Panel Page
« Reply #6 on: August 02, 2012, 11:10:48 AM »
Hi,
This is the script that i attach to the items:
public class CenterOnObject : MonoBehaviour
{
   public UIDraggablePanel dragPanel;

    void OnPress( bool state )
    {
      if( state==false ){
           Vector3 newPos = dragPanel.transform.worldToLocalMatrix.MultiplyPoint3x4(transform.position);
           SpringPanel.Begin(dragPanel.gameObject, -newPos, 8f);
      }
    }
}

but it's not work.
all i need is to constraint the draggable panel to some positions so it will show
the groups of levels in reasonable way.
help please.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Drag Panel Page
« Reply #7 on: August 02, 2012, 11:27:16 AM »
Does it work with the original OnClick? If not, then you're missing something -- such as a collider on the object you're clicking. Add Debug.Log() statements to print something when you get OnPress / OnClick events to make sure you actually get them.

Alex

  • Guest
Re: Drag Panel Page
« Reply #8 on: August 02, 2012, 02:58:48 PM »
Hi,
Yes i recieve OnClick and OnPress events but i don't know why it's not working.
The regular drag is working and i can select individual item to launch level but i can't force the drag panel to stop at some positions when the user release the swipe.
Any idea?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Drag Panel Page
« Reply #9 on: August 02, 2012, 03:24:08 PM »
Well, all I can suggest is watch that video I created that explains that script and see if you've missed something obvious.

Alex

  • Guest
Re: Drag Panel Page
« Reply #10 on: August 03, 2012, 04:34:00 AM »
I saw the video and i do exactly the same but still not working.
i think that this feature should be in the drag panel itself, for example you can
add a public Vector3D in the drag panel so the user can set all the needed positions to be clamp to
while dragging.this feature will make it much easy and safe time for people messing with the component.
after all why we buy components? not to make things faster?
i find myself mess with this issue to long and it's not worth it!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Drag Panel Page
« Reply #11 on: August 03, 2012, 05:10:55 PM »
If you find yourself spending too much time trying to get something to work, then the obvious thing to do is to skip it until you are more familiar with the system. I'll see if I can find the time to sneak in an example with the next update.

Alex

  • Guest
Re: Drag Panel Page
« Reply #12 on: August 03, 2012, 11:39:19 PM »
1. I purchased this component more then a half year ago.
2. I'm really sure that noone want to spend their time trying to figure out how to do something in the component that they buy that should and expected from this component to do.
3. BE NICE RESPECT YOUR CUSTOMER AND SMILE!

Waiting for solution....

Alex

  • Guest
Re: Drag Panel Page
« Reply #13 on: August 05, 2012, 01:57:56 PM »
Hi,
How long should i wait until a paging feature will be added to the component?
can you estimate the time?


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Drag Panel Page
« Reply #14 on: August 05, 2012, 04:01:31 PM »
« Last Edit: August 05, 2012, 04:06:40 PM by ArenMook »