本文整理汇总了Java中com.bladecoder.ink.runtime.Story.choosePathString方法的典型用法代码示例。如果您正苦于以下问题:Java Story.choosePathString方法的具体用法?Java Story.choosePathString怎么用?Java Story.choosePathString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bladecoder.ink.runtime.Story
的用法示例。
在下文中一共展示了Story.choosePathString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jumpKnot
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* Jump to knot from code.
*/
@Test
public void jumpKnot() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/runtime/jump-knot.ink.json");
Story story = new Story(json);
story.choosePathString("two");
TestUtils.nextAll(story, text);
Assert.assertEquals("Two", text.get(0));
text.clear();
story.choosePathString("three");
TestUtils.nextAll(story, text);
Assert.assertEquals("Three", text.get(0));
text.clear();
story.choosePathString("one");
TestUtils.nextAll(story, text);
Assert.assertEquals("One", text.get(0));
text.clear();
story.choosePathString("two");
TestUtils.nextAll(story, text);
Assert.assertEquals("Two", text.get(0));
}
示例2: jumpStitch
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* Jump to stitch from code.
*/
@Test
public void jumpStitch() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/runtime/jump-stitch.ink.json");
Story story = new Story(json);
story.choosePathString("two.sthree");
TestUtils.nextAll(story, text);
Assert.assertEquals(1, text.size());
Assert.assertEquals("Two.3", text.get(0));
text.clear();
story.choosePathString("one.stwo");
TestUtils.nextAll(story, text);
Assert.assertEquals("One.2", text.get(0));
text.clear();
story.choosePathString("one.sone");
TestUtils.nextAll(story, text);
Assert.assertEquals("One.1", text.get(0));
text.clear();
story.choosePathString("two.stwo");
TestUtils.nextAll(story, text);
Assert.assertEquals("Two.2", text.get(0));
}
示例3: testTags
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- basic test for tags"
*/
@Test
public void testTags() throws Exception {
String json = TestUtils.getJsonString("inkfiles/tags/tags.ink.json");
Story story = new Story(json);
String[] globalTags = { "author: Joe", "title: My Great Story" };
String[] knotTags = { "knot tag" };
String[] knotTagWhenContinuedTwice = { "end of knot tag" };
String[] stitchTags = { "stitch tag" };
Assert.assertArrayEquals(globalTags, story.getGlobalTags().toArray());
Assert.assertEquals("This is the content\n", story.Continue());
Assert.assertArrayEquals(globalTags, story.getCurrentTags().toArray());
Assert.assertArrayEquals(knotTags, story.tagsForContentAtPath("knot").toArray());
Assert.assertArrayEquals(stitchTags, story.tagsForContentAtPath("knot.stitch").toArray());
story.choosePathString("knot");
Assert.assertEquals("Knot content\n", story.Continue());
Assert.assertArrayEquals(knotTags, story.getCurrentTags().toArray());
Assert.assertEquals("", story.Continue());
Assert.assertArrayEquals(knotTagWhenContinuedTwice, story.getCurrentTags().toArray());
}