Esempio n. 1
0
        public void _add_node(List <string> nodes, ETreeNodeData data)
        {
            if (nodes.Count == 0)
            {
                Debug.LogError("_add_node" + data.NodeName);
                return;
            }
            else if (nodes.Count == 1)
            {
                if (HasNode(nodes[0]))
                {
                    Debug.LogError("已经存在了这样的节点:" + data.NodeName);
                    return;
                }
                EAbTreeNode new_node = new EAbTreeNode(data);
                _insert_node(new_node);
                return;
            }
            else
            {
                string find_node = nodes[0];
                nodes.RemoveAt(0);

                EAbTreeNode ab_tree_node = _find_node(find_node);
                ab_tree_node._add_node(nodes, data);
            }
        }
Esempio n. 2
0
        public EAbTreeNode _find_node(string node_name)
        {
            int length = _children.Count;

            for (int i = 0; i < length; i++)
            {
                if (_children[i]._data.NodeName == node_name)
                {
                    return(_children[i]);
                }
            }
            EAbTreeNode new_node = new EAbTreeNode(new ETreeNodeData(node_name));

            _insert_node(new_node);
            return(new_node);
        }
Esempio n. 3
0
 public void _insert_node(EAbTreeNode node)
 {
     _children.Add(node);
     node._parent     = this;
     node._node_depth = _node_depth + 1;
 }