private static ArticyData.Node ConvertNode(ArticyData articyData, NodeType node) { ArticyData.Node articyDataNode = new ArticyData.Node(); if (node != null) { // Record node type: articyDataNode.id = node.IdRef; articyDataNode.type = ConvertNodeType(node.Type); // If this is a TextObject in our TextTableDocument, add it to the text table data: if (isInTextTableDocument && string.Equals(node.Type, "TextObject")) { var textObject = LookupByIdRef(node.IdRef) as TextObjectType; if (textObject != null) { articyData.textTableFields.Add(GetDefaultLocalizedString(textObject.DisplayName)); } } // If a dialogue and inside a document, record that it's in a document: if (articyDataNode.type == ArticyData.NodeType.Dialogue && documentDepth > 0) { var dialogue = articyData.dialogues.ContainsKey(node.IdRef) ? articyData.dialogues[node.IdRef] : null; if (dialogue != null) { dialogue.isDocument = true; } } // Recurse through children: if (node.Node != null) { if (node.Type == "Document") { documentDepth++; if (!string.IsNullOrEmpty(_prefs.TextTableDocument)) { var document = LookupByIdRef(node.IdRef) as DocumentType; if (document != null && string.Equals(GetDefaultLocalizedString(document.DisplayName), _prefs.TextTableDocument)) { isInTextTableDocument = true; } } } foreach (NodeType childNode in node.Node) { articyDataNode.nodes.Add(ConvertNode(articyData, childNode)); } if (node.Type == "Document") { documentDepth--; isInTextTableDocument = false; } } } return(articyDataNode); }
private static ArticyData.Node ConvertNode(NodeType node, string indent) { ArticyData.Node articyDataNode = new ArticyData.Node(); if (node != null) { articyDataNode.id = node.Guid; articyDataNode.type = ConvertNodeType(node.Type); //Debug.Log(string.Format("{0}{1} {2}", indent, node.Guid, node.Type.ToString())); if (node.Node != null) { foreach (NodeType childNode in node.Node) { articyDataNode.nodes.Add(ConvertNode(childNode, " " + indent)); } } } return articyDataNode; }
private static ArticyData.Node ConvertNode(NodeType node) { ArticyData.Node articyDataNode = new ArticyData.Node(); if (node != null) { articyDataNode.id = node.IdRef; articyDataNode.type = ConvertNodeType(node.Type); if (node.Node != null) { foreach (NodeType childNode in node.Node) { articyDataNode.nodes.Add(ConvertNode(childNode)); } } } return(articyDataNode); }
private static ArticyData.Node ConvertNode(ArticyData articyData, NodeType node) { ArticyData.Node articyDataNode = new ArticyData.Node(); if (node != null) { // Record node type: articyDataNode.id = node.IdRef; articyDataNode.type = ConvertNodeType(node.Type); // If a dialogue and inside a document, record that it's in a document: if (articyDataNode.type == ArticyData.NodeType.Dialogue && documentDepth > 0) { var dialogue = articyData.dialogues.ContainsKey(node.IdRef) ? articyData.dialogues[node.IdRef] : null; if (dialogue != null) { dialogue.isDocument = true; } } // Recurse through children: if (node.Node != null) { if (node.Type == "Document") { documentDepth++; } foreach (NodeType childNode in node.Node) { articyDataNode.nodes.Add(ConvertNode(articyData, childNode)); } if (node.Type == "Document") { documentDepth--; } } } return(articyDataNode); }
private static ArticyData.Node ConvertNode(NodeType node) { ArticyData.Node articyDataNode = new ArticyData.Node(); if (node != null) { articyDataNode.id = node.Id; articyDataNode.type = ConvertNodeType(node.Type); if (node.Node != null) { foreach (NodeType childNode in node.Node) { articyDataNode.nodes.Add(ConvertNode(childNode)); } } } return articyDataNode; }