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
}
}
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);
}
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;
}
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;
}
Aggregations