Exemplo n.º 1
0
        private BaseNode dfs(XmlElement node)
        {
            if(node.Name=="SubRootNode")
            {
                XmlElement e = (XmlElement)node;
                string sub_file_name = System.IO.Path.GetFullPath(System.IO.Path.Combine(Application.dataPath, "data/"+e.GetAttribute("file")));
                RootNode sub_root = new RootNode(Convert.ToSingle(node.GetAttribute("pos_x"))+this.start_x,this.start_y+Convert.ToSingle(node.GetAttribute("pos_y")));
                sub_root.Load(sub_file_name);
                this.nodes.AddRange(sub_root.nodes);
                return sub_root.root_node;
            }

            BaseNode current = new BaseNode(Convert.ToSingle(node.GetAttribute("pos_x"))+this.start_x,this.start_y+Convert.ToSingle(node.GetAttribute("pos_y")));
            foreach (XmlNode n in node.ChildNodes) {
                if(n.NodeType==XmlNodeType.Element)
                {
                    BaseNode c = dfs((XmlElement)n);
                    if(c!=null)
                        current.AddTarget(c);
                }
            }
            nodes.Add (current);
            return current;
        }
Exemplo n.º 2
0
        private void LoadNodeCallback(object obj)
        {
            RootNode r = new RootNode (0,0);
            r.Load("data/file.xml");

            foreach (BaseNode n in r.nodes) {
                nodes.Add(n);
            }
            Debug.Log("the node size is ..."+nodes.Count);
            Repaint ();
        }