Пример #1
0
        public static void RenderNode(DialogueEditor editor, BaseNode node)
        {
            NodeGUI gui = editor.GetNodeGUI(node);

            if (gui == null)
            {
                gui    = new NodeGUI(node);
                gui.id = editor.nextID++;
                editor.nodes.Add(gui.id, gui);
            }
            gui.RenderNode(editor);
        }
        public void Remove(DialogueEditor editor)
        {
            node.Remove();

            if (!node.isLink)
            {
                foreach (Link link in ((Node)node).Links)
                {
                    editor.GetNodeGUI(link).DestroyGUI(editor);
                }
            }

            DestroyGUI(editor);
        }
        private static void RenderNode(DialogueEditor editor, BaseNode node, List <NodeGUI> removeNodes)
        {
            NodeGUI gui = editor.GetNodeGUI(node);

            if (gui != null && gui.node.Data == null)
            {
                Debug.Log("trying to render a node with null data. destroying...");
                removeNodes.Add(gui);
            }
            else
            {
                if (gui == null)
                {
                    gui    = new NodeGUI(node);
                    gui.id = editor.nextID++;
                    editor.nodes.Add(gui.id, gui);
                }
                gui.RenderNode(editor, removeNodes);
            }
        }
 /// <summary>
 /// Expand or collapse this node and all its children, recursively.
 /// </summary>
 public void ExpandAll(bool expand, DialogueEditor editor)
 {
     if (!node.isLink && ((Node)node).Children.Count > 0)
     {
         if (expand)
         {
             editor.RevealChildren(node);
         }
         else
         {
             expanded = expand;
             foreach (BaseNode child in ((Node)node).Children)
             {
                 NodeGUI gui = editor.GetNodeGUI(child);
                 if (gui != null)
                 {
                     gui.ExpandAll(expand, editor);
                 }
             }
         }
     }
 }