Exemple #1
0
        private UITreeNode CloneTreeNode()
        {
            UITreeNode result = Instantiate(nodePrefab);

            result.transform.SetParent(container);
            return(result);
        }
Exemple #2
0
 public void RemoveItem(UITreeNode treeNode)
 {
     if (null == poolParent)
     {
         poolParent = new GameObject("CachePool").transform;
     }
     treeNode.transform.SetParent(poolParent);
     //treeNode.gameObject.SetActive(false);
     poolList.Add(treeNode);
 }
Exemple #3
0
 protected void CloseChildren()
 {
     for (int i = 0; i < children.Count; i++)
     {
         UITreeNode node = children[i];
         node.RemoveListener();
         node.CloseChildren();
     }
     tree.RemoveItems(children);
     children.Clear();
 }
Exemple #4
0
        public UITreeNode AddItem(UITreeData data, int siblingIndex)
        {
            UITreeNode treeNode = null;

            if (poolList.Count > 0)
            {
                treeNode = poolList[0];
                poolList.RemoveAt(0);
            }
            else
            {
                treeNode = CloneTreeNode();
            }
            treeNode.transform.SetParent(container);
            treeNode.gameObject.SetActive(true);
            treeNode.transform.localScale = Vector3.one;
            treeNode.Inject(data, clickFun);
            treeNode.transform.SetSiblingIndex(siblingIndex + 1);
            return(treeNode);
        }