當前位置: 首頁>>代碼示例>>Java>>正文


Java Story.choosePathString方法代碼示例

本文整理匯總了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));
}
 
開發者ID:bladecoder,項目名稱:blade-ink,代碼行數:30,代碼來源:RuntimeSpecTest.java

示例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));
}
 
開發者ID:bladecoder,項目名稱:blade-ink,代碼行數:31,代碼來源:RuntimeSpecTest.java

示例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());
}
 
開發者ID:bladecoder,項目名稱:blade-ink,代碼行數:30,代碼來源:TagSpecTest.java


注:本文中的com.bladecoder.ink.runtime.Story.choosePathString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。