示例#1
0
    public void Awake()
    {
        string[] dialogueOptionIds = getDialogueOptionIds(4);

        DialogueHolder       dialogueHolder       = new DialogueHolder();
        DialogueOptionHolder dialogueOptionHolder = new DialogueOptionHolder();

        Dialogue rootDialogue = createDialogue("This is a test you butt!", dialogueOptionIds);
        Dialogue lastDialogue = createDialogue("I new dialogue message you say? Well it worked!", null);

        dialogueHolder.addDialogue(rootDialogue);
        dialogueHolder.addDialogue(lastDialogue);

        dialogueOptionHolder.addDialogueOption(createDialogueOption("Yes!", dialogueOptionIds[0], lastDialogue.id));
        dialogueOptionHolder.addDialogueOption(createDialogueOption("No!", dialogueOptionIds[1], lastDialogue.id));
        dialogueOptionHolder.addDialogueOption(createDialogueOption("Uh, f**k you!", dialogueOptionIds[2], lastDialogue.id));
        dialogueOptionHolder.addDialogueOption(createDialogueOption("...", dialogueOptionIds[3], lastDialogue.id));

        FileUtils.writeFile(fileName + ".DialogueHolder.json", dialogueHolder.toJsonString());
        FileUtils.writeFile(fileName + ".DialogueOptionHolder.json", dialogueOptionHolder.toJsonString());


        dialogueController.setDialogueHolder(dialogueHolder);
        dialogueController.setDialogueOptionHolder(dialogueOptionHolder);
        dialogueController.setDialogue(rootDialogue.id);
        dialogueController.enableUI(true);
    }