Author Topic: Sprite run code after entering container?  (Read 5812 times)

Medico

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Sprite run code after entering container?
« on: January 03, 2016, 05:53:05 PM »
Is there way I can have a sprite know that it's been dragged successfully into a new container and, based on the container, run a function.
 

Medico

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: Sprite run code after entering container?
« Reply #1 on: January 04, 2016, 12:35:25 PM »
I'll add that I think what I'm looking for is a possible function that is called on a UI sprite when it enters a new container or grid.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Sprite run code after entering container?
« Reply #2 on: January 05, 2016, 07:02:05 AM »
You can do whatever you want in the UIDragDropItem.OnDragEnd, or on the container's OnDragDropRelease. They are both virtual functions, so derive a class from UIDragDropItem and do what you want.

Alternatively use OnDragOver() -- a native NGUI notification.