Last active
November 26, 2017 05:06
-
-
Save Hiroku/7b3f8ad72b325cdc8dced9d5273cfc81 to your computer and use it in GitHub Desktop.
Example Dialogue construction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ArrayList<Dialogue> dialogues = new ArrayList<Dialogue>(); | |
dialogues.add(Dialogue.builder() | |
.setName("Gus") | |
.setText("Hello, friend") | |
.build()); | |
dialogues.add(Dialogue.builder() | |
.setName("") | |
.setText("What will you say?") | |
.addChoice(Choice.builder() | |
.setText("Hello, Gus") | |
// These responses may easily have further choices for elaborate dialogue trees. There is no imposed limit. | |
.setHandle(e -> e.reply(Dialogue.builder() | |
.setName("Gus") | |
.setText("Enjoy your day!") | |
.build())) | |
.build()) | |
.addChoice(Choice.builder() | |
.setText("Shut up, Gus.") | |
.setHandle(e -> e.reply(Dialogue.builder() | |
.setName("Gus") | |
.setText("Wow, ok then.") | |
.build())) | |
.build()) | |
.build()); | |
// Will open the dialogue GUI immediately. | |
Dialogue.setPlayerDialogueData(player, dialogues, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment