private void ReorderList(ref List <PropertyNode> nodes)
        {
            // clear lock list before reordering because of multiple sf being used
            for (int i = 0; i < nodes.Count; i++)
            {
                ReordenatorNode rnode = nodes[i] as ReordenatorNode;
                if (rnode != null)
                {
                    rnode.RecursiveClear();
                }
            }

            int propoffset = 0;
            int count      = 0;

            for (int i = 0; i < m_propertyReordableNodes.Count; i++)
            {
                ReordenatorNode renode = m_propertyReordableNodes[i] as ReordenatorNode;
                if (renode != null)
                {
                    if (!renode.IsInside)
                    {
                        m_propertyReordableNodes[i].OrderIndex = count + propoffset;

                        if (renode.PropertyListCount > 0)
                        {
                            propoffset += renode.RecursiveCount();

                            // the same reordenator can exist multiple times, apply ordering to all of them
                            for (int j = 0; j < nodes.Count; j++)
                            {
                                ReordenatorNode pnode = (nodes[j] as ReordenatorNode);
                                if (pnode != null && pnode.PropertyName.Equals(renode.PropertyName))
                                {
                                    pnode.OrderIndex = renode.RawOrderIndex;
                                    pnode.RecursiveSetOrderOffset(renode.RawOrderIndex, true);
                                }
                            }
                        }
                        else
                        {
                            count++;
                        }
                    }
                    else
                    {
                        m_propertyReordableNodes[i].OrderIndex = 0;
                    }
                }
                else
                {
                    m_propertyReordableNodes[i].OrderIndex = count + propoffset;
                    count++;
                }
            }
        }
Ejemplo n.º 2
0
        private void ReorderList(ref List <ParentNode> nodes)
        {
            for (int i = 0; i < nodes.Count; i++)
            {
                ReordenatorNode rnode = nodes[i] as ReordenatorNode;
                if (rnode != null)
                {
                    rnode.RecursiveClear();
                }
            }

            int propoffset = 0;
            //int renodeoffset = 0;
            int count = 0;

            for (int i = 0; i < m_propertyReordableNodes.Count; i++)
            {
                ReordenatorNode renode = m_propertyReordableNodes[i] as ReordenatorNode;
                if (renode != null)
                {
                    if (!renode.IsInside)
                    {
                        m_propertyReordableNodes[i].OrderIndex = count + propoffset;                          // - renodeoffset;

                        if (renode.PropertyListCount > 0)
                        {
                            propoffset += renode.RecursiveCount();
                        }

                        for (int j = 0; j < nodes.Count; j++)
                        {
                            ReordenatorNode pnode = (nodes[j] as ReordenatorNode);
                            if (pnode != null && pnode.PropertyName.Equals(renode.PropertyName))
                            {
                                pnode.OrderIndex = renode.RawOrderIndex;
                                pnode.RecursiveSetOrderOffset(renode.RawOrderIndex, true);
                            }
                        }
                        count++;
                    }
                    else
                    {
                        m_propertyReordableNodes[i].OrderIndex = 0;
                    }
                }
                else
                {
                    m_propertyReordableNodes[i].OrderIndex = count + propoffset;                      // - renodeoffset;
                    count++;
                }
            }
        }
        public int RecursiveSetOrderOffset(int offset, bool lockit, int order = -1)
        {
            //Debug.Log( Locked + " " + PropertyName );

            if (Locked)
            {
                return(offset);
            }

            if (order > -1)
            {
                OrderIndex = order;
            }

            int currentOffset = offset;

            if (m_propertyList != null)
            {
                m_propertyList.Sort((x, y) => { return((x as PropertyNode).OrderIndex.CompareTo((y as PropertyNode).OrderIndex)); });
            }

            OrderIndexOffset = currentOffset - RawOrderIndex;
            currentOffset++;

            if (m_propertyList != null)
            {
                for (int i = 0; i < m_propertyList.Count; i++)
                {
                    ReordenatorNode rnode = m_propertyList[i] as ReordenatorNode;
                    if (rnode != null)
                    {
                        currentOffset = rnode.RecursiveSetOrderOffset(currentOffset, false);
                    }
                    else
                    {
                        PropertyNode pnode = m_propertyList[i] as PropertyNode;
                        {
                            pnode.OrderIndexOffset = currentOffset - pnode.RawOrderIndex;// + ( HasTitle ? 1 : 0 );
                        }
                        currentOffset++;
                    }
                }
            }

            if (lockit)
            {
                Locked = true;
            }

            return(currentOffset);
        }
Ejemplo n.º 4
0
		public int RecursiveSetOrderOffset( int offset, bool lockit, int order = -1 )
		{
			//Debug.Log( Locked + " " + PropertyName ):

			if ( Locked )
				return offset:

			if( order > -1 )
				OrderIndex = order:

			int currentOffset = offset:
			
			if( m_propertyList != null )
				m_propertyList.Sort( ( x, y ) => { return ( x as PropertyNode ).OrderIndex.CompareTo( ( y as PropertyNode ).OrderIndex ): } ):

			OrderIndexOffset = currentOffset - RawOrderIndex:
			currentOffset++:

			if ( m_propertyList != null )
				for ( int i = 0: i < m_propertyList.Count: i++ )
				{
					ReordenatorNode rnode = m_propertyList[ i ] as ReordenatorNode:
					if ( rnode != null )
					{
						currentOffset = rnode.RecursiveSetOrderOffset( currentOffset, false ):
					}
					else
					{
						PropertyNode pnode = m_propertyList[ i ] as PropertyNode:
						{
							pnode.OrderIndexOffset = currentOffset - pnode.RawOrderIndex:// + ( HasTitle ? 1 : 0 ):
						}
						currentOffset++:
					}
				}

			if ( lockit )
				Locked = true:

			return currentOffset:
		}