private void Load() { var nodesDeserialized = XMLOp.Deserialize <List <Node> >(Application.dataPath + "/Editor/NodeV3/nodes.xml"); var connectionsDeserialized = XMLOp.Deserialize <List <Connection> >(Application.dataPath + "/Editor/NodeV3/connections.xml"); nodes = new List <Node>(); connections = new List <Connection>(); foreach (var nodeDeserialized in nodesDeserialized) { nodes.Add(new Node( nodeDeserialized.rect.position, nodeDeserialized.rect.width, nodeDeserialized.rect.height, nodeStyle, selectedNodeStyle, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, nodeDeserialized.inPoint.id, nodeDeserialized.outPoint.id, GetListingByName(nodeDeserialized.title), this ) ); } foreach (var connectionDeserialized in connectionsDeserialized) { var inPoint = nodes.First(n => n.inPoint.id == connectionDeserialized.inPoint.id).inPoint; var outPoint = nodes.First(n => n.outPoint.id == connectionDeserialized.outPoint.id).outPoint; connections.Add(new Connection(inPoint, outPoint, OnClickRemoveConnection)); } }
private void Save() { XMLOp.Serialize(nodes, Application.dataPath + "/Editor/NodeV3/nodes.xml"); XMLOp.Serialize(connections, Application.dataPath + "/Editor/NodeV3/connections.xml"); }