// version that creates nodes whose index in the dictionary is the timestamp they contain // NEEDS SECURITY CHECKS void CreateNodesFromYarnfile(List <string> lines) { int nodeTimestamp = 0; int lineCounter = 0; string nodeTemp = ""; foreach (string line in lines) { if (line.Contains("title: ")) { nodeTimestamp = Convert.ToInt32(lines[lineCounter + 1].Replace("tags: ", "").Split('|')[0].Trim()); } nodeTemp += line + "\n"; // stack node if (line == "===\r" || line == "===") // flush node { StorytellingYarnfileNode yarnNode = new StorytellingYarnfileNode(nodeTimestamp, nodeTemp); AddNode(nodeTimestamp, yarnNode); nodeTemp = ""; } lineCounter++; } Nodes.Sort(SortByTimestamp); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////// NARRATIVE EMOTIONAL EVALUATION /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// float GetNodeEffectValue(StorytellingYarnfileNode node) { return(node.GetGlobalEffect()); }
void AddNode(int index, StorytellingYarnfileNode node) { Nodes.Add(new KeyValuePair <int, StorytellingYarnfileNode>(index, node)); }