Search in sources :

Example 11 with Verb

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()));
        }
    }
}
Also used : Dialog(com.bladecoder.engine.model.Dialog) InteractiveActor(com.bladecoder.engine.model.InteractiveActor) Verb(com.bladecoder.engine.model.Verb) SpriteActor(com.bladecoder.engine.model.SpriteActor) CharacterActor(com.bladecoder.engine.model.CharacterActor) TextRenderer(com.bladecoder.engine.model.TextRenderer)

Example 12 with Verb

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);
    }
}
Also used : UndoDeleteVerb(com.bladecoder.engineeditor.undo.UndoDeleteVerb) Verb(com.bladecoder.engine.model.Verb)

Example 13 with Verb

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());
            }
        }
    }
}
Also used : InteractiveActor(com.bladecoder.engine.model.InteractiveActor) Verb(com.bladecoder.engine.model.Verb)

Example 14 with Verb

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();
}
Also used : UndoDeleteVerb(com.bladecoder.engineeditor.undo.UndoDeleteVerb) UndoDeleteVerb(com.bladecoder.engineeditor.undo.UndoDeleteVerb) Verb(com.bladecoder.engine.model.Verb)

Example 15 with Verb

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);
}
Also used : UndoDeleteVerb(com.bladecoder.engineeditor.undo.UndoDeleteVerb) Verb(com.bladecoder.engine.model.Verb)

Aggregations

Verb (com.bladecoder.engine.model.Verb)26 InteractiveActor (com.bladecoder.engine.model.InteractiveActor)14 Scene (com.bladecoder.engine.model.Scene)9 Action (com.bladecoder.engine.actions.Action)8 BaseActor (com.bladecoder.engine.model.BaseActor)8 CharacterActor (com.bladecoder.engine.model.CharacterActor)7 Dialog (com.bladecoder.engine.model.Dialog)6 SpriteActor (com.bladecoder.engine.model.SpriteActor)5 LookAtAction (com.bladecoder.engine.actions.LookAtAction)4 SayAction (com.bladecoder.engine.actions.SayAction)4 SetCutmodeAction (com.bladecoder.engine.actions.SetCutmodeAction)4 DialogOption (com.bladecoder.engine.model.DialogOption)4 TextRenderer (com.bladecoder.engine.model.TextRenderer)4 UndoDeleteVerb (com.bladecoder.engineeditor.undo.UndoDeleteVerb)4 Actor (com.badlogic.gdx.scenes.scene2d.Actor)2 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)2 AbstractControlAction (com.bladecoder.engine.actions.AbstractControlAction)2 AbstractIfAction (com.bladecoder.engine.actions.AbstractIfAction)2 CommentAction (com.bladecoder.engine.actions.CommentAction)2 DisableActionAction (com.bladecoder.engine.actions.DisableActionAction)2