public NodeAction createNodeAction(DialoguePath path = null, Action action = null) { //If no path, if (path == null) { //create a path path = createContainerNode().path; } NodeDialogue container = containers.First(cn => cn.path == path); //Add a node to the path if (action == null) { //Set default variable name string defaultVarName = dialogueData.Variables.Last(); if (path.conditions.Count > 0) { defaultVarName = path.conditions[0].variableName; } //Create new action action = new Action(defaultVarName); action.path = path; path.actions.Add(action); } NodeAction node = new NodeAction(action); container.AddNode(node); return(node); }
/// <summary> /// This method makes a UI node for the given quote in the given dialogue path /// </summary> /// <param name="path"></param> /// <param name="quote"></param> /// <returns></returns> public NodeQuote createNodeQuote(DialoguePath path, Quote quote) { NodeQuote node = new NodeQuote(quote); NodeDialogue container = containers.First(cn => cn.path == path); container.AddNode(node); return(node); }
public NodeDialogue createContainerNode(DialoguePath path = null) { if (path == null) { path = new DialoguePath(); dialogueData.dialogues.Add(path); } NodeDialogue container = new NodeDialogue(path); containers.Add(container); dialoguePanel.Controls.Add(container); return(container); }
/// <summary> /// Delete the given NodeDialogue or Node /// </summary> /// <param name="c"></param> public void delete(Control c) { if (c is Node) { Node node = (Node)c; node.data.path.remove(node.data); node.Dispose(); } else if (c is NodeDialogue) { NodeDialogue container = (NodeDialogue)c; dialogueData.dialogues.Remove(container.path); containers.Remove(container); container.Dispose(); } }
public NodeCondition createNodeCondition(DialoguePath path = null, Condition condition = null) { //If no path, if (path == null) { //create a path path = createContainerNode().path; } NodeDialogue container = containers.First(cn => cn.path == path); //Add a node to the path if (condition == null) { //Find template Condition template = null; if (containers.Count > 0) { List <NodeDialogue> templateContainers = containers .Where(c => c.path.conditions.Count > 0).ToList(); if (templateContainers.Count > 0) { template = templateContainers.Last() .path.conditions[0]; } } //Create condition if (template != null) { condition = new Condition( template.variableName, template.testType, template.testValue + 1 ); } else { condition = new Condition(dialogueData.Variables.Last()); } condition.path = path; path.conditions.Add(condition); } NodeCondition node = new NodeCondition(condition); container.AddNode(node); return(node); }