Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Tomleung on May 22, 2014, 02:08:18 AM

Title: Drag Drop item issue
Post by: Tomleung on May 22, 2014, 02:08:18 AM
Is it possible to restrict the user to drag some items on certain surface only?

For example, if I put one dragdrop surface on the ground and another one on the ceiling , I want to let the user only can put some chairs on the ground surface but only can put some lights on the ceiling surface. Is it possible? If possible, how to implement it?

Thx.
Title: Re: Drag Drop item issue
Post by: ArenMook on May 22, 2014, 03:45:16 PM
Create your own custom DragDropItem like I did with ExampleDragDropItem. You can do what you want inside, including adding logic that differentiates between different surfaces.
Title: Re: Drag Drop item issue
Post by: Tomleung on June 18, 2014, 11:04:53 AM
Create your own custom DragDropItem like I did with ExampleDragDropItem. You can do what you want inside, including adding logic that differentiates between different surfaces.

Did you mean that I need to create another DragDropitem and ExampleDragDropItem scripts like DragDropitem2 and ExampleDragDropItem2, and use these two scripts to implement in some items on DragDrop so it can separate two cases?
Title: Re: Drag Drop item issue
Post by: ArenMook on June 18, 2014, 04:34:30 PM
ExampleDragDropItem derives from DragDropItem script, implementing custom behaviour. So you would do the same -- derive from DragDropItem, implement custom behaviour.
Title: Re: Drag Drop item issue
Post by: Tomleung on June 19, 2014, 02:55:22 AM
Thanks. I would try it.

One more question I would like to ask is that is it possible to drag and drop items on grid , by using your DragDropSystem ?

For example, if I would like to drag and drop items on the grids of the surface only, is it possible ?
Title: Re: Drag Drop item issue
Post by: ArenMook on June 19, 2014, 06:11:07 PM
How is the grid defined? Remember, drag & drop works with colliders. So if you have an inventory that's, for example a grid of 8x8 cells, each cell would ideally have its own collider. This way you will know exactly over which collider you're dropping the dragged object.