Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Load story file
- string storyJson = File.ReadAllText ("Stories/musgraveritual.json");
- StoryModel model = StoryModel.Create (storyJson);
- // Find the saved stitch and fast forward the story's initial stitch:
- string restoredStitchName = "holmesResumedHis"; // load this from disk
- foreach (var stitch in model.Story.Stitches) {
- if (stitch.Name == restoredStitchName) {
- // Fast forward the story to this stitch
- model.Story.InitialStitch = stitch;
- break;
- }
- }
- // Load story into player
- StoryPlayer player = new StoryPlayer (model, new Inklewriter.MarkupConverters.ConsoleMarkupConverter ());
- // Collect all saved flag strings
- List<string> restoredFlagStrings = new List<string> { "a:1", "b:2", "c:3" }; // load this from disk
- List<FlagValue> flags = new List<FlagValue>();
- foreach (var flag in restoredFlagStrings)
- {
- // TODO Convert flag strings into FlagValue objects. There's not a clean API for this,
- // but some code from StoryModel.ProcessFlagSettings could be recycled.
- }
- // Create our first Chunk using the InitialStitch that we previously set,
- // and restore all of its saved flags.
- player.CreateFirstChunkWithFlags(flags);
Add Comment
Please, Sign In to add comment