コード例 #1
0
    /// <summary>
    /// Get the current list of the grid's children.
    /// </summary>

    public List <Transform> GetChildList()
    {
        Transform        myTrans = transform;
        List <Transform> list    = new List <Transform>();

        for (int i = 0; i < myTrans.childCount; ++i)
        {
            Transform t = myTrans.GetChild(i);

            if (!hideInactive || (t && t.gameObject.activeSelf))
            {
                if (!UIDragDropItem.IsDragged(t.gameObject))
                {
                    list.Add(t);
                }
            }
        }

        // Sort the list using the desired sorting logic
        if (sorting != Sorting.None && arrangement != Arrangement.CellSnap)
        {
            if (sorting == Sorting.Alphabetic)
            {
                list.Sort(SortByName);
            }
            else if (sorting == Sorting.Horizontal)
            {
                list.Sort(SortHorizontal);
            }
            else if (sorting == Sorting.Vertical)
            {
                list.Sort(SortVertical);
            }
            else if (onCustomSort != null)
            {
                list.Sort(onCustomSort);
            }
            else
            {
                Sort(list);
            }
        }
        return(list);
    }
コード例 #2
0
    // Token: 0x06000210 RID: 528 RVA: 0x00017C70 File Offset: 0x00015E70
    public List <Transform> GetChildList()
    {
        Transform        transform = base.transform;
        List <Transform> list      = new List <Transform>();

        for (int i = 0; i < transform.childCount; i++)
        {
            Transform child = transform.GetChild(i);
            if ((!this.hideInactive || (child && child.gameObject.activeSelf)) && !UIDragDropItem.IsDragged(child.gameObject))
            {
                list.Add(child);
            }
        }
        if (this.sorting != UIGrid.Sorting.None && this.arrangement != UIGrid.Arrangement.CellSnap)
        {
            if (this.sorting == UIGrid.Sorting.Alphabetic)
            {
                list.Sort(new Comparison <Transform>(UIGrid.SortByName));
            }
            else if (this.sorting == UIGrid.Sorting.Horizontal)
            {
                list.Sort(new Comparison <Transform>(UIGrid.SortHorizontal));
            }
            else if (this.sorting == UIGrid.Sorting.Vertical)
            {
                list.Sort(new Comparison <Transform>(UIGrid.SortVertical));
            }
            else if (this.onCustomSort != null)
            {
                list.Sort(this.onCustomSort);
            }
            else
            {
                this.Sort(list);
            }
        }
        return(list);
    }