public void Init(GraphConversationDataControl conversation) { editor = EditorWindow.GetWindow <ConversationEditorWindow>(); editor.conversation = (GraphConversation)conversation.getConversation(); ConversationNodeEditorFactory.Intance.ResetInstance(); InitWindows(); }
public override bool duplicateElement(DataControl dataControl) { if (!(dataControl is GraphConversationDataControl)) { return(false); } //try //{ GraphConversation newElement = (GraphConversation)(((GraphConversation)(dataControl.getContent())).Clone()); string id = newElement.getId(); int i = 1; do { id = newElement.getId() + i; i++; } while (!controller.isElementIdValid(id, false)); newElement.setId(id); conversationsList.Add(newElement); conversationsDataControlList.Add(new GraphConversationDataControl(newElement)); controller.getIdentifierSummary().addConversationId(id); string oldId = ((GraphConversation)(dataControl.getContent())).getId(); /*bool posConfigured = ConversationConfigData.isConversationConfig( oldId ); * if (posConfigured) { * for (int j = 0; j < newElement.getAllNodes( ).size( ); j++) { * int centerX = ConversationConfigData.getNodeX( oldId, j * ); * int centerY = ConversationConfigData.getNodeY( oldId, j ); * ConversationConfigData.setNodeX( id, j, centerX ); * ConversationConfigData.setNodeY( id, j, centerY ); * } * }*/ GraphConversationDataControl g = (GraphConversationDataControl)dataControl; for (int j = 0; j < g.getAllNodes().Count; j++) { int centerX = g.getEditorX(g.getAllNodes()[j]); int centerY = g.getEditorY(g.getAllNodes()[j]); newElement.getAllNodes()[j].setEditorX(centerX); newElement.getAllNodes()[j].setEditorY(centerY); } return(true); }