Ejemplo n.º 1
0
        public void AddNode(DialogueNode newNode)
        {
            //Generate flat list of all children nodes, for easier parsing
            //(only useful when adding a node with children, will not do much when adding a single node)
            var newListNodes = new List <DialogueNode>();

            ParseNodeChildren(newNode, false, ref newListNodes);

            //Resolve goto links while old IDs are still available (first resolve inside copied sequence, then link to existing nodes)
            foreach (var node in newListNodes)
            {
                if (node is DialogueNodeGoto)
                {
                    DialogueNodeGoto nodeGoto = node as DialogueNodeGoto;
                    if (nodeGoto.GotoID != DialogueNode.ID_NULL)
                    {
                        nodeGoto.Goto = newListNodes.Find(item => item.ID == nodeGoto.GotoID);
                        if (nodeGoto.Goto == null)
                        {
                            nodeGoto.Goto = GetNodeByID(nodeGoto.GotoID);
                        }
                        nodeGoto.GotoID = DialogueNode.ID_NULL;
                    }
                }
            }

            //Generate new IDs for all new nodes
            foreach (var node in newListNodes)
            {
                node.ID = GenerateID();
                ListNodes.Add(node);
            }
        }
Ejemplo n.º 2
0
 public void AgregarNodo(NodosXbee _nodo)
 {
     ListNodes.Add(_nodo);
     NodoAgregadoEvent(_nodo);
 }