public void ReplaceWith(DlogGraphData otherGraphData) { // Remove everything var removedNodesGuid = new List <string>(); removedNodesGuid.AddRange(nodes.Select(node => node.GUID)); foreach (var node in removedNodesGuid) { RemoveNode(nodeDictionary[node]); } var removedProperties = new List <AbstractProperty>(properties); foreach (var prop in removedProperties) { RemoveProperty(prop); } // Add back everything foreach (var node in otherGraphData.nodes) { AddNode(node); } foreach (var edge in otherGraphData.edges) { AddEdge(edge); } foreach (var property in otherGraphData.properties) { AddProperty(property); } }
public override void Action(int instanceId, string pathName, string resourceFile) { var dlogGraph = new DlogGraphData(); var dlogObject = CreateInstance <DlogGraphObject>(); dlogObject.Initialize(dlogGraph); dlogObject.DlogGraph.AssetGuid = AssetDatabase.GetAssetPath(instanceId); dlogObject.DlogGraph.DialogueGraphVersion = DlogVersion.Version.GetValue(); dlogObject.AssetGuid = dlogObject.DlogGraph.AssetGuid; DlogUtility.CreateFile(pathName, dlogObject, false); AssetDatabase.ImportAsset(pathName); }