Пример #1
0
        private uiList_TreeNode Spawn_Node(GameObject gm, uiPanel parent)
        {
            uiList_TreeNode node = Create <uiList_TreeNode>(parent);

            node.tag         = gm;
            node.Title       = gm.name;
            node.onExpanded += Populate_Node;
            node.onClicked  += (uiControl c) =>
            {
                c.Parent.Collapse_All();
                var sel = ((c as uiList_TreeNode).tag as GameObject);
                if (sel != selection)
                {
                    selection = sel;
                }
                else if (!c.isChild)
                {
                    selection = null;
                }

                Update_info();
                if (selection != null)
                {
                    (c as uiList_TreeNode).Expand();
                }
            };
            return(node);
        }
Пример #2
0
 private void Populate_Node(uiList_TreeNode node)
 {
     node.Clear_Children();
     if (node.tag == null)
     {
         return;
     }
     Populate_Single_Node(node);
     foreach (uiList_TreeNode n in node.Get_Children())
     {
         Populate_Single_Node(n);
     }
 }
Пример #3
0
        private void Populate_Single_Node(uiList_TreeNode node)
        {
            node.Clear_Children();
            if (node.tag == null)
            {
                return;
            }
            GameObject gm = (node.tag as GameObject);

            for (int i = 0; i < gm.transform.childCount; i++)
            {
                Transform trans = gm.transform.GetChild(i);
                if (trans.gameObject == trans.parent || trans.parent == null)
                {
                    continue;
                }
                Spawn_Node(trans.gameObject, node);
            }
        }