use of com.bladecoder.engine.model.Verb in project bladecoder-adventure-engine by bladecoder.
the class I18NHandler method putTranslationsInElement.
public void putTranslationsInElement(BaseActor a) {
if (a instanceof InteractiveActor) {
InteractiveActor ia = (InteractiveActor) a;
// 1. DESC attribute
ia.setDesc(getTranslation(ia.getDesc()));
// 2. ACTIONS
HashMap<String, Verb> verbs = ia.getVerbManager().getVerbs();
for (Verb v : verbs.values()) putTranslationsInElement(v, false);
// 3. DIALOGS
if (a instanceof CharacterActor) {
HashMap<String, Dialog> dialogs = ((CharacterActor) a).getDialogs();
if (dialogs != null) {
for (Dialog d : dialogs.values()) putTranslationsInElement(d);
}
}
// 4. Text for TextRenderer
if (a instanceof SpriteActor && ((SpriteActor) a).getRenderer() instanceof TextRenderer) {
TextRenderer r = (TextRenderer) ((SpriteActor) a).getRenderer();
r.setText(getTranslation(r.getText()));
}
}
}
use of com.bladecoder.engine.model.Verb in project bladecoder-adventure-engine by bladecoder.
the class VerbList method addActions.
private void addActions() {
int pos = list.getSelectedIndex();
Verb v = null;
if (pos != -1) {
v = list.getItems().get(pos);
actionList.setScope(scopePanel.getScope());
actionList.addElements(v, v.getActions());
} else {
actionList.addElements(null, null);
actionList.setScope(null);
}
}
use of com.bladecoder.engine.model.Verb in project bladecoder-adventure-engine by bladecoder.
the class CheckDesc method visit.
@Override
public void visit(BaseActor a) {
if (a instanceof InteractiveActor) {
ia = (InteractiveActor) a;
hasLeave = false;
hasEnterExit = false;
if (ia.getInteraction()) {
HashMap<String, Verb> verbs = ia.getVerbManager().getVerbs();
for (Verb v : verbs.values()) checkVerb(v);
if (hasLeave || hasEnterExit)
return;
if (ia.getDesc() == null || ia.getDesc().trim().isEmpty()) {
EditorLogger.error("CheckDesc: " + a.getScene().getId() + "." + a.getId());
}
}
}
}
use of com.bladecoder.engine.model.Verb in project bladecoder-adventure-engine by bladecoder.
the class VerbList method delete.
@Override
protected void delete() {
Verb v = removeSelected();
parent.getVerbs().remove(v.getHashKey());
// TRANSLATIONS
if (scopePanel.getScope().equals(ScopePanel.WORLD_SCOPE))
Ctx.project.getI18N().putTranslationsInElement(v, true);
else
Ctx.project.getI18N().putTranslationsInElement(v, false);
// UNDO
Ctx.project.getUndoStack().add(new UndoDeleteVerb(parent, v));
// the last element
if (list.getSelectedIndex() == -1)
addActions();
Ctx.project.setModified();
}
use of com.bladecoder.engine.model.Verb in project bladecoder-adventure-engine by bladecoder.
the class VerbList method copy.
@Override
protected void copy() {
Verb e = list.getSelected();
if (e == null)
return;
clipboard = (Verb) ElementUtils.cloneElement(e);
toolbar.disablePaste(false);
// TRANSLATIONS
if (scopePanel.getScope().equals(ScopePanel.WORLD_SCOPE))
Ctx.project.getI18N().putTranslationsInElement(clipboard, true);
else
Ctx.project.getI18N().putTranslationsInElement(clipboard, false);
}
Aggregations