コード例 #1
0
        List <Progress.Item> GetSiblingItems(Progress.Item item, out int newParentId)
        {
            newParentId = item.parentId;
            if (item.parentId == -1)
            {
                var rootIds = m_TreeView.GetRootIds();
                return(rootIds?.Select(id => m_TreeView.GetItemDataForId <Progress.Item>(id)).ToList());
            }

            if (!m_ContainedItems.Contains(newParentId))
            {
                // If the parent is missing, the item should be put at the root level for now.
                List <int> itemIds;
                if (!m_MissingParents.TryGetValue(item.parentId, out itemIds))
                {
                    itemIds = new List <int>();
                    m_MissingParents.Add(item.parentId, itemIds);
                }

                itemIds.Add(item.id);
                newParentId = -1;
                return(m_TreeView.GetRootIds()?.Select(id => m_TreeView.GetItemDataForId <Progress.Item>(id)).ToList());
            }

            var childrenIds = m_TreeView.viewController.GetChildrenIds(newParentId);

            return(childrenIds?.Select(id => m_TreeView.GetItemDataForId <Progress.Item>(id)).ToList());
        }