Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Crazy Robot Games on August 19, 2013, 04:19:28 PM
-
Hello,
I want to create a typical mobile weapon switch function. The player will swipe left or right in a box and the weapon will switch (without tapping).
I'm trying to make a draggable panel that is locked to only horizontal. each item under the grid is a weapon. When the player swipes left or right, the draggable panel does move but I have 2 issues / questions on setting this up.
1) Is a draggable panel the best way to go about this.
2) If I swipe too fast, the draggable panel move very fast and skips over a weapon. I do have the Center on Child script attached to the grid.
3) how can I know when a particular item is visible. I don't want the player to have to tap on the item once it's in view, when the item is in view I want it to call my function that switched the weapon.
I hope this all makes sense!
Thanks,
-
I'm not sure I'd use a draggable panel for something custom like that. I'd just create a custom script instead.
All widgets have a isVisible flag that tells you whether it's visible -- but this flag only works inside a clipped panel.