/// <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); }
/// <summary> /// Creates a new node for each string in the given array /// Returns the last created node /// </summary> /// <param name="path"></param> /// <param name="textArray"></param> public NodeQuote createNodes(DialoguePath path, string[] textArray) { if (path == null) { path = createContainerNode().path; } NodeQuote lastNode = null; foreach (string text in textArray) { NodeQuote node = createNodeQuote(path); node.Text = text; lastNode = node; } return(lastNode); }
/// <summary> /// Creates a UI Node and a Quote, /// Also creates a DialoguePath if none is provided /// </summary> /// <param name="path"></param> /// <param name="index"></param> /// <returns></returns> public NodeQuote createNodeQuote(DialoguePath path = null, int index = -1) { NodeDialogue container; //If no path, if (path == null) { //create a path container = createContainerNode(); path = container.path; } else { container = containers.First(cn => cn.path == path); } //Add a node to the path Quote quote = new Quote(); quote.path = path; if (index < 0) { path.quotes.Add(quote); } else { path.quotes.Insert(index, quote); } if (quote.Index >= 2) { Quote prevQuote = quote.path.quotes[quote.Index - 2]; quote.characterName = prevQuote.characterName; quote.imageFileName = prevQuote.imageFileName; } NodeQuote node = new NodeQuote(quote); container.AddNode(node); return(node); }