Author Topic: Nested Panels  (Read 4620 times)

vidjogamer

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
Nested Panels
« on: April 13, 2014, 09:40:11 AM »
Does NGUI support nested panels? How do they work? Does a child panel act as a widget to the parent panel?

I'm having some depth sorting issues and I cant quit figure it out. I'm making a card game. I'm just testing out NGUI at the moment. I have a UIPanel for each card since each card is made up of multiple sprites, labels, textures. Now I want to be able to drag cards from one area to another. I'm using DragDropItem and DragDropContainers and DragDropRoot. For some reason I cant get the picked up object to appear on top. Even though the DropDropRoot has the lowest depth. Why would this be?

vidjogamer

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
Re: Nested Panels
« Reply #1 on: April 13, 2014, 05:47:52 PM »
So I'd still like a little explanation about how panels work under the hood. But that said, I was able to achieve what I wanted by dynamically setting the cards depth value on drag.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Nested Panels
« Reply #2 on: April 14, 2014, 03:08:46 AM »
NGUI supports nested clipped panels as of 3.5.6. The clipping is done via a shader, yielding the best possible performance. NGUI determines how many panels clip each draw call and chooses the appropriate shader to do it. I wrote shaders for up to 3 clipped panels affecting each draw call, but NGUI itself can support more if desired.

The order in which draw calls appear depends first on panel depth, and then on widget depth. The higher the depth, the later the draw call will be drawn, causing it to be on top. Make your panel's depth higher, not lower.