Search in sources :

Example 1 with SpeechData

use of main.data.dialogue.SpeechData in project Eidolons by IDemiurge.

the class SpeechBuilder method construct.

private void construct() {
    idToDataMap = new HashMap<>();
    String xml = FileManager.readFile(linesPath);
    Document doc = XML_Converter.getDoc(xml);
    for (Node node : XML_Converter.getNodeList(doc.getFirstChild())) {
        String idString = node.getNodeName();
        int id = StringMaster.getInteger(idString.replace(DialogueLineFormatter.ID, ""));
        if (node.hasChildNodes()) {
            SpeechData data = new SpeechData();
            for (Node subNode : XML_Converter.getNodeList(node)) {
                String value = subNode.getTextContent();
                value = XML_Formatter.restoreXmlNodeText(value);
                data.setValue(subNode.getNodeName(), value);
            // if ()
            // idToXmlMap.put(id, node.getTextContent());
            }
            idToDataMap.put(id, data);
        }
    // StringMaster.getnum
    }
}
Also used : Node(org.w3c.dom.Node) SpeechData(main.data.dialogue.SpeechData) Document(org.w3c.dom.Document)

Example 2 with SpeechData

use of main.data.dialogue.SpeechData in project Eidolons by IDemiurge.

the class SceneFactory method getScenes.

// TODO Speech?
public static List<DialogScenario> getScenes(GameDialogue dialogue) {
    Speech speech = dialogue.getRoot();
    List<SpeechData> fullData = new ArrayList<>();
    while (true) {
        fullData.add(speech.getData());
        if (speech.getChildren().isEmpty())
            break;
        speech = speech.getChildren().get(0);
    }
    return getScenes(fullData);
}
Also used : ArrayList(java.util.ArrayList) Speech(eidolons.game.battlecraft.logic.meta.scenario.dialogue.speech.Speech) SpeechData(main.data.dialogue.SpeechData)

Example 3 with SpeechData

use of main.data.dialogue.SpeechData in project Eidolons by IDemiurge.

the class SceneFactory method getScenes.

public static List<DialogScenario> getScenes(List<SpeechData> fullData) {
    Speech speech;
    // speech.getFormattedText()
    List<DialogScenario> list = new ArrayList<>();
    // for (String substring : StringMaster.open(data)) {
    TextureRegion backTexture = null;
    for (SpeechData data : fullData) {
        TextureRegion portraitTexture = null;
        String message = null;
        boolean skippable = true;
        Integer time = -1;
        message = data.getValue(SPEECH_VALUE.MESSAGE);
        if (!StringMaster.isEmpty(data.getValue(SPEECH_VALUE.ACTOR)))
            portraitTexture = TextureCache.getOrCreateR(DialogueActorMaster.getActor(data.getValue(SPEECH_VALUE.ACTOR)).getImagePath());
        if (!StringMaster.isEmpty(data.getValue(SPEECH_VALUE.BACKGROUND)))
            backTexture = TextureCache.getOrCreateR(data.getValue(SPEECH_VALUE.BACKGROUND));
        list.add(new DialogScenario(time, skippable, backTexture, message, portraitTexture));
    }
    return list;
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ArrayList(java.util.ArrayList) Speech(eidolons.game.battlecraft.logic.meta.scenario.dialogue.speech.Speech) DialogScenario(eidolons.libgdx.DialogScenario) SpeechData(main.data.dialogue.SpeechData)

Example 4 with SpeechData

use of main.data.dialogue.SpeechData in project Eidolons by IDemiurge.

the class SpeechBuilder method buildSpeech.

public Speech buildSpeech(Speech speech) {
    int id = speech.getId();
    SpeechData data = getIdToDataMap().get(id);
    speech.setData(data);
    String text = data.getValue(SPEECH_VALUE.MESSAGE);
    speech.setUnformattedText(text);
    text = processText(text, speech);
    speech.setFormattedText(text);
    return speech;
}
Also used : SpeechData(main.data.dialogue.SpeechData)

Aggregations

SpeechData (main.data.dialogue.SpeechData)4 Speech (eidolons.game.battlecraft.logic.meta.scenario.dialogue.speech.Speech)2 ArrayList (java.util.ArrayList)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 DialogScenario (eidolons.libgdx.DialogScenario)1 Document (org.w3c.dom.Document)1 Node (org.w3c.dom.Node)1