FairyGUI.Stage.SortWorldSpacePanelsByZOrder C# (CSharp) Method

SortWorldSpacePanelsByZOrder() public method

Adjust display order of all UIPanels rendering in worldspace by their z order.
public SortWorldSpacePanelsByZOrder ( int panelSortingOrder ) : void
panelSortingOrder int Only UIPanel.sortingOrder equals to this value will be involve in this sorting
return void
		public void SortWorldSpacePanelsByZOrder(int panelSortingOrder)
		{
			if (sTempList1 == null)
			{
				sTempList1 = new List<DisplayObject>();
				sTempList2 = new List<int>();
			}

			int numChildren = Stage.inst.numChildren;
			for (int i = 0; i < numChildren; i++)
			{
				Container obj = Stage.inst.GetChildAt(i) as Container;
				if (obj == null || obj.renderMode != RenderMode.WorldSpace || obj._panelOrder != panelSortingOrder)
					continue;

				//借用一下tmpBounds
				obj._internal_bounds.x = obj.cachedTransform.position.z;
				obj._internal_bounds.y = i;

				sTempList1.Add(obj);
				sTempList2.Add(i);
			}

			sTempList1.Sort(CompareZ);

			ChangeChildrenOrder(sTempList2, sTempList1);

			sTempList1.Clear();
			sTempList2.Clear();
		}

Usage Example

Example #1
0
 static public int SortWorldSpacePanelsByZOrder(IntPtr l)
 {
     try {
         FairyGUI.Stage self = (FairyGUI.Stage)checkSelf(l);
         System.Int32   a1;
         checkType(l, 2, out a1);
         self.SortWorldSpacePanelsByZOrder(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
All Usage Examples Of FairyGUI.Stage::SortWorldSpacePanelsByZOrder