Author Topic: Multiple grid with centeronchild problem :)  (Read 1674 times)

cimocimo

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Multiple grid with centeronchild problem :)
« on: March 31, 2014, 11:17:37 AM »
Hi guys! i was previously registered and this is not my first message but i've lost pass and previous email.. so,sorry for that :)
I'm trying to create a menu with the scrolling view template that was in the package, i've modified it to the picture shown below,
i have two grids with the centeronchild script (the label in the center is just a texture with alpha)
Basically, first grid is to select cube 1 color and the second grid for the cube 2.
i gave uibutton function on every item so i can move between each button by mapping with UIButtonKeys, so wherever i'm on the first grid, if i press right,
it goes on the first one of the second grid, the same in reverse (because i did it, by mapping every item on the second grid to point at button 1 of the first grid when press left) .. how do i do (probably via script) that when i change grid, the selection start from the previously selected (example the 4th color) and not from the top of the list?
I tried to be as clear as possible, i hope it is from the outside :) help me if you can, and sorry for the english :D:D:D


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Multiple grid with centeronchild problem :)
« Reply #1 on: April 01, 2014, 10:32:08 AM »
You would need to remember the selection when navigating from one list to another, or just set all of the second grid's navigation components to select the object you're leaving instead of whatever they had before. Likely best to do this via a custom script for left/right navigation rather than relying on the Key Navigation component.

cimocimo

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Multiple grid with centeronchild problem :)
« Reply #2 on: April 01, 2014, 12:58:06 PM »
Hi Aren! thanks for the reply :) ..actually both would be fine, but just the second option would be ok too.. would you be so kind to point me at the right direction via scripting? Really noob here :D ..from the little i know about ngui and unity, my only idea was to set different uikeynavigation for each button,and enabling\disable them via triggerevent.. but that would be insane with 10+ choices, that'd been good for 2\3..
Thanks
 cimo

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Multiple grid with centeronchild problem :)
« Reply #3 on: April 02, 2014, 06:12:14 PM »
Start by examining UIKeyNavigation to understand what it does. Note how it changes UICamera.selectedObject in order to navigate? You will need to do the same. Only in your case you may want to save where you were (have some kind of a history).