Search in sources :

Example 6 with DialogOption

use of com.bladecoder.engine.model.DialogOption in project bladecoder-adventure-engine by bladecoder.

the class OptionList method down.

private void down() {
    int pos = list.getSelectedIndex();
    Array<DialogOption> items = list.getItems();
    if (pos == -1 || pos == items.size - 1)
        return;
    DialogOption e = items.get(pos);
    DialogOption e2 = items.get(pos + 1);
    parent.getOptions().set(pos + 1, e);
    parent.getOptions().set(pos, e2);
    items.set(pos + 1, e);
    items.set(pos, e2);
    list.setSelectedIndex(pos + 1);
    upBtn.setDisabled(list.getSelectedIndex() == 0);
    downBtn.setDisabled(list.getSelectedIndex() == list.getItems().size - 1);
    Ctx.project.setModified();
}
Also used : DialogOption(com.bladecoder.engine.model.DialogOption)

Example 7 with DialogOption

use of com.bladecoder.engine.model.DialogOption in project bladecoder-adventure-engine by bladecoder.

the class OptionList method create.

@Override
protected void create() {
    EditOptionDialog dialog = (EditOptionDialog) getEditElementDialogInstance(null);
    dialog.show(getStage());
    dialog.setListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            int pos = list.getSelectedIndex() + 1;
            DialogOption e = ((EditOptionDialog) actor).getElement();
            list.getItems().insert(pos, e);
            list.setSelectedIndex(pos);
            list.invalidateHierarchy();
        }
    });
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) Actor(com.badlogic.gdx.scenes.scene2d.Actor) PropertyChangeListener(java.beans.PropertyChangeListener) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) DialogOption(com.bladecoder.engine.model.DialogOption)

Example 8 with DialogOption

use of com.bladecoder.engine.model.DialogOption in project bladecoder-adventure-engine by bladecoder.

the class OptionList method up.

private void up() {
    int pos = list.getSelectedIndex();
    if (pos == -1 || pos == 0)
        return;
    Array<DialogOption> items = list.getItems();
    DialogOption e = items.get(pos);
    DialogOption e2 = items.get(pos - 1);
    items.set(pos - 1, e);
    items.set(pos, e2);
    parent.getOptions().set(pos - 1, e);
    parent.getOptions().set(pos, e2);
    list.setSelectedIndex(pos - 1);
    upBtn.setDisabled(list.getSelectedIndex() == 0);
    downBtn.setDisabled(list.getSelectedIndex() == list.getItems().size - 1);
    Ctx.project.setModified();
}
Also used : DialogOption(com.bladecoder.engine.model.DialogOption)

Example 9 with DialogOption

use of com.bladecoder.engine.model.DialogOption in project bladecoder-adventure-engine by bladecoder.

the class OptionList method paste.

@Override
protected void paste() {
    DialogOption newElement = (DialogOption) ElementUtils.cloneElement(clipboard);
    int pos = list.getSelectedIndex() + 1;
    list.getItems().insert(pos, newElement);
    parent.addOption(newElement);
    Ctx.project.getI18N().extractStrings(Ctx.project.getSelectedScene().getId(), Ctx.project.getSelectedActor().getId(), parent.getId(), pos, newElement);
    list.setSelectedIndex(pos);
    list.invalidateHierarchy();
    Ctx.project.setModified();
}
Also used : DialogOption(com.bladecoder.engine.model.DialogOption)

Example 10 with DialogOption

use of com.bladecoder.engine.model.DialogOption in project bladecoder-adventure-engine by bladecoder.

the class ModelWalker method walk.

public void walk(World w) {
    Map<String, Scene> scenes = World.getInstance().getScenes();
    for (StartVisitor sv : startVisitors) sv.start(w);
    for (Scene scn : scenes.values()) {
        for (SceneVisitor sv : sceneVisitors) sv.visit(scn);
        Map<String, BaseActor> actors = scn.getActors();
        // SCENE VERBS
        HashMap<String, Verb> verbs = scn.getVerbManager().getVerbs();
        for (Verb v : verbs.values()) {
            for (VerbVisitor vv : verbVisitors) vv.visit(scn, null, v);
            ArrayList<Action> actions = v.getActions();
            for (Action act : actions) {
                for (ActionVisitor av : actionVisitors) av.visit(scn, null, v, act);
            }
        }
        for (BaseActor a : actors.values()) {
            for (ActorVisitor av : actorVisitors) av.visit(a);
            if (a instanceof InteractiveActor) {
                InteractiveActor ia = (InteractiveActor) a;
                // ACTOR VERBS
                verbs = ia.getVerbManager().getVerbs();
                for (Verb v : verbs.values()) {
                    for (VerbVisitor vv : verbVisitors) vv.visit(scn, ia, v);
                    ArrayList<Action> actions = v.getActions();
                    for (Action act : actions) {
                        for (ActionVisitor av : actionVisitors) av.visit(scn, ia, v, act);
                    }
                }
            }
            // DIALOGS
            if (a instanceof CharacterActor) {
                HashMap<String, Dialog> dialogs = ((CharacterActor) a).getDialogs();
                if (dialogs != null) {
                    for (Dialog d : dialogs.values()) {
                        for (DialogVisitor dv : dialogVisitors) dv.visit((CharacterActor) a, d);
                        ArrayList<DialogOption> options = d.getOptions();
                        for (DialogOption o : options) {
                            for (DialogOptionVisitor ov : optionVisitors) ov.visit((CharacterActor) a, d, o);
                        }
                    }
                }
            }
        }
    }
    for (EndVisitor ev : endVisitors) ev.end(w);
}
Also used : Action(com.bladecoder.engine.actions.Action) InteractiveActor(com.bladecoder.engine.model.InteractiveActor) Scene(com.bladecoder.engine.model.Scene) CharacterActor(com.bladecoder.engine.model.CharacterActor) Dialog(com.bladecoder.engine.model.Dialog) Verb(com.bladecoder.engine.model.Verb) BaseActor(com.bladecoder.engine.model.BaseActor) DialogOption(com.bladecoder.engine.model.DialogOption)

Aggregations

DialogOption (com.bladecoder.engine.model.DialogOption)14 CharacterActor (com.bladecoder.engine.model.CharacterActor)6 Dialog (com.bladecoder.engine.model.Dialog)5 BaseActor (com.bladecoder.engine.model.BaseActor)4 InteractiveActor (com.bladecoder.engine.model.InteractiveActor)4 Scene (com.bladecoder.engine.model.Scene)4 Verb (com.bladecoder.engine.model.Verb)4 Action (com.bladecoder.engine.actions.Action)3 LookAtAction (com.bladecoder.engine.actions.LookAtAction)2 SayAction (com.bladecoder.engine.actions.SayAction)2 SetCutmodeAction (com.bladecoder.engine.actions.SetCutmodeAction)2 SpriteActor (com.bladecoder.engine.model.SpriteActor)2 Rectangle (com.badlogic.gdx.math.Rectangle)1 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)1 TextRenderer (com.bladecoder.engine.model.TextRenderer)1 World (com.bladecoder.engine.model.World)1 UndoDeleteOption (com.bladecoder.engineeditor.undo.UndoDeleteOption)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1