public List <DialogueData> Deserialize(Action <NodeConnectionPoint> nodeConnectionPointClicked, Action <DialogueNode> removeNode, Action <DialogueNode> nodeActorIDChanged, Action <NodeConnection> removeNodeConnection) { List <DialogueData> dialogues = new List <DialogueData>(); for (int i = 0; i < dialogueDataSerializers.Length; i++) { DialogueData dialogue = new DialogueData(dialogueDataSerializers[i].id, dialogueDataSerializers[i].name); // Deserialize Nodes. DialogueNodeSerializer[] nodeSerializers = dialogueDataSerializers[i].nodes; for (int j = 0; j < nodeSerializers.Length; j++) { DialogueNode node = new DialogueNode(nodeSerializers[j], nodeConnectionPointClicked, removeNode, nodeActorIDChanged); dialogue.nodes.Add(node); } // Deserialize Connections. NodeConnectionSerializer[] connectionSerializers = dialogueDataSerializers[i].connections; for (int j = 0; j < connectionSerializers.Length; j++) { int inNodeID = connectionSerializers[j].inNodeID; int outNodeID = connectionSerializers[j].outNodeID; DialogueNode inNode = dialogue.GetNodeByID(inNodeID); DialogueNode outNode = dialogue.GetNodeByID(outNodeID); NodeConnection connection = new NodeConnection(inNode.inPoint, outNode.outPoint, removeNodeConnection); dialogue.connections.Add(connection); } dialogues.Add(dialogue); } return(dialogues); }