void Init() { foreach (NovelBranch branch in branches) { if (branch.title == startingBranch) { currentBranch = branch; break; } } if (currentBranch == null) { throw new System.Exception("NovelRunner tried to start the novel, " + "but it was looking to start with " + startingBranch + " and didn't find it."); } }
// Use this for initialization public List <NovelBranch> LoadScript() { //StreamReader reader = new StreamReader("Assets/Resources/LDSCRIPTRRG.script"); StringReader reader = new StringReader(TheDAta.rawDAta); List <FrameFragment> lines = new List <FrameFragment>(); while (reader.Peek() != -1) { string outLine = string.Empty; string line = reader.ReadLine(); line = line.TrimStart(' ', '\t').TrimEnd(' ', '\t'); if (line.StartsWith("//") || line == string.Empty || line.StartsWith("endline")) { outLine = "COMMENT: " + line; } else { lines.Add(Parse(line)); outLine = line; } } List <NovelBranch> branches = new List <NovelBranch>(); while (lines.Count > 0) { NovelBranch branch = ConsumeBranch(ref lines); string log = "BRANCH:" + branch.title + "\n"; foreach (NovelFrame frame in branch.frames) { log += frame + "\n"; } //Debug.Log(log); branches.Add(branch); } return(branches); }