-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStory.cs
More file actions
40 lines (33 loc) · 1.11 KB
/
Story.cs
File metadata and controls
40 lines (33 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.IO;
namespace CYOA
{
public class Story
{
private string _root;
public Story(string rootFolder)
{
_root = rootFolder;
string link = "GameData/" + _root + "/MainMenu";
while (File.Exists(link +".txt"))
{
Console.Clear();
Passage passage = new Passage(link + ".txt");
link = (link + passage.Display()).ParsePath();
if (!File.Exists(link + ".txt"))
link = link.Substring(0, link.LastIndexOf("/")) + "/MainMenu";
}
if (link.Substring(link.LastIndexOf('/') + 1) != "ERROR")
{
Console.Clear();
var bookmarkCode = Bookmark.ToBookmark(link, _root);
string message = "Game Over";
message += bookmarkCode != "" ? $"\n\nBookmark Code: {bookmarkCode}" : "";
Passage p = new Passage(message, null);
link = p.Display();
Console.ReadLine();
}
}
}
}