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