/// <summary> /// Parse the flow chart node /// </summary> /// <remarks> /// The name of this method might be a little misleading, since this method actually parses the text /// split by eager execution blocks, while the node structure are defined by scripts in the eager execution /// block. A new node is created when the 'label' instruction is invoked in the eager execution block, and its /// content ends when either 'branch' or 'jump' instruction is called. Current implementation (2018/07/16) /// constructs flow chart tree with a state machine, i.e. parsed flow chart node text are pushed to /// the current node. /// </remarks> /// <param name="flowChartNodeText"></param> private void ParseFlowChartNodeText(string flowChartNodeText) { if (flowChartNodeText == null) { return; } flowChartNodeText = flowChartNodeText.Trim(); if (string.IsNullOrEmpty(flowChartNodeText)) { return; } if (currentNode == null) { throw new ArgumentException("Nova: Dangling node text " + flowChartNodeText); } string[] dialogueEntryTexts = Regex.Split(flowChartNodeText, EmptyLinePattern); if (stateLocale == I18n.DefaultLocale) { var entries = ScriptDialogueEntryParser.ParseDialogueEntries(dialogueEntryTexts); currentNode.SetDialogueEntries(entries); } else { var entries = ScriptDialogueEntryParser.ParseLocalizedDialogueEntries(dialogueEntryTexts); currentNode.AddLocaleForDialogueEntries(stateLocale, entries); } }
private void AddDialogueChunks(IReadOnlyList <Chunk> chunks) { if (currentNode == null) { throw new ArgumentException("Nova: Dangling node text."); } if (stateLocale == I18n.DefaultLocale) { var entries = ScriptDialogueEntryParser.ParseDialogueEntries(chunks, hiddenCharacterNames); currentNode.SetDialogueEntries(entries); } else { var entries = ScriptDialogueEntryParser.ParseLocalizedDialogueEntries(chunks); currentNode.AddLocalizedDialogueEntries(stateLocale, entries); } }