コード例 #1
0
        public static void Main(string[] args)
        {
            // Load story file
            string     storyJson = File.ReadAllText("Stories/musgraveritual.json");
            StoryModel model     = StoryModel.Create(storyJson);

            // Load story into player
            StoryPlayer player = new StoryPlayer(model, new Inklewriter.MarkupConverters.ConsoleMarkupConverter());

            // Display header
            Console.Clear();
            Console.WriteLine();
            Console.WriteLine(player.Title);
            Console.WriteLine("by " + player.Author);

            // Main loop
            Stitch lastStitch = player.InitialStitch;

            while (lastStitch != null)
            {
                Console.WriteLine();
                DrawHorizontalLine();
                Console.WriteLine();

                var nextChunk = player.CreateChunkForStitch(lastStitch);
                lastStitch = DisplayChunk(nextChunk);
            }
        }
コード例 #2
0
        void Start()
        {
            var resource = Resources.Load(storyName) as TextAsset;

            if (!resource)
            {
                Debug.LogWarning("Inklewriter story could not be loaded: " + storyName);
                return;
            }

            string     storyJson = resource.text;
            StoryModel model     = StoryModel.Create(storyJson);

            this.player = new StoryPlayer(model, new UnityMarkupConverter());

            var firstChunk = player.CreateFirstChunk();

            InstantiateChunk(firstChunk);
        }