Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Dev.D on May 07, 2012, 06:51:48 AM
-
Example 11 Drag and drop works pretty sweet. I want to do a modified Drag and Drop behaviour using NGUI.
I have a catalog list of items on screen represented by a UITable with Icons*. I want to drag an icon from this list to the world. Using the provided DragDrop mechanism what happens is that the icon get removed from the list and gets dragged along with the mouse. I would like to change this and make the Catelog list itself immutable. On (pressing and) dragging an icon from the list an instance of that icon gets created and that gets dragged along the mouse instead. I manually send this new instance an OnPress to simulate the mouse button press. This doesn't seem to work, the OnDrag and Drop notifications from the system always go to the icon in the catalog list and not the newly created icon :(.
I think I may have over complicated this. Any ideas how to do this better?
* An Icon is just a parent Gameobject containing a UISprite. The parent GO has a DragDropItem script attached.
-
Sending OnPress won't do you any good as the logic of what's currently being dragged is inside UICamera.
You can set the UICamera.currentTouch.pressed object in your DragDrop item's OnPress. Might need to set UICamera.currentTouch.current as well, play with it.
-
Thanks, I'll try that !