public void Export(BaseNode rootNode, string configName) { string configPath = BTUtils.GetGenPath() + configName + ".json"; string fullConfigPath = BTUtils.GetGenPath() + configName + "_full.json"; string nodeMapPath = BTUtils.GetGenPath() + configName + "_node_map.json"; Dictionary <string, BaseNodeData> baseNodeDataDict = new Dictionary <string, BaseNodeData>(); Dictionary <string, MergePyData> dataDict = new Dictionary <string, MergePyData>(); BTUtils.DumpTree(rootNode, (BaseNode node) => { BaseNodeData nodeData = NodeDataManager.Get(node); if (nodeData != null) { nodeData.Serialize(node); dataDict[node.name] = new MergePyData(node); baseNodeDataDict[node.name] = nodeData; } }); BTUtils.SaveJsonToFile <Dictionary <string, MergePyData> >(dataDict, configPath); BaseNodeData rootNodeData = NodeDataManager.Get(rootNode); BTUtils.SaveJsonToFile <BaseNodeData>(rootNodeData, fullConfigPath); BTUtils.SaveJsonToFile <Dictionary <string, BaseNodeData> >(baseNodeDataDict, nodeMapPath); }
public static void SaveCurrentNode() { if (selectedNode != null) { BaseNodeData nodeData = NodeDataManager.Get(selectedNode); if (nodeData != null) { nodeData.Serialize(selectedNode); } } }