Author Topic: SetAcive Items in Grid (scroll view) don't appear due to positioning  (Read 1755 times)

moghes

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
I have been using NGUI for only 2 weeks and I am stuck in a problem.

I have a local store (horizontal scroll), working fine, as the user taps on an item, it will be added to a local inventory so that he can use the item whenever needed.

I thought of several methods, and had several obstacles, and now I have all items already present in the Grid, and as the user taps to open the inventory, I check (all selected items) and disable all remaining. (setActive(fasle)).
I don't know if this is the method to go with but sure there must be smarter ways.

But know I face a bigger problem.
The items are enabled, but and repositioning works also but they are out of screen. (check the attached picture)
I did put UIAnchor on the grid, and the grid no longer is scrollable..

This has to be much simpler, I need your help.
Thanks in Advance

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: SetAcive Items in Grid (scroll view) don't appear due to positioning
« Reply #1 on: October 10, 2013, 07:28:53 AM »
Your linked picture doesn't work.

Did you see the drag & drop example? In there I remove an object from it and reposition everything remaining.

moghes

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: SetAcive Items in Grid (scroll view) don't appear due to positioning
« Reply #2 on: October 10, 2013, 07:58:27 AM »
Thanks for your reply.
Here's the link.
http://imageshack.us/photo/my-images/6/68ih.jpg/

I checked your example, it seems to help me and what do you recommend me to do for sorting them dynamically?
Instantiate or as I have done?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: SetAcive Items in Grid (scroll view) don't appear due to positioning
« Reply #3 on: October 11, 2013, 08:48:08 AM »
That's up to you. You can rely on the grid to re-sort them, or you can do it yourself. Just keep in mind that if you destroy an object then iterate through the parent's list of children, the object will still be there as destroy calls are delayed. NGUITools.Destroy helps with that by unparenting the object first.