/// <summary> /// Create a new window for the provided character. /// </summary> public static void CreateNewWindow(IDialogSpeaker dialogCharacter) { kEditingDialog = dialogCharacter.dialogAsset; NodeGraphEditorWindow window = GetWindow <NodeGraphEditorWindow>(); window.titleContent = new GUIContent("Node Dialog Editor"); window.OnEnable(); }
public void ExecuteToPause(IDialogSpeaker speaker) { // Find if this character has a return point saved. // Note: this currently does not support saving/loading, but can be adjusted to add it! DialogBaseNode currentNode; if (!mNodeMap.TryGetValue(speaker, out currentNode)) { currentNode = speaker.dialogAsset.rootNode; } ExecutePreEvents(currentNode); // Check if this is a statement node first DialogStatementNode statement = currentNode as DialogStatementNode; if (statement != null) { // Execute it if it is speaker.HandleStatement(statement.userVariableDictionary, statement.GetLocalizedStatement(this)); // Save our return point as the next node, or clear our save if there isn't one (we return to the start) if (statement.outConnections.Count > 0) { mNodeMap[speaker] = statement.outConnections[0].outNode as DialogBaseNode; } else { mNodeMap.Remove(speaker); } } else { // Not a statement, check if this is a choice node. DialogChoiceNode choice = currentNode as DialogChoiceNode; if (choice != null) { // Execute if it is speaker.HandlePlayerChoice(choice.userVariableDictionary, choice.GetLocalizedPrompt(this), choice.outConnections, a => { mNodeMap[speaker] = a.outNode as DialogBaseNode; }); } } ExecutePostEvents(currentNode); }