本文整理汇总了Java中com.bladecoder.ink.runtime.Story.chooseChoiceIndex方法的典型用法代码示例。如果您正苦于以下问题:Java Story.chooseChoiceIndex方法的具体用法?Java Story.chooseChoiceIndex怎么用?Java Story.chooseChoiceIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bladecoder.ink.runtime.Story
的用法示例。
在下文中一共展示了Story.chooseChoiceIndex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ifElseExtText3
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- evaluate an extended else statement with text and divert at the end"
*/
@Test
public void ifElseExtText3() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/conditional/ifelse-ext-text3.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
Assert.assertEquals(1, text.size());
Assert.assertEquals("This is text 3.", text.get(0));
Assert.assertEquals(1, story.getCurrentChoices().size());
story.chooseChoiceIndex(0);
TestUtils.nextAll(story, text);
Assert.assertEquals(2, text.size());
Assert.assertEquals("This is the end.", text.get(1));
}
示例2: paramMulti
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- handle passing multiple values as parameters in a divert"
*/
@Test
public void paramMulti() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/knot/param-multi.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
story.chooseChoiceIndex(0);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(1, text.size());
Assert.assertEquals("You give 1 or 2 dollars. Hmm.", text.get(0));
}
示例3: condText2
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- work with conditional content which is not only logic (example 2)"
*/
@Test
public void condText2() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/conditional/condtext.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
story.chooseChoiceIndex(1);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(2, text.size());
Assert.assertEquals("I stared at Monsieur Fogg. \"But there must be a reason for this trip,\" I observed.", text.get(0));
}
示例4: mixedChoice
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- be suppressed in the text flow using the [] syntax"
*/
@Test
public void mixedChoice() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/choices/mixed-choice.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
Assert.assertEquals("Hello back!", story.getCurrentChoices().get(0).getText());
story.chooseChoiceIndex(0);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(2, text.size());
Assert.assertEquals("Hello right back to you!", text.get(0));
Assert.assertEquals("Nice to hear from you.", text.get(1));
}
示例5: varyingChoice
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- disappear when used if they are a once-only choice"
*/
@Test
public void varyingChoice() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/choices/varying-choice.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
Assert.assertEquals(2, story.getCurrentChoices().size());
story.chooseChoiceIndex(0);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(1, story.getCurrentChoices().size());
Assert.assertEquals("The man with the briefcase?", story.getCurrentChoices().get(0).getText());
}
示例6: stickyChoice
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- not disappear when used if they are a sticky choices"
*/
@Test
public void stickyChoice() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/choices/sticky-choice.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
Assert.assertEquals(2, story.getCurrentChoices().size());
story.chooseChoiceIndex(0);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(2, story.getCurrentChoices().size());
}
示例7: gatherChain
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- form chains of content with multiple gathers"
*/
@Test
public void gatherChain() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/gather/gather-chain.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
Assert.assertEquals(3, story.getCurrentChoices().size());
story.chooseChoiceIndex(1);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(1, text.size());
Assert.assertEquals("I did not pause for breath but kept on running. The road could not be much further! Mackie would have the engine running, and then I'd be safe.", text.get(0));
Assert.assertEquals(2, story.getCurrentChoices().size());
story.chooseChoiceIndex(0);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(2, text.size());
Assert.assertEquals("I reached the road and looked about. And would you believe it?", text.get(0));
Assert.assertEquals("The road was empty. Mackie was nowhere to be seen.", text.get(1));
}
示例8: ifElseExtText2
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- evaluate an extended else statement with text and divert at the end"
*/
@Test
public void ifElseExtText2() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/conditional/ifelse-ext-text2.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
Assert.assertEquals(1, text.size());
Assert.assertEquals("This is text 2.", text.get(0));
Assert.assertEquals(1, story.getCurrentChoices().size());
story.chooseChoiceIndex(0);
TestUtils.nextAll(story, text);
Assert.assertEquals(2, text.size());
Assert.assertEquals("This is the end.", text.get(1));
}
示例9: labelScope
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- allow label references out of scope using the full path id"
*/
@Test
public void labelScope() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/choices/label-scope.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
story.chooseChoiceIndex(0);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(1, story.getCurrentChoices().size());
Assert.assertEquals("Found gatherpoint", story.getCurrentChoices().get(0).getText());
}
示例10: condText1
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- work with conditional content which is not only logic (example 1)"
*/
@Test
public void condText1() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/conditional/condtext.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
story.chooseChoiceIndex(0);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(3, text.size());
Assert.assertEquals("I stared at Monsieur Fogg. \"But surely you are not serious?\" I demanded.", text.get(1));
}
示例11: paramFloats
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- handle passing floats as parameters in a divert"
*
* FIXME: INKLECATE BUG?
*/
@Test
public void paramFloats() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/knot/param-floats.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
story.chooseChoiceIndex(1);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(1, text.size());
Assert.assertEquals("You give 2.5 dollars.", text.get(0));
}
示例12: complexBranching1
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- be usable to branch and join text seamlessly (example 1)"
*/
@Test
public void complexBranching1() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/divert/complex-branching.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
story.chooseChoiceIndex(0);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(2, text.size());
Assert.assertEquals("\"There is not a moment to lose!\" I declared.", text.get(0));
Assert.assertEquals("We hurried home to Savile Row as fast as we could.", text.get(1));
}
示例13: multiline
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- show multiple lines of texts from multiline list blocks"
*/
@Test
public void multiline() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/conditional/multiline.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
Assert.assertEquals(1, text.size());
Assert.assertEquals("At the table, I drew a card. Ace of Hearts.", text.get(0));
story.chooseChoiceIndex(0);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(2, text.size());
Assert.assertEquals("I drew a card. 2 of Diamonds.", text.get(0));
Assert.assertEquals("\"Should I hit you again,\" the croupier asks.", text.get(1));
story.chooseChoiceIndex(0);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(2, text.size());
Assert.assertEquals("I drew a card. King of Spades.", text.get(0));
Assert.assertEquals("\"You lose,\" he crowed.", text.get(1));
}
示例14: multilineDivert
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- allow for embedded diverts"
*/
@Test
public void multilineDivert() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/conditional/multiline-divert.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
Assert.assertEquals(1, text.size());
Assert.assertEquals("At the table, I drew a card. Ace of Hearts.", text.get(0));
story.chooseChoiceIndex(0);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(2, text.size());
Assert.assertEquals("I drew a card. 2 of Diamonds.", text.get(0));
Assert.assertEquals("\"Should I hit you again,\" the croupier asks.", text.get(1));
story.chooseChoiceIndex(0);
text.clear();
TestUtils.nextAll(story, text);
Assert.assertEquals(2, text.size());
Assert.assertEquals("I drew a card. King of Spades.", text.get(0));
Assert.assertEquals("\"You lose,\" he crowed.", text.get(1));
}
示例15: ifElseExtText1
import com.bladecoder.ink.runtime.Story; //导入方法依赖的package包/类
/**
* "- evaluate an extended else statement with text and divert at the end"
*/
@Test
public void ifElseExtText1() throws Exception {
List<String> text = new ArrayList<String>();
String json = TestUtils.getJsonString("inkfiles/conditional/ifelse-ext-text1.ink.json");
Story story = new Story(json);
TestUtils.nextAll(story, text);
Assert.assertEquals(1, text.size());
Assert.assertEquals("This is text 1.", text.get(0));
Assert.assertEquals(1, story.getCurrentChoices().size());
story.chooseChoiceIndex(0);
TestUtils.nextAll(story, text);
Assert.assertEquals(2, text.size());
Assert.assertEquals("This is the end.", text.get(1));
}