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

Pages: [1]
1
NGUI 3 Support / Switch focus from Button to DragObject
« on: October 21, 2013, 07:12:55 AM »
Hi

I have a scenario where an joystick (drag object) has an arrow to the side. If the user presses the arrow the joystick should snap to under their finger and become the active UI component so when the user slides their finger, the joystick moves with it.



So, when the button is pressed I've gotten the code:

button.SendMessage("OnPress", false);      // Deactivate button
joystick.SendMessage("OnPress", true);     // Activate joystick

UICamera.currentTouch.dragged   = joystick;   // Make the joystick the camera's current drag object


Which works in that it results in the joystick being dragged after a finger is slid off the button BUT it seems that that breaks something else as the joystick doesn't move as it normally does (like when its pressed directly and ragged around. With my method via the button it jumps off the panel).

Is there already a way of doing this? Or if not how should I go about implementing the functionality?

P.S Here's the image link just incase: http://imgur.com/IrTH6C1 (wasn't displaying properly in the post for me)

2
Hi there

I'm developing the control system for a platformer and am using NGUI. Everything works correctly until I enable my camera to follow the character. That is to say, when the camera is static all the NGUI widgets etc all react as they should but when the camera is moving, buttons don't pick up every click and the UIDragObject I'm using as a joystick snaps to the side of the clipping bounds of it's panel.

Again, this all works fine if the camera doesn't move.

Each NGUI object has a UIAnchor set to use the camera and the camera has a UICamera script on it.

Do you have any ideas what the problem could be and/or how to solve it?

Pages: [1]