string SerializeGraphElementsCallback(IEnumerable <GraphElement> elements) { var data = new CopyPasteHelper(); foreach (var nodeView in elements.Where(e => e is BaseNodeView)) { var node = ((nodeView) as BaseNodeView).nodeTarget; data.copiedNodes.Add(JsonSerializer.Serialize <BaseNode>(node)); } foreach (var commentBlockView in elements.Where(e => e is CommentBlockView)) { var commentBlock = (commentBlockView as CommentBlockView).commentBlock; data.copiedCommentBlocks.Add(JsonSerializer.Serialize <CommentBlock>(commentBlock)); } ClearSelection(); return(JsonUtility.ToJson(data, true)); }
string SerializeGraphElementsCallback(IEnumerable <GraphElement> elements) { var data = new CopyPasteHelper(); foreach (var nodeView in elements.Where(e => e is BaseNodeView)) { var node = ((nodeView) as BaseNodeView).nodeTarget; data.copiedNodes.Add(JsonSerializer.SerializeNode(node)); } foreach (var groupView in elements.Where(e => e is GroupView)) { var group = (groupView as GroupView).group; data.copiedGroups.Add(JsonSerializer.Serialize(group)); } ClearSelection(); return(JsonUtility.ToJson(data, true)); }
string SerializeGraphElementsCallback(IEnumerable <GraphElement> elements) { var data = new CopyPasteHelper(); foreach (BaseNodeView nodeView in elements.Where(e => e is BaseNodeView)) { data.copiedNodes.Add(JsonSerializer.SerializeNode(nodeView.nodeTarget)); } foreach (GroupView groupView in elements.Where(e => e is GroupView)) { data.copiedGroups.Add(JsonSerializer.Serialize(groupView.group)); } foreach (EdgeView edgeView in elements.Where(e => e is EdgeView)) { data.copiedEdges.Add(JsonSerializer.Serialize(edgeView.serializedEdge)); } ClearSelection(); return(JsonUtility.ToJson(data, true)); }